krz/daybyday

iOS learning games for young children: days, months, seasons, numbers, letters, animals and more. education ios kids swift https://krz.sh/apps/daybyday/

DayByDayTests/MovesRoundTests.swift

062549ad26607ce9e973ed2a9a7ef6f853885f83
daybyday/DayByDayTests/MovesRoundTests.swift history · blame · raw

33 lines · 1068 bytes

4 symbols in this file
 1import Testing
 2@testable import DayByDay
 3
 4struct MovesRoundTests {
 5    @Test func fiveDistinctParts() {
 6        for seed in 0..<50 {
 7            var rng = SeededGenerator(seed: UInt64(seed))
 8            let r = MovesRound(using: &rng)
 9            #expect(r.parts.count == MovesRound.length)
10            #expect(Set(r.parts).count == MovesRound.length)
11        }
12    }
13
14    @Test func commandsForAll() {
15        #expect(LearnBodyPart.nose.command == "Touch your nose!")
16        #expect(LearnBodyPart.hands.command == "Clap your hands!")
17        #expect(LearnBodyPart.allCases.allSatisfy { $0.command.hasSuffix("!") })
18        #expect(Set(LearnBodyPart.allCases.map(\.command)).count == LearnBodyPart.allCases.count)
19    }
20
21    @Test func advancesToEnd() {
22        var rng = SeededGenerator(seed: 101)
23        var r = MovesRound(using: &rng)
24        for i in 0..<MovesRound.length {
25            #expect(r.current == r.parts[i])
26            r.next()
27        }
28        #expect(r.current == nil)
29        #expect(r.isDone)
30        r.next()
31        #expect(r.isDone)
32    }
33}