diff options
Diffstat (limited to 'src/LivingVillage.Desktop.Tests/P64EvidenceTests.fs')
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/P64EvidenceTests.fs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop.Tests/P64EvidenceTests.fs b/src/LivingVillage.Desktop.Tests/P64EvidenceTests.fs new file mode 100644 index 0000000..9000a04 --- /dev/null +++ b/src/LivingVillage.Desktop.Tests/P64EvidenceTests.fs @@ -0,0 +1,56 @@ +namespace LivingVillage.Desktop.Tests + +open Microsoft.VisualStudio.TestTools.UnitTesting +open LivingVillage.Kernel +open LivingVillage.Kernel.Sim +open LivingVillage.Desktop +open LivingVillage.Desktop.VillagePresentation + +/// P64(A3 成熟度):样板区三处视觉缺口的可复现约束。 +/// 1. 俯瞰上半部(local y 0..6)不再是空场:足量中密度补种且种类多样。 +/// 2. 桥在既有位置加可读性细节:4 块护岸石分列桥两侧水线。 +/// 3. 内景下半部补入椅/凳/床尾凳/壶 4 件家具。 +[<TestClass>] +type P64EvidenceTests () = + + let samplePlan () = VillageArt.sampleRenderPlan () + + [<TestMethod>] + member _.OverviewUpperBandIsDenselyPopulated () = + let plan = samplePlan () + let upper = + plan.Props + |> List.filter (fun prop -> prop.Kind <> VillageArt.House && prop.Position.Y >= 0 && prop.Position.Y <= 6) + let kinds = upper |> List.map (fun prop -> prop.Kind) |> List.distinct + Assert.IsTrue(upper.Length >= 8, sprintf "上半部补种不足:%d" upper.Length) + Assert.IsTrue(kinds.Length >= 4, sprintf "上半部地物种类不足:%A" kinds) + for kind in [ VillageArt.VegetablePatch; VillageArt.BambooGrove; VillageArt.ShrubPatch; VillageArt.FlowerBush ] do + Assert.IsTrue(kinds |> List.contains kind, sprintf "上半部缺少 %A" kind) + // 北侧田埂小径贯通 x0..19。 + for x in 0 .. 19 do + Assert.IsTrue( + plan.Grounds |> List.contains ({ X = x; Y = 0 }, VillageArt.StonePath), + sprintf "北侧小径缺格 (%d,0)" x) + + [<TestMethod>] + member _.BridgeAbutmentsFlankTheSingleSampleBridge () = + let plan = samplePlan () + let abutments = VillageArt.sampleBridgeAbutmentTiles plan + Assert.AreEqual<int>(4, abutments.Length) + Assert.AreEqual<int>(4, (abutments |> List.distinct |> List.length)) + let bridgeTiles = + plan.Props + |> List.filter (fun prop -> prop.Kind = VillageArt.Bridge) + |> List.collect (fun prop -> + [ for dy in 0 .. 2 -> ({ X = prop.Position.X; Y = prop.Position.Y + dy } : TilePosition) ]) + |> List.map (VillageArt.worldTile plan) + for tile in abutments do + Assert.IsFalse(bridgeTiles |> List.contains tile, "护岸石不得压在桥面上") + + [<TestMethod>] + member _.InteriorLowerBandGainsFurniture () = + let plan = samplePlan () + let kinds = plan.Interior.Elements |> List.map (fun element -> element.Kind) + Assert.AreEqual<int>(8, plan.Interior.Elements.Length) + for kind in [ VillageArt.Chair; VillageArt.Stool; VillageArt.BedFoot; VillageArt.Teapot ] do + Assert.IsTrue(kinds |> List.contains kind, sprintf "内景缺少 %A" kind) |
