Add default empty gen init test

This commit is contained in:
Christian Treffs 2020-08-21 12:19:34 +02:00
parent 92506042a1
commit db0fdb641d
No known key found for this signature in database
GPG Key ID: 49A4B4B460BE3ED4
2 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,12 @@ final class EntityIdGenTests: XCTestCase {
XCTAssertEqual(gen.nextId(), 0)
}
func testGeneratorWithDefaultEmptyCollection() {
gen = DefaultEntityIdGenerator(startProviding: [])
XCTAssertEqual(gen.nextId(), 0)
XCTAssertEqual(gen.nextId(), 1)
}
func testLinearIncrement() {
for i in 0..<1_000_000 {
XCTAssertEqual(gen.nextId(), EntityIdentifier(EntityIdentifier.Identifier(i)))

View File

@ -40,6 +40,7 @@ extension EntityIdGenTests {
("testGenerateWithInitialIds", testGenerateWithInitialIds),
("testGeneratorDefaultInit", testGeneratorDefaultInit),
("testGeneratorMarkUnused", testGeneratorMarkUnused),
("testGeneratorWithDefaultEmptyCollection", testGeneratorWithDefaultEmptyCollection),
("testLinearIncrement", testLinearIncrement)
]
}