Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for deepEqual (0.15 sec)

  1. callbacks/helper_test.go

    				Values:  [][]interface{}{{true}},
    			},
    		},
    	}
    
    	for _, tc := range testCase {
    		t.Run(tc.name, func(t *testing.T) {
    			actual := ConvertMapToValuesForCreate(&gorm.Statement{}, tc.input)
    			if !reflect.DeepEqual(actual, tc.expect) {
    				t.Errorf("expect %v got %v", tc.expect, actual)
    			}
    		})
    	}
    }
    
    func TestConvertSliceOfMapToValuesForCreate(t *testing.T) {
    	testCase := []struct {
    		name   string
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 05 02:22:57 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  2. tests/preload_suits_test.go

    	}
    
    	if len(got) != 2 {
    		t.Errorf("got %v items, expected 2", len(got))
    	}
    
    	if !reflect.DeepEqual(got[0], want) && !reflect.DeepEqual(got[1], want) {
    		t.Fatalf("got %s; want array containing %s", toJSONString(got), toJSONString(want))
    	}
    
    	if !reflect.DeepEqual(got[0], want2) && !reflect.DeepEqual(got[1], want2) {
    		t.Errorf("got %s; want array containing %s", toJSONString(got), toJSONString(want2))
    	}
    }
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 18 05:38:46 GMT 2022
    - 30.3K bytes
    - Viewed (0)
  3. tests/connpool_test.go

    			"SELECT * FROM `users` WHERE name = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?",
    		},
    	}
    
    	defer func() {
    		if !reflect.DeepEqual(conn.got, conn.expect) {
    			t.Errorf("expect %#v but got %#v", conn.expect, conn.got)
    		}
    	}()
    
    	db, err := gorm.Open(mysql.New(mysql.Config{Conn: conn, DisableWithReturning: true}))
    	if err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  4. tests/embedded_struct_test.go

    	}
    
    	if hnPost.Author.Name != NewPost.Author.Name {
    		t.Errorf("Expected to get Author name %v but got: %v", NewPost.Author.Name, hnPost.Author.Name)
    	}
    
    	if !reflect.DeepEqual(NewPost.Author.Content, hnPost.Author.Content) {
    		t.Errorf("Expected to get Author content %v but got: %v", NewPost.Author.Content, hnPost.Author.Content)
    	}
    
    	if hnPost.Author.ContentPtr != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Oct 26 03:58:13 GMT 2023
    - 7.3K bytes
    - Viewed (0)
  5. utils/utils.go

    }
    
    func Contains(elems []string, elem string) bool {
    	for _, e := range elems {
    		if elem == e {
    			return true
    		}
    	}
    	return false
    }
    
    func AssertEqual(x, y interface{}) bool {
    	if reflect.DeepEqual(x, y) {
    		return true
    	}
    	if x == nil || y == nil {
    		return false
    	}
    
    	xval := reflect.ValueOf(x)
    	yval := reflect.ValueOf(y)
    	if xval.Kind() == reflect.Ptr && xval.IsNil() ||
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 22 06:43:02 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  6. tests/hooks_test.go

    	DB.AutoMigrate(&Product{})
    
    	p := Product{Code: "unique_code", Price: 100}
    	DB.Save(&p)
    
    	if !reflect.DeepEqual(p.GetCallTimes(), []int64{1, 1, 0, 1, 1, 0, 0, 0, 0}) {
    		t.Fatalf("Callbacks should be invoked successfully, %v", p.GetCallTimes())
    	}
    
    	DB.Where("Code = ?", "unique_code").First(&p)
    	if !reflect.DeepEqual(p.GetCallTimes(), []int64{1, 1, 0, 1, 0, 0, 0, 0, 1}) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  7. callbacks/create_test.go

    		Columns: []clause.Column{{Name: "name"}, {Name: "email"}, {Name: "age"}, {Name: "id"}},
    		Values: [][]interface{}{
    			{"alice", "email", 18, 1},
    			{"bob", "email", 19, 2},
    		},
    	}
    	if !reflect.DeepEqual(expected, values) {
    		t.Errorf("expected: %v got %v", expected, values)
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 05:48:42 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  8. utils/tests/utils.go

    		expect := ev.FieldByName(name).Interface()
    		t.Run(name, func(t *testing.T) {
    			AssertEqual(t, got, expect)
    		})
    	}
    }
    
    func AssertEqual(t *testing.T, got, expect interface{}) {
    	if !reflect.DeepEqual(got, expect) {
    		isEqual := func() {
    			if curTime, ok := got.(time.Time); ok {
    				format := "2006-01-02T15:04:05Z07:00"
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 10 09:21:56 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  9. tests/callbacks_test.go

    }
    
    func TestCallbacksGet(t *testing.T) {
    	db, _ := gorm.Open(nil, nil)
    	createCallback := db.Callback().Create()
    
    	createCallback.Before("*").Register("c1", c1)
    	if cb := createCallback.Get("c1"); reflect.DeepEqual(cb, c1) {
    		t.Errorf("callbacks tests failed, got: %p, want: %p", cb, c1)
    	}
    
    	createCallback.Remove("c1")
    	if cb := createCallback.Get("c2"); cb != nil {
    		t.Errorf("callbacks test failed. got: %p, want: nil", cb)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 7.2K bytes
    - Viewed (0)
  10. tests/scanner_valuer_test.go

    		t.Errorf("insert with sql.Expr, but got %v", stmt.SQL.String())
    	}
    
    	if !reflect.DeepEqual([]interface{}{"jinzhu", "POINT(100 100)"}, stmt.Vars) {
    		t.Errorf("generated vars is not equal, got %v", stmt.Vars)
    	}
    
    	stmt = dryRunDB.Model(UserWithPoint{}).Create(map[string]interface{}{
    		"Name":  "jinzhu",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
Back to top