aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2014-11-05 20:23:50 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2014-11-05 20:23:50 +0800
commite76c58d175dd5b50deb2d5fb4582adae4cd3f7ef (patch)
tree0dcc2a48a6e75b0512abd151f777d32ed21e88ce
parent92299b7c2449940c4b98f1aebcd53076780a7704 (diff)
downloadgo-tangerine-e76c58d175dd5b50deb2d5fb4582adae4cd3f7ef.tar
go-tangerine-e76c58d175dd5b50deb2d5fb4582adae4cd3f7ef.tar.gz
go-tangerine-e76c58d175dd5b50deb2d5fb4582adae4cd3f7ef.tar.bz2
go-tangerine-e76c58d175dd5b50deb2d5fb4582adae4cd3f7ef.tar.lz
go-tangerine-e76c58d175dd5b50deb2d5fb4582adae4cd3f7ef.tar.xz
go-tangerine-e76c58d175dd5b50deb2d5fb4582adae4cd3f7ef.tar.zst
go-tangerine-e76c58d175dd5b50deb2d5fb4582adae4cd3f7ef.zip
New test coverage for ethutil/big.go
-rw-r--r--ethutil/big_test.go63
1 files changed, 63 insertions, 0 deletions
diff --git a/ethutil/big_test.go b/ethutil/big_test.go
new file mode 100644
index 000000000..b26e58b5c
--- /dev/null
+++ b/ethutil/big_test.go
@@ -0,0 +1,63 @@
+package ethutil
+
+import (
+ "fmt"
+ "testing"
+)
+
+func TestMisc(t *testing.T) {
+ a := Big("10")
+ b := Big("57896044618658097711785492504343953926634992332820282019728792003956564819968")
+ c := []byte{1, 2, 3, 4}
+ fmt.Println(b)
+ z := BitTest(a, 1)
+ fmt.Println(z)
+
+ U256(a)
+ S256(a)
+
+ U256(b)
+ S256(b)
+
+ BigD(c)
+}
+
+func TestBigMax(t *testing.T) {
+ a := Big("10")
+ b := Big("5")
+
+ max1 := BigMax(a, b)
+ if max1 != a {
+ t.Errorf("Expected %d got %d", a, max1)
+ }
+
+ max2 := BigMax(b, a)
+ if max2 != a {
+ t.Errorf("Expected %d got %d", a, max2)
+ }
+}
+
+func TestBigMin(t *testing.T) {
+ a := Big("10")
+ b := Big("5")
+
+ min1 := BigMin(a, b)
+ if min1 != b {
+ t.Errorf("Expected %d got %d", b, min1)
+ }
+
+ min2 := BigMin(b, a)
+ if min2 != b {
+ t.Errorf("Expected %d got %d", b, min2)
+ }
+}
+
+func TestBigCopy(t *testing.T) {
+ a := Big("10")
+ b := BigCopy(a)
+ c := Big("1000000000000")
+ y := BigToBytes(b, 16)
+ z := BigToBytes(c, 16)
+ fmt.Println(y)
+ fmt.Println(z)
+}