Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
s50600822 committed Nov 2, 2023
1 parent 6dad326 commit bb14c64
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/interview_prep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ jobs:
- name: Build and test Kotlin
run: |
cd interview_prep/algorithm/Kotlin
./gradlew test --warning-mode all
./gradlew test -i --warning-mode all
1 change: 1 addition & 0 deletions interview_prep/algorithm/Kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
kotlin("jvm") version "1.9.0"
application
`jvm-test-suite`
}

group = "hoa.can.code"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
import hoa.can.code.AddTwoNumbers
import hoa.can.code.ListNode
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import kotlin.test.DefaultAsserter.assertEquals

class AddTwoNumbersTest {
class AddTwoNumbersTest {
var sol = AddTwoNumbers()

@Test
@DisplayName("1+2=3")
fun test1() {
val n1 = ListNode(1)
val n2 = ListNode(2)
Assertions.assertEquals(
assertEquals(
"1+2=3",
ListNode(3),
sol.addTwoNumbers(n1, n2)
)
}

@Test
@DisplayName("10+20=30")
fun test2() {
val n1 = ListNode(1)
n1.next = ListNode(0)
val n2 = ListNode(2)
n2.next = ListNode(0)
val r = ListNode(3)
r.next = ListNode(0)
Assertions.assertEquals(
assertEquals(
"10+20=30",
r,
sol.addTwoNumbers(n1, n2)
)
}

@Test
@DisplayName("99+88=187")
fun test3() {
val n1 = ListNode(9)
n1.next = ListNode(9)
Expand All @@ -43,14 +42,14 @@ class AddTwoNumbersTest {
val r = ListNode(7)
r.next = ListNode(8)
r.next!!.next = ListNode(1)
Assertions.assertEquals(
assertEquals(
"99+88=187",
r,
sol.addTwoNumbers(n1, n2)
)
}

@Test
@DisplayName("243+564=708")
fun test4() {
val n1 = ListNode(2)
n1.next = ListNode(4)
Expand All @@ -61,7 +60,9 @@ class AddTwoNumbersTest {
val r = ListNode(7)
r.next = ListNode(0)
r.next!!.next = ListNode(8)
Assertions.assertEquals(

assertEquals(
"243+564=708",
r,
sol.addTwoNumbers(n1, n2)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class SqrtTest {
Sqrt sol = new Sqrt();

@Test
public void test() {
public void test () {
assertEquals(1, sol.sqrt(1));
assertEquals(2, sol.sqrt(4));
assertEquals(3, sol.sqrt(9));
Expand Down

0 comments on commit bb14c64

Please sign in to comment.