Skip to content

Commit

Permalink
test(dsl): write tests for in and containsId
Browse files Browse the repository at this point in the history
  • Loading branch information
DanySK committed Feb 26, 2025
1 parent e079284 commit 09f0c23
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@ import kotlin.test.assertTrue
class FieldsTest {
private val emptyField = Field(0, 10)
private val fullField = Field(0, 1, mapOf(1 to 1, 2 to 2, 3 to 3))
private val charField = Field(0, 'a', mapOf(1 to 'b', 2 to 'c', 3 to 'd'))

@Test
fun `empty fields contain self`() {
assertTrue(10 in emptyField)
assertFalse(0 in emptyField)
assertTrue(emptyField.containsId(0))
}

@Test
fun `operator in for fields looks values`() {
assertFalse(charField.localId in charField)
assertTrue { charField.containsId(charField.localId) }
assertTrue(charField.localValue in charField)
for (neighbor in charField.neighbors) {
assertFalse(neighbor in charField)
assertTrue(charField.containsId(neighbor))
assertTrue(charField.toMap()[neighbor] in charField)
}
}

@Test
fun `The all operator on an empty field must return true`() {
Expand Down

0 comments on commit 09f0c23

Please sign in to comment.