github.com/benz9527/xboot@v0.0.0-20240504061247-c23f15593274/lib/infra/ordered_key_test.go (about) 1 package infra 2 3 import ( 4 "math" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 ) 9 10 func TestComplexCompare(t *testing.T) { 11 var c1 complex128 = complex(1.0, 2.0) // 1.0+2.0i 12 var c2 complex128 = complex(1.1, 2.0) // 1.1+2.0i 13 _c1 := math.Hypot(real(c1), imag(c1)) 14 _c2 := math.Hypot(real(c2), imag(c2)) 15 assert.Greater(t, _c2, _c1) 16 }