Skip to content

Commit 81d982a

Browse files
authored
Add unit test to check MAX_INCREMENT is always an acceptable value (#10)
1 parent 3a8db91 commit 81d982a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/bits/src/commonTest/kotlin/org/kotlincrypto/bitops/bits/CounterUnitTest.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ class CounterUnitTest {
6262
}
6363
}
6464

65+
@Test
66+
fun givenIncrementBy_whenIsMaxIncrement_thenDoesNotThrowException() {
67+
// {Int/Long}.MAX_VALUE % incrementBy == 0
68+
Counter.Bit32(Counter.Bit32.MAX_INCREMENT)
69+
Counter.Bit64(Counter.Bit64.MAX_INCREMENT)
70+
}
71+
6572
@Test
6673
fun givenLo_whenNotFactoryIncrementBy_thenThrowsException() {
6774
// Would throw if 32 was not a factor of 8...

0 commit comments

Comments
 (0)