Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests for chapter 1 & 3 so it works with golang >= 1.10 #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/chapter1/problem1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestIsUnique(t *testing.T) {
for _, c := range cases {
actual := IsUnique(c.input)
if actual != c.expected {
t.Fatalf("Input %s. Expected: %b, actual: %b\n", c.input, c.expected, actual)
t.Fatalf("Input %s. Expected: %t, actual: %t\n", c.input, c.expected, actual)
}
}
}
2 changes: 1 addition & 1 deletion src/chapter1/problem2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestArePermutations(t *testing.T) {
for _, c := range cases {
actual := ArePermutations(c.input1, c.input2)
if actual != c.expected {
t.Fatalf("Inputs %s, %s. Expected: %b, actual: %b\n",
t.Fatalf("Inputs %s, %s. Expected: %t, actual: %t\n",
c.input1, c.input2, c.expected, actual)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/chapter1/problem4_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestIsPalindromePerm(t *testing.T) {
for _, c := range cases {
actual := IsPalindromePerm(c.input)
if actual != c.expected {
t.Fatalf("Input %s. Expected: %b, actual: %b\n", c.input, c.expected, actual)
t.Fatalf("Input %s. Expected: %t, actual: %t\n", c.input, c.expected, actual)
}
}
}
2 changes: 1 addition & 1 deletion src/chapter1/problem5_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestAreOneEditAway(t *testing.T) {
for _, c := range cases {
actual := AreOneEditAway(c.input1, c.input2)
if actual != c.expected {
t.Fatalf("Inputs %s, %s. Expected: %b, actual: %b\n",
t.Fatalf("Inputs %s, %s. Expected: %t, actual: %t\n",
c.input1, c.input2, c.expected, actual)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/chapter1/problem9_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestIsRotation(t *testing.T) {
for _, c := range cases {
actual := IsRotation(c.input1, c.input2)
if actual != c.expected {
t.Fatalf("Inputs %s, %s. Expected: %b, actual: %b\n",
t.Fatalf("Inputs %s, %s. Expected: %t, actual: %t\n",
c.input1, c.input2, c.expected, actual)
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/chapter3/problem6_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ func TestPetShelter(t *testing.T) {
t.Fatalf("Unexpected error: %v\n", err)
}
if i.petType != DogType || i.name != "lucky" {
t.Fatalf("Expected: lucky, actual: %d\n", i.name)
t.Fatalf("Expected: lucky, actual: %s\n", i.name)
}
i, err = ps.dequeueDog()
if err != nil {
t.Fatalf("Unexpected error: %v\n", err)
}
if i.petType != DogType || i.name != "spot" {
t.Fatalf("Expected: spot, actual: %d\n", i.name)
t.Fatalf("Expected: spot, actual: %s\n", i.name)
}
i, err = ps.dequeueCat()
if err != nil {
t.Fatalf("Unexpected error: %v\n", err)
}
if i.petType != CatType || i.name != "snowball" {
t.Fatalf("Expected: snowball, actual: %d\n", i.name)
t.Fatalf("Expected: snowball, actual: %s\n", i.name)
}
}