Skip to content

Commit ccd9b7f

Browse files
authored
Improved task 49
1 parent 2a79960 commit ccd9b7f

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package s0049_group_anagrams
22

33
import (
4-
"reflect"
4+
"github.com/stretchr/testify/assert"
55
"sort"
66
"testing"
77
)
@@ -15,23 +15,17 @@ func TestGroupAnagrams(t *testing.T) {
1515
for i := range actual {
1616
sort.Strings(actual[i])
1717
}
18-
if !reflect.DeepEqual(actual, expected) {
19-
t.Errorf("Expected: %v, but got: %v", expected, actual)
20-
}
18+
assert.Equal(t, expected, actual)
2119
}
2220

2321
func TestGroupAnagrams2(t *testing.T) {
2422
expected := [][]string{{""}}
2523
actual := groupAnagrams([]string{""})
26-
if !reflect.DeepEqual(actual, expected) {
27-
t.Errorf("Expected: %v, but got: %v", expected, actual)
28-
}
24+
assert.Equal(t, expected, actual)
2925
}
3026

3127
func TestGroupAnagrams3(t *testing.T) {
3228
expected := [][]string{{"a"}}
3329
actual := groupAnagrams([]string{"a"})
34-
if !reflect.DeepEqual(actual, expected) {
35-
t.Errorf("Expected: %v, but got: %v", expected, actual)
36-
}
30+
assert.Equal(t, expected, actual)
3731
}

0 commit comments

Comments
 (0)