1 // Copyright 2014 The go-ethereum Authors
2 // This file is part of the go-ethereum library.
4 // The go-ethereum library is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // The go-ethereum library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
24 func TestMisc(t *testing.T) {
26 b := Big("57896044618658097711785492504343953926634992332820282019728792003956564819968")
27 c := []byte{1, 2, 3, 4}
31 t.Error("Expected true got", z)
43 func TestBigMax(t *testing.T) {
49 t.Errorf("Expected %d got %d", a, max1)
54 t.Errorf("Expected %d got %d", a, max2)
58 func TestBigMin(t *testing.T) {
64 t.Errorf("Expected %d got %d", b, min1)
69 t.Errorf("Expected %d got %d", b, min2)
73 func TestBigCopy(t *testing.T) {
76 c := Big("1000000000000")
77 y := BigToBytes(b, 16)
78 ybytes := []byte{0, 10}
79 z := BigToBytes(c, 16)
80 zbytes := []byte{232, 212, 165, 16, 0}
82 if bytes.Compare(y, ybytes) != 0 {
83 t.Error("Got", ybytes)
86 if bytes.Compare(z, zbytes) != 0 {
87 t.Error("Got", zbytes)