diff --git a/group/group_test.go b/group/group_test.go index 11fb7a5..a92885c 100644 --- a/group/group_test.go +++ b/group/group_test.go @@ -11,6 +11,28 @@ import ( "github.com/pion/webrtc/v3" ) +func TestConstantTimeCompare(t *testing.T) { + tests := []struct { + a, b string + }{ + {"", ""}, + {"a", "a"}, + {"foo", "foo"}, + {"foo", "bar"}, + {"foo", "foo1"}, + {"foo1", "foo"}, + } + + for _, test := range tests { + e := constantTimeCompare(test.a, test.b) + if e != (test.a == test.b) { + t.Errorf("constantTimeCompare(%v, %v): got %v", + test.a, test.b, e, + ) + } + } +} + func TestGroup(t *testing.T) { groups.groups = nil Add("group", &Description{})