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

Delta Between Two Patch Sets: src/pkg/big/int_test.go

Issue 967041: code review 967041: big: Add some tests (Closed)
Left Patch Set: code review 967041: big: Add some tests Created 14 years, 11 months ago
Right Patch Set: code review 967041: big: Add some tests Created 14 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/big/nat_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package big 5 package big
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "encoding/hex" 9 "encoding/hex"
10 "testing" 10 "testing"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 fromStringTest{"0", 10, 0, true}, 144 fromStringTest{"0", 10, 0, true},
145 fromStringTest{"0", 16, 0, true}, 145 fromStringTest{"0", 16, 0, true},
146 fromStringTest{"10", 0, 10, true}, 146 fromStringTest{"10", 0, 10, true},
147 fromStringTest{"10", 10, 10, true}, 147 fromStringTest{"10", 10, 10, true},
148 fromStringTest{"10", 16, 16, true}, 148 fromStringTest{"10", 16, 16, true},
149 fromStringTest{"-10", 16, -16, true}, 149 fromStringTest{"-10", 16, -16, true},
150 fromStringTest{in: "0x", ok: false}, 150 fromStringTest{in: "0x", ok: false},
151 fromStringTest{"0x10", 0, 16, true}, 151 fromStringTest{"0x10", 0, 16, true},
152 fromStringTest{in: "0x10", base: 16, ok: false}, 152 fromStringTest{in: "0x10", base: 16, ok: false},
153 fromStringTest{"-0x10", 0, -16, true}, 153 fromStringTest{"-0x10", 0, -16, true},
154 fromStringTest{"00", 0, 0, true},
155 fromStringTest{"0", 8, 0, true},
156 fromStringTest{"07", 0, 7, true},
157 fromStringTest{"7", 8, 7, true},
158 fromStringTest{in: "08", ok: false},
159 fromStringTest{in: "8", base: 8, ok: false},
160 fromStringTest{"023", 0, 19, true},
161 fromStringTest{"23", 8, 19, true},
154 } 162 }
155 163
156 164
157 func TestSetString(t *testing.T) { 165 func TestSetString(t *testing.T) {
158 n2 := new(Int) 166 n2 := new(Int)
159 for i, test := range fromStringTests { 167 for i, test := range fromStringTests {
160 n1, ok1 := new(Int).SetString(test.in, test.base) 168 n1, ok1 := new(Int).SetString(test.in, test.base)
161 n2, ok2 := n2.SetString(test.in, test.base) 169 n2, ok2 := n2.SetString(test.in, test.base)
162 expected := new(Int).New(test.out) 170 expected := new(Int).New(test.out)
163 if ok1 != test.ok || ok2 != test.ok { 171 if ok1 != test.ok || ok2 != test.ok {
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 func TestInt64(t *testing.T) { 679 func TestInt64(t *testing.T) {
672 for i, testVal := range int64Tests { 680 for i, testVal := range int64Tests {
673 in := NewInt(testVal) 681 in := NewInt(testVal)
674 out := in.Int64() 682 out := in.Int64()
675 683
676 if out != testVal { 684 if out != testVal {
677 t.Errorf("#%d got %d want %d", i, out, testVal) 685 t.Errorf("#%d got %d want %d", i, out, testVal)
678 } 686 }
679 } 687 }
680 } 688 }
LEFTRIGHT

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