Skip to content

Commit

Permalink
Q2.5: Improve code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
krlv committed Mar 15, 2019
1 parent e82c08f commit 0ee0984
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ch02/05_sum_lists_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,23 @@ func TestSumListsReverse(t *testing.T) {
}
actual = actual.next
}

n1 = New(1)
n1.AppendToTail(1)
n1.AppendToTail(1)

n2 = New(2)
n2.AppendToTail(2)
n2.AppendToTail(2)
n2.AppendToTail(2)

expected = []int{2, 3, 3, 3}
actual = SumListsReverse(n1, n2)

for i := 0; actual != nil; i++ {
if actual.data != expected[i] {
t.Errorf("%dth node expected to have data %v, got %v", i+1, expected[i], actual.data)
}
actual = actual.next
}
}

0 comments on commit 0ee0984

Please sign in to comment.