Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(318)

Unified Diff: src/pkg/big/rat_test.go

Issue 3352041: code review 3352041: big: fix (*Rat) SetFrac64(a, b) when b < 0. (Closed)
Patch Set: code review 3352041: big: fix (*Rat) SetFrac64(a, b) when b < 0. Created 14 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/big/rat.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/big/rat_test.go
===================================================================
--- a/src/pkg/big/rat_test.go
+++ b/src/pkg/big/rat_test.go
@@ -257,3 +257,26 @@
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)
+ }
+ }
+}
« no previous file with comments | « src/pkg/big/rat.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b