fix tests

This commit is contained in:
Rory Hinnen
2026-09-08 16:38:09 -05:00
parent 178123c944
commit 241a753879
5 changed files with 68 additions and 31 deletions
+36
View File
@@ -0,0 +1,36 @@
{
"configurations" : [
{
"id" : "3E4A1B2C-5D6E-7F8A-9B0C-1D2E3F4A5B6C",
"name" : "Test Scheme Action",
"options" : {
}
}
],
"defaultOptions" : {
},
"testTargets" : [
{
"target" : {
"containerPath" : "container:DieHammer.xcodeproj",
"identifier" : "981AD0C927C30E32005A6492",
"name" : "Bunch O' DiceTests"
}
},
{
"target" : {
"containerPath" : "container:DieHammer.xcodeproj",
"identifier" : "981AD0D327C30E32005A6492",
"name" : "Bunch O' DiceUITests"
},
"uiTargetApp" : {
"containerPath" : "container:DieHammer.xcodeproj",
"identifier" : "981AD0B927C30E31005A6492",
"name" : "DieHammer"
}
}
],
"version" : 1
}
+8 -4
View File
@@ -63,7 +63,7 @@
98225DE02A3527160019DE8E /* dice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dice.swift; sourceTree = "<group>"; }; 98225DE02A3527160019DE8E /* dice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dice.swift; sourceTree = "<group>"; };
98325A2D2839BE4B0006DF4B /* RollState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RollState.swift; sourceTree = "<group>"; }; 98325A2D2839BE4B0006DF4B /* RollState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RollState.swift; sourceTree = "<group>"; };
98745CA52870CC670031166A /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; }; 98745CA52870CC670031166A /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
988997FF285814AB00B07E09 /* Bunch-O--Dice-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Bunch-O--Dice-Info.plist"; sourceTree = SOURCE_ROOT; }; 988997FF285814AB00B07E09 /* DieHammer.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = DieHammer.plist; sourceTree = SOURCE_ROOT; };
988B150E2854E9160082C2C5 /* HistoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryView.swift; sourceTree = "<group>"; }; 988B150E2854E9160082C2C5 /* HistoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryView.swift; sourceTree = "<group>"; };
988B1516285565610082C2C5 /* Onboarding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Onboarding.swift; sourceTree = "<group>"; }; 988B1516285565610082C2C5 /* Onboarding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Onboarding.swift; sourceTree = "<group>"; };
988B1518285566AD0082C2C5 /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = "<group>"; }; 988B1518285566AD0082C2C5 /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = "<group>"; };
@@ -130,7 +130,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
7692E8422BD55CDE005BDD76 /* PrivacyInfo.xcprivacy */, 7692E8422BD55CDE005BDD76 /* PrivacyInfo.xcprivacy */,
988997FF285814AB00B07E09 /* Bunch-O--Dice-Info.plist */, 988997FF285814AB00B07E09 /* DieHammer.plist */,
981AD0BD27C30E31005A6492 /* DieHammerApp.swift */, 981AD0BD27C30E31005A6492 /* DieHammerApp.swift */,
981AD0BF27C30E31005A6492 /* ContentView.swift */, 981AD0BF27C30E31005A6492 /* ContentView.swift */,
988B1518285566AD0082C2C5 /* OnboardingView.swift */, 988B1518285566AD0082C2C5 /* OnboardingView.swift */,
@@ -158,7 +158,8 @@
children = ( children = (
981AD0CE27C30E32005A6492 /* Bunch_O__DiceTests.swift */, 981AD0CE27C30E32005A6492 /* Bunch_O__DiceTests.swift */,
); );
path = "Bunch O' DiceTests"; name = "Bunch O' DiceTests";
path = DieHammerTests;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
981AD0D727C30E32005A6492 /* Bunch O' DiceUITests */ = { 981AD0D727C30E32005A6492 /* Bunch O' DiceUITests */ = {
@@ -167,7 +168,8 @@
981AD0D827C30E32005A6492 /* Bunch_O__DiceUITests.swift */, 981AD0D827C30E32005A6492 /* Bunch_O__DiceUITests.swift */,
981AD0DA27C30E32005A6492 /* Bunch_O__DiceUITestsLaunchTests.swift */, 981AD0DA27C30E32005A6492 /* Bunch_O__DiceUITestsLaunchTests.swift */,
); );
path = "Bunch O' DiceUITests"; name = "Bunch O' DiceUITests";
path = DieHammerUITests;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
981AD0E727C311DA005A6492 /* Model */ = { 981AD0E727C311DA005A6492 /* Model */ = {
@@ -537,6 +539,7 @@
); );
MARKETING_VERSION = 1.2; MARKETING_VERSION = 1.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.chartreusenecktie.Bunch-O--Dice"; PRODUCT_BUNDLE_IDENTIFIER = "com.chartreusenecktie.Bunch-O--Dice";
PRODUCT_MODULE_NAME = DieHammer;
PRODUCT_NAME = "Bunch O' Dice"; PRODUCT_NAME = "Bunch O' Dice";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@@ -568,6 +571,7 @@
); );
MARKETING_VERSION = 1.2; MARKETING_VERSION = 1.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.chartreusenecktie.Bunch-O--Dice"; PRODUCT_BUNDLE_IDENTIFIER = "com.chartreusenecktie.Bunch-O--Dice";
PRODUCT_MODULE_NAME = DieHammer;
PRODUCT_NAME = "Bunch O' Dice"; PRODUCT_NAME = "Bunch O' Dice";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "2700" LastUpgradeVersion = "2700"
version = "1.7"> version = "1.8">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
buildImplicitDependencies = "YES" buildImplicitDependencies = "YES"
@@ -28,29 +28,13 @@
selectedDebuggerIdentifier = "" selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn" selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES"> shouldAutocreateTestPlan = "NO">
<Testables> <TestPlans>
<TestableReference <TestPlanReference
skipped = "NO"> reference = "container:Bunch O' Dice.xctestplan"
<BuildableReference default = "YES">
BuildableIdentifier = "primary" </TestPlanReference>
BlueprintIdentifier = "981AD0C927C30E32005A6492" </TestPlans>
BuildableName = "Bunch O&apos; DiceTests.xctest"
BlueprintName = "DieHammerTests"
ReferencedContainer = "container:DieHammer.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "981AD0D327C30E32005A6492"
BuildableName = "Bunch O&apos; DiceUITests.xctest"
BlueprintName = "DieHammerUITests"
ReferencedContainer = "container:DieHammer.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "Debug"
@@ -9,6 +9,19 @@
<key>orderHint</key> <key>orderHint</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
<key>Bunch O' DiceUITests.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>981AD0D327C30E32005A6492</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict> </dict>
</dict> </dict>
</plist> </plist>
+3 -3
View File
@@ -203,8 +203,8 @@ struct RerollTests {
var d = Dice() var d = Dice()
d.one = 2; d.two = 2; d.three = 2; d.six = 4 d.one = 2; d.two = 2; d.three = 2; d.six = 4
d.rerollBelow(cutoff: 4) d.rerollBelow(cutoff: 4)
// The 4 sixes were not in the reroll range and should be unchanged // Sixes were not in the reroll range; rerolled dice may also produce sixes
#expect(d.six == 4) #expect(d.six >= 4)
} }
@Test("applyReroll: none mode leaves hasRerolled false") @Test("applyReroll: none mode leaves hasRerolled false")
@@ -266,7 +266,7 @@ struct RerollTests {
let total = roll.dice.one + roll.dice.two + roll.dice.three + let total = roll.dice.one + roll.dice.two + roll.dice.three +
roll.dice.four + roll.dice.five + roll.dice.six roll.dice.four + roll.dice.five + roll.dice.six
#expect(total == 5) #expect(total == 5)
#expect(roll.dice.six == 2) // dice above cutoff are untouched #expect(roll.dice.six >= 2) // dice above cutoff are untouched; rerolls may also produce sixes
} }
@Test("resetPool: clears hitHasRerolled flag") @Test("resetPool: clears hitHasRerolled flag")