Skip to content

Commit f9d31d4

Browse files
committed
Add unit tests
1 parent 6e0a114 commit f9d31d4

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@
2222

2323
### Metrics
2424
```text
25-
15050 number of properties
26-
10451 number of functions
27-
8905 number of classes
25+
15055 number of properties
26+
10456 number of functions
27+
8907 number of classes
2828
235 number of packages
2929
3514 number of kt files
3030
```
3131

3232

3333
### Complexity Report
3434
```text
35-
265695 lines of code (loc)
36-
164962 source lines of code (sloc)
37-
120475 logical lines of code (lloc)
35+
265730 lines of code (loc)
36+
164992 source lines of code (sloc)
37+
120498 logical lines of code (lloc)
3838
72531 comment lines of code (cloc)
39-
24870 cyclomatic complexity (mcc)
39+
24875 cyclomatic complexity (mcc)
4040
20331 cognitive complexity
4141
0 number of total code smells
4242
43 comment source ratio

src/test/kotlin/dev/shtanko/truth/TruthExampleTest.kt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,39 @@ class TruthExampleTest {
2525
val result = 2 + 2
2626
assertThat(result).isEqualTo(4)
2727
}
28+
29+
@Test
30+
fun testStrings() {
31+
val message = "Hello, Truth!"
32+
assertThat(message).contains("Truth")
33+
}
34+
}
35+
36+
class CollectionTruthTest {
37+
@Test
38+
fun testListContents() {
39+
val fruits = listOf("apple", "banana", "orange")
40+
assertThat(fruits).containsExactly("banana", "orange", "apple")
41+
}
42+
43+
@Test
44+
fun testMapContents() {
45+
val map = mapOf("kotlin" to 2.2, "java" to 21)
46+
assertThat(map).containsEntry("kotlin", 2.2)
47+
assertThat(map).doesNotContainKey("scala")
48+
}
49+
}
50+
51+
class NullableTruthTest {
52+
@Test
53+
fun testNullValues() {
54+
val name: String? = null
55+
assertThat(name).isNull()
56+
}
57+
58+
@Test
59+
fun testNonNull() {
60+
val language: String? = "Kotlin"
61+
assertThat(language).isNotNull()
62+
}
2863
}

0 commit comments

Comments
 (0)