1// Copyright 2017 Google LLC.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package testing
6
7import (
8	"reflect"
9	"testing"
10)
11
12func TestCompareSlices(t *testing.T) {
13	for _, test := range []struct {
14		a, b      []int
15		wantEqual bool
16	}{
17		{nil, nil, true},
18		{nil, []int{}, true},
19		{[]int{1, 2}, []int{1, 2}, true},
20		{[]int{1}, []int{1, 2}, false},
21		{[]int{1, 2}, []int{1}, false},
22		{[]int{1, 2}, []int{1, 3}, false},
23	} {
24		_, got := compareSlices(reflect.ValueOf(test.a), reflect.ValueOf(test.b))
25		if got != test.wantEqual {
26			t.Errorf("%v, %v: got %t, want %t", test.a, test.b, got, test.wantEqual)
27		}
28	}
29}
30