LEFT | RIGHT |
(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 Loading... |
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 Loading... |
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 } |
LEFT | RIGHT |