Add basic tests for DiffSect function

This commit is contained in:
2018-07-07 20:56:53 +01:00
parent a883e08a3f
commit 484eca552b
23 changed files with 6064 additions and 4 deletions

34
diffsect_test.go Normal file
View File

@@ -0,0 +1,34 @@
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestDiffSect(t *testing.T) {
tests := []struct {
a []string
b []string
c []string
result []string
}{
{
a: []string{"1", "2", "3"},
b: []string{"1", "2", "3", "4", "5", "6"},
c: []string{"1", "2", "3", "4", "5", "6", "7", "8", "9"},
result: []string{"4", "5", "6"},
},
{
a: []string{"1", "2", "3"},
b: []string{"1", "2", "4", "5", "6"},
c: []string{"1", "5", "6", "7", "8", "9"},
result: []string{"5", "6"},
},
}
for _, pair := range tests {
result := DiffSect(&pair.a, &pair.b, &pair.c)
assert.Equal(t, *result, pair.result)
}
}