Skip to content

Commit 74d0880

Browse files
committed
Added more tests
1 parent 80a8543 commit 74d0880

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package io.kotest.examples.jvm
2+
3+
import io.kotest.assertions.throwables.shouldThrowAny
4+
import io.kotest.core.spec.style.DescribeSpec
5+
import io.kotest.matchers.shouldBe
6+
7+
class BitstringTest : DescribeSpec() {
8+
init {
9+
it("should set bits based on booleans 1") {
10+
bitstring(listOf(true, false, true, false, true)) shouldBe "10101"
11+
bitstring(listOf(false, false, false, false, false, false, false, true)) shouldBe "00000001"
12+
}
13+
it("should error on empty") {
14+
shouldThrowAny {
15+
bitstring(listOf())
16+
}
17+
}
18+
}
19+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package io.kotest.examples.jvm
2+
3+
import io.kotest.core.spec.style.FunSpec
4+
import io.kotest.matchers.shouldBe
5+
6+
class SsnTest : FunSpec({
7+
8+
test("a SSN should be invalid when it contains a zero in any position") {
9+
validateSocial("543-23-5013") shouldBe false
10+
validateSocial("043-23-5313") shouldBe false
11+
validateSocial("313-03-5310") shouldBe false
12+
}
13+
14+
test("a SSN should be invalid when it starts with 666") {
15+
validateSocial("666-23-1234") shouldBe false
16+
}
17+
18+
test("a SSN should be in the required format") {
19+
validateSocial("123-45-6789") shouldBe true
20+
validateSocial("123-45-678") shouldBe false
21+
validateSocial("12-45-6789") shouldBe false
22+
validateSocial("1234-56-678") shouldBe false
23+
validateSocial("123456789") shouldBe false
24+
validateSocial("123-456789") shouldBe false
25+
validateSocial("12345-6789") shouldBe false
26+
validateSocial("") shouldBe false
27+
}
28+
})

0 commit comments

Comments
 (0)