github.com/qiaogw/arrgo@v0.0.8/utils_test.go (about)

     1  package arrgo
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestSameIntSlice(t *testing.T) {
     8  	var s1 []int = nil
     9  	var s2 []int = nil
    10  	if SameIntSlice(s1, s2) != false {
    11  		t.Error("if one of args is nil, the result should be false, but go ", SameIntSlice(s1, s2))
    12  	}
    13  	s3 := []int{1, 2, 3}
    14  	s4 := []int{1, 2}
    15  	if SameIntSlice(s3, s4) != false {
    16  		t.Error("different length should get false, got ", SameIntSlice(s3, s4))
    17  	}
    18  	s5 := []int{1, 2, 4}
    19  	if SameIntSlice(s3, s5) != false {
    20  		t.Error("bit wise different should get false, got ", SameIntSlice(s3, s5))
    21  	}
    22  	s6 := []int{1, 2, 3}
    23  	if SameIntSlice(s3, s6) != true {
    24  		t.Error("same int[] should get true, got ", SameIntSlice(s3, s6))
    25  	}
    26  }