- NOTICE: copyright, GPL-3.0-only, and three additional terms of the kinds section 7 permits - (b) preserve the notices and the attribution in the program's legal notices, (c) mark a modified version as different and do not call it "FrameLedger" alone, (e) no trademark rights in the name. Shipped as licenses\NOTICE.txt; release.yml refuses a published tree without it. - Section 7 wants additional terms named in the source files: every first-party .cs .cpp .h .inl .ps1 .xaml file (1,053; src/native/third_party excluded) opens with the SPDX line and a pointer to NOTICE. tools/notice-check.ps1 is the gate (six self-test cases, both directions; -Fix writes a missing header) and tools/resx-gen.ps1 generates the string accessors with the header. - The native VERSIONINFO LegalCopyright said GPL-3.0-or-later; it now names the real licence. - CONTRIBUTING.md, FORKING.md, CODE_OF_CONDUCT.md (Contributor Covenant 2.1 by reference), legal/TRADEMARKS.md. - 12_BUILD gate list, CLAUDE.md layout and conventions. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
// SPDX-License-Identifier: GPL-3.0-only
|
|
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
|
|
|
using FluentAssertions;
|
|
using FrameLedger.Domain.Detection;
|
|
|
|
namespace FrameLedger.Domain.Tests;
|
|
|
|
/// <summary>
|
|
/// What must invalidate a cached detection result, and what must not.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// 05_DETECTION §Caching triggers a re-run on an executable change or a rules
|
|
/// change. Each of those is a separate row here, because a key that ignores one
|
|
/// of them caches a stale answer indefinitely and there is no user-visible
|
|
/// symptom until somebody notices the library card is wrong.
|
|
/// </remarks>
|
|
public sealed class DetectionCacheKeyTests
|
|
{
|
|
private static DetectionCacheKey Key(
|
|
string path = @"C:\Games\Example\Game.exe",
|
|
long size = 1024,
|
|
long mtime = 1_700_000_000_000,
|
|
string rules = "2026.08.1") =>
|
|
new() { ExePath = path, SizeBytes = size, MtimeUnixMs = mtime, RulesVersion = rules };
|
|
|
|
[Fact]
|
|
public void AnUnchangedGameAndUnchangedRules_ReuseTheCachedResult() =>
|
|
Key().Should().Be(Key());
|
|
|
|
[Fact]
|
|
public void ARebuiltExecutableOfTheSameSize_InvalidatesOnMtime() =>
|
|
Key(mtime: 1_700_000_001_000).Should().NotBe(Key());
|
|
|
|
[Fact]
|
|
public void APatchedExecutableWithThePreservedTimestamp_InvalidatesOnSize() =>
|
|
Key(size: 2048).Should().NotBe(Key());
|
|
|
|
[Fact]
|
|
public void ARulesUpdate_InvalidatesEveryCachedResult() =>
|
|
Key(rules: "2026.09.1").Should().NotBe(Key());
|
|
|
|
[Fact]
|
|
public void AMovedInstall_IsADifferentKey() =>
|
|
Key(path: @"D:\Games\Example\Game.exe").Should().NotBe(Key());
|
|
}
|