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 48 49 50
|
package types_test
import (
"fmt"
"testing"
"github.com/rebuy-de/aws-nuke/pkg/types"
)
func TestSetInterset(t *testing.T) {
s1 := types.Collection{"a", "b", "c"}
s2 := types.Collection{"b", "a", "d"}
r := s1.Intersect(s2)
want := fmt.Sprint([]string{"a", "b"})
have := fmt.Sprint(r)
if want != have {
t.Errorf("Wrong result. Want: %s. Have: %s", want, have)
}
}
func TestSetRemove(t *testing.T) {
s1 := types.Collection{"a", "b", "c"}
s2 := types.Collection{"b", "a", "d"}
r := s1.Remove(s2)
want := fmt.Sprint([]string{"c"})
have := fmt.Sprint(r)
if want != have {
t.Errorf("Wrong result. Want: %s. Have: %s", want, have)
}
}
func TestSetUnion(t *testing.T) {
s1 := types.Collection{"a", "b", "c"}
s2 := types.Collection{"b", "a", "d"}
r := s1.Union(s2)
want := fmt.Sprint([]string{"a", "b", "c", "d"})
have := fmt.Sprint(r)
if want != have {
t.Errorf("Wrong result. Want: %s. Have: %s", want, have)
}
}
|