33
33
34
34
stringType = reflect .TypeOf ("" )
35
35
36
+ uintptrType = reflect .TypeOf (uintptr (1 ))
37
+
36
38
timeType = reflect .TypeOf (time.Time {})
37
39
bytesType = reflect .TypeOf ([]byte {})
38
40
)
@@ -345,16 +347,37 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
345
347
346
348
return CompareType (bytes .Compare (bytesObj1 , bytesObj2 )), true
347
349
}
350
+
351
+ case reflect .Uintptr :
352
+ {
353
+ uintptrObj1 , ok := obj1 .(uintptr )
354
+ if ! ok {
355
+ uintptrObj1 = obj1Value .Convert (uintptrType ).Interface ().(uintptr )
356
+ }
357
+ uintptrObj2 , ok := obj2 .(uintptr )
358
+ if ! ok {
359
+ uintptrObj2 = obj2Value .Convert (uintptrType ).Interface ().(uintptr )
360
+ }
361
+ if uintptrObj1 > uintptrObj2 {
362
+ return compareGreater , true
363
+ }
364
+ if uintptrObj1 == uintptrObj2 {
365
+ return compareEqual , true
366
+ }
367
+ if uintptrObj1 < uintptrObj2 {
368
+ return compareLess , true
369
+ }
370
+ }
348
371
}
349
372
350
373
return compareEqual , false
351
374
}
352
375
353
376
// Greater asserts that the first element is greater than the second
354
377
//
355
- // assert.Greater(t, 2, 1)
356
- // assert.Greater(t, float64(2), float64(1))
357
- // assert.Greater(t, "b", "a")
378
+ // assert.Greater(t, 2, 1)
379
+ // assert.Greater(t, float64(2), float64(1))
380
+ // assert.Greater(t, "b", "a")
358
381
func Greater (t TestingT , e1 interface {}, e2 interface {}, msgAndArgs ... interface {}) bool {
359
382
if h , ok := t .(tHelper ); ok {
360
383
h .Helper ()
@@ -364,10 +387,10 @@ func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface
364
387
365
388
// GreaterOrEqual asserts that the first element is greater than or equal to the second
366
389
//
367
- // assert.GreaterOrEqual(t, 2, 1)
368
- // assert.GreaterOrEqual(t, 2, 2)
369
- // assert.GreaterOrEqual(t, "b", "a")
370
- // assert.GreaterOrEqual(t, "b", "b")
390
+ // assert.GreaterOrEqual(t, 2, 1)
391
+ // assert.GreaterOrEqual(t, 2, 2)
392
+ // assert.GreaterOrEqual(t, "b", "a")
393
+ // assert.GreaterOrEqual(t, "b", "b")
371
394
func GreaterOrEqual (t TestingT , e1 interface {}, e2 interface {}, msgAndArgs ... interface {}) bool {
372
395
if h , ok := t .(tHelper ); ok {
373
396
h .Helper ()
@@ -377,9 +400,9 @@ func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...in
377
400
378
401
// Less asserts that the first element is less than the second
379
402
//
380
- // assert.Less(t, 1, 2)
381
- // assert.Less(t, float64(1), float64(2))
382
- // assert.Less(t, "a", "b")
403
+ // assert.Less(t, 1, 2)
404
+ // assert.Less(t, float64(1), float64(2))
405
+ // assert.Less(t, "a", "b")
383
406
func Less (t TestingT , e1 interface {}, e2 interface {}, msgAndArgs ... interface {}) bool {
384
407
if h , ok := t .(tHelper ); ok {
385
408
h .Helper ()
@@ -389,10 +412,10 @@ func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{})
389
412
390
413
// LessOrEqual asserts that the first element is less than or equal to the second
391
414
//
392
- // assert.LessOrEqual(t, 1, 2)
393
- // assert.LessOrEqual(t, 2, 2)
394
- // assert.LessOrEqual(t, "a", "b")
395
- // assert.LessOrEqual(t, "b", "b")
415
+ // assert.LessOrEqual(t, 1, 2)
416
+ // assert.LessOrEqual(t, 2, 2)
417
+ // assert.LessOrEqual(t, "a", "b")
418
+ // assert.LessOrEqual(t, "b", "b")
396
419
func LessOrEqual (t TestingT , e1 interface {}, e2 interface {}, msgAndArgs ... interface {}) bool {
397
420
if h , ok := t .(tHelper ); ok {
398
421
h .Helper ()
@@ -402,8 +425,8 @@ func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inter
402
425
403
426
// Positive asserts that the specified element is positive
404
427
//
405
- // assert.Positive(t, 1)
406
- // assert.Positive(t, 1.23)
428
+ // assert.Positive(t, 1)
429
+ // assert.Positive(t, 1.23)
407
430
func Positive (t TestingT , e interface {}, msgAndArgs ... interface {}) bool {
408
431
if h , ok := t .(tHelper ); ok {
409
432
h .Helper ()
@@ -414,8 +437,8 @@ func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
414
437
415
438
// Negative asserts that the specified element is negative
416
439
//
417
- // assert.Negative(t, -1)
418
- // assert.Negative(t, -1.23)
440
+ // assert.Negative(t, -1)
441
+ // assert.Negative(t, -1.23)
419
442
func Negative (t TestingT , e interface {}, msgAndArgs ... interface {}) bool {
420
443
if h , ok := t .(tHelper ); ok {
421
444
h .Helper ()
0 commit comments