github.com/scaleway/scaleway-cli@v1.11.1/pkg/pricing/utils_test.go (about) 1 package pricing 2 3 import ( 4 "fmt" 5 "math/big" 6 ) 7 8 func ShouldEqualBigRat(actual interface{}, expected ...interface{}) string { 9 actualRat := actual.(*big.Rat) 10 expectRat := expected[0].(*big.Rat) 11 cmp := actualRat.Cmp(expectRat) 12 if cmp == 0 { 13 return "" 14 } 15 16 output := fmt.Sprintf("big.Rat are not matching: %q != %q\n", actualRat, expectRat) 17 18 actualFloat64, _ := actualRat.Float64() 19 expectFloat64, _ := expectRat.Float64() 20 output += fmt.Sprintf(" %f != %f", actualFloat64, expectFloat64) 21 return output 22 }