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

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

Issue 90080043: code review 90080043: math/big: fix Int.Exp (Closed)
Left Patch Set: diff -r c313673339c4 https://code.google.com/p/go/ Created 9 years, 11 months ago
Right Patch Set: diff -r c313673339c4 https://code.google.com/p/go/ Created 9 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:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/math/big/int.go ('k') | src/pkg/math/big/nat.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
(no file at all)
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/gob" 9 "encoding/gob"
10 "encoding/hex" 10 "encoding/hex"
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 if n := x.BitLen(); n != test.out { 761 if n := x.BitLen(); n != test.out {
762 t.Errorf("#%d got %d want %d", i, n, test.out) 762 t.Errorf("#%d got %d want %d", i, n, test.out)
763 } 763 }
764 } 764 }
765 } 765 }
766 766
767 var expTests = []struct { 767 var expTests = []struct {
768 x, y, m string 768 x, y, m string
769 out string 769 out string
770 }{ 770 }{
771 // y <= 0
772 {"0", "0", "", "1"},
773 {"1", "0", "", "1"},
774 {"-10", "0", "", "1"},
775 {"1234", "-1", "", "1"},
776
777 // m == 1
778 {"0", "0", "1", "0"},
779 {"1", "0", "1", "0"},
780 {"-10", "0", "1", "0"},
781 {"1234", "-1", "1", "0"},
782
783 // misc
771 {"5", "-7", "", "1"}, 784 {"5", "-7", "", "1"},
772 {"-5", "-7", "", "1"}, 785 {"-5", "-7", "", "1"},
773 {"5", "0", "", "1"}, 786 {"5", "0", "", "1"},
774 {"-5", "0", "", "1"}, 787 {"-5", "0", "", "1"},
775 {"5", "1", "", "5"}, 788 {"5", "1", "", "5"},
776 {"-5", "1", "", "-5"}, 789 {"-5", "1", "", "-5"},
777 {"-2", "3", "2", "0"}, 790 {"-2", "3", "2", "0"},
778 {"5", "2", "", "25"}, 791 {"5", "2", "", "25"},
779 {"1", "65537", "2", "1"}, 792 {"1", "65537", "2", "1"},
780 {"0x8000000000000000", "2", "", "0x40000000000000000000000000000000"}, 793 {"0x8000000000000000", "2", "", "0x40000000000000000000000000000000"},
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 t.Errorf("XML encoding of %s failed: got %s want %s", &t x, &rx, &tx) 1592 t.Errorf("XML encoding of %s failed: got %s want %s", &t x, &rx, &tx)
1580 } 1593 }
1581 } 1594 }
1582 } 1595 }
1583 1596
1584 func TestIssue2607(t *testing.T) { 1597 func TestIssue2607(t *testing.T) {
1585 // This code sequence used to hang. 1598 // This code sequence used to hang.
1586 n := NewInt(10) 1599 n := NewInt(10)
1587 n.Rand(rand.New(rand.NewSource(9)), n) 1600 n.Rand(rand.New(rand.NewSource(9)), n)
1588 } 1601 }
LEFTRIGHT

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