Commit e8538bdf authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add unit test for constantTimeCompare.

parent 7bb70b43
......@@ -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{})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment