forked from jechols/workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stringlist_test.go
35 lines (28 loc) · 1.03 KB
/
stringlist_test.go
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
package main
import (
"testing"
"strings"
)
func assertEqualS(expected, actual string, message string, t *testing.T) {
if expected != actual {
t.Errorf("Expected %#v, but got %#v - %s", expected, actual, message)
}
}
func assertEqualI(expected, actual int, message string, t *testing.T) {
if expected != actual {
t.Errorf("Expected %#v, but got %#v - %s", expected, actual, message)
}
}
func TestStuff(t *testing.T) {
slist := NewStringList()
slist.AddString("string 1")
slist.AddString("string 2")
slist.AddString("string 3")
masterListString := strings.Join(slist.masterList.data, ",")
assertEqualS("string 1,string 2,string 3", masterListString, "Stringlist value", t)
assertEqualI(3, slist.masterList.Len(), "Master list size should be 3", t)
assertEqualI(0, slist.options.Len(), "Options should be empty at first", t)
_ = slist.RandomString()
assertEqualI(3, slist.masterList.Len(), "Master list size should still be 3", t)
assertEqualI(2, slist.options.Len(), "Options should include the remaining two strings", t)
}