Added HasAll utility method for string set.

Added HasAll method which detects if one set contains all
of the memebers of another set.

A.HasAll(B) returns true if A is a superset of B.
This commit is contained in:
Danny Jones
2014-07-18 13:08:11 -07:00
parent fda69bcca2
commit 2d9bad95f8
3 changed files with 22 additions and 1 deletions

View File

@@ -34,7 +34,8 @@ func TestValidateVolumes(t *testing.T) {
if len(errs) != 0 {
t.Errorf("expected success: %v", errs)
}
if len(names) != 4 || !names.Has("abc") || !names.Has("123") || !names.Has("abc-123") || !names.Has("empty") {
expectedSet := util.NewStringSet("abc", "123", "abc-123", "empty")
if len(names) != 4 || !names.HasAll(expectedSet) {
t.Errorf("wrong names result: %v", names)
}