github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/p/demo/int256/int256_test.gno (about) 1 // ported from github.com/mempooler/int256 2 package int256 3 4 import ( 5 "testing" 6 ) 7 8 func TestSign(t *testing.T) { 9 tests := []struct { 10 x string 11 want int 12 }{ 13 {"0", 0}, 14 {"1", 1}, 15 {"-1", -1}, 16 } 17 18 for _, tc := range tests { 19 z := MustFromDecimal(tc.x) 20 got := z.Sign() 21 if got != tc.want { 22 t.Errorf("Sign(%s) = %d, want %d", tc.x, got, tc.want) 23 } 24 } 25 }