Files
go-learning/exercises/01-core/02-slices-maps-strings/collections_test.go
T

28 lines
571 B
Go

package collections
import (
"reflect"
"testing"
)
func TestUniqueInts(t *testing.T) {
got := UniqueInts([]int{3, 1, 2, 3, 1, 4})
want := []int{3, 1, 2, 4}
if !reflect.DeepEqual(got, want) {
t.Fatalf("got %v, want %v", got, want)
}
}
func TestWordCounts(t *testing.T) {
got := WordCounts("Go go is fast and GO works")
if got["go"] != 3 || got["fast"] != 1 {
t.Fatalf("unexpected counts: %v", got)
}
}
func TestReverseRunes(t *testing.T) {
if got := ReverseRunes("zażółć"); got != "ćłóżaz" {
t.Fatalf("got %q, want %q", got, "ćłóżaz")
}
}