aboutsummaryrefslogtreecommitdiff
path: root/challenge-215/lance-wicks/go/main_test.go
blob: 5780a65ffa5a9052a1c9ba18bcf9cba13c0f04d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main

import "testing"

func TestIsNotAlphaOrder(t *testing.T) {

	got := IsNotAlphaOrder("abc")
	want := false

	if got != want {
		t.Errorf("Did not return false")
	}

	got = IsNotAlphaOrder("acb")
	want = true

	if got != want {
		t.Errorf("Did not return true")
	}
}

func TestCount(t *testing.T) {

	input := []string{"abc", "xyz", "tsu"}
	got := Count(input)
	want := 1

	if got != want {
		t.Errorf("got %d, wanted %d", got, want)
	}

	input = []string{"rat", "cab", "dad"}
	got = Count(input)
	want = 3

	if got != want {
		t.Errorf("got %d, wanted %d", got, want)
	}

	input = []string{"x", "y", "z"}
	got = Count(input)
	want = 0

	if got != want {
		t.Errorf("got %d, wanted %d", got, want)
	}
}