Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for TestEqualFunc (0.42 sec)

  1. src/maps/maps_test.go

    	return v1 == v2 || (isNaN(v1) && isNaN(v2))
    }
    
    // equalStr compares ints and strings.
    func equalIntStr(v1 int, v2 string) bool {
    	return strconv.Itoa(v1) == v2
    }
    
    func TestEqualFunc(t *testing.T) {
    	if !EqualFunc(m1, m1, equal[int]) {
    		t.Errorf("EqualFunc(%v, %v, equal) = false, want true", m1, m1)
    	}
    	if EqualFunc(m1, (map[int]int)(nil), equal[int]) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Dec 05 17:05:56 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  2. pkg/slices/slices_test.go

    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			got := Equal(tt.s1, tt.s2)
    			if got != tt.want {
    				t.Errorf("Equal() = %v, want %v", got, tt.want)
    			}
    		})
    	}
    }
    
    func TestEqualFunc(t *testing.T) {
    	tests := []struct {
    		name string
    		s1   []int
    		s2   []int
    		eq   func(int, int) bool
    		want bool
    	}{
    		{
    			name: "Equal slices",
    			s1:   []int{1, 2, 3},
    			s2:   []int{1, 2, 3},
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri May 10 23:33:56 UTC 2024
    - 18.2K bytes
    - Viewed (0)
  3. src/slices/slices_test.go

    	return v1 == v2 || (isNaN(v1) && isNaN(v2))
    }
    
    // offByOne returns true if integers v1 and v2 differ by 1.
    func offByOne(v1, v2 int) bool {
    	return v1 == v2+1 || v1 == v2-1
    }
    
    func TestEqualFunc(t *testing.T) {
    	for _, test := range equalIntTests {
    		if got := EqualFunc(test.s1, test.s2, equal[int]); got != test.want {
    			t.Errorf("EqualFunc(%v, %v, equal[int]) = %t, want %t", test.s1, test.s2, got, test.want)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 13:32:06 UTC 2024
    - 33.2K bytes
    - Viewed (0)
Back to top