Created
June 15, 2020 00:58
-
-
Save pacuna/bce019f93e845990a2757c6aeef050b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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