summaryrefslogtreecommitdiff
path: root/libgo/go/big/rat_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/big/rat_test.go')
-rw-r--r--libgo/go/big/rat_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/libgo/go/big/rat_test.go b/libgo/go/big/rat_test.go
index 460ed409e02..8f42949b087 100644
--- a/libgo/go/big/rat_test.go
+++ b/libgo/go/big/rat_test.go
@@ -257,3 +257,26 @@ func TestIssue820(t *testing.T) {
t.Errorf("got %s want %s", z, q)
}
}
+
+
+var setFrac64Tests = []struct {
+ a, b int64
+ out string
+}{
+ {0, 1, "0"},
+ {0, -1, "0"},
+ {1, 1, "1"},
+ {-1, 1, "-1"},
+ {1, -1, "-1"},
+ {-1, -1, "1"},
+ {-9223372036854775808, -9223372036854775808, "1"},
+}
+
+func TestRatSetFrac64Rat(t *testing.T) {
+ for i, test := range setFrac64Tests {
+ x := new(Rat).SetFrac64(test.a, test.b)
+ if x.RatString() != test.out {
+ t.Errorf("#%d got %s want %s", i, x.RatString(), test.out)
+ }
+ }
+}