Skip to content

Instantly share code, notes, and snippets.

@pacuna

pacuna/lrtL5X7v.go

Created Jun 15, 2020
Embed
What would you like to do?
package simplelist
import "testing"
func Test_List(t *testing.T) {
l := New()
l.Add([]byte("item1"))
l.Add([]byte("item2"))
if l.Size() != 2 {
t.Errorf("Size()=%d, want 2", l.Size())
}
if !l.Contains([]byte("item1")) {
t.Error("item1 should be present")
}
if l.Contains([]byte("nonPresentItem")) {
t.Error("item doesn't exist in the set")
}
l.Remove([]byte("item2"))
if l.Contains([]byte("item2")) {
t.Error("item2 doesn't exist in the set")
}
if l.Size() != 1 {
t.Errorf("Size()=%d, want 1", l.Size())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment