aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-02-19 18:40:02 +0800
committerobscuren <geffobscura@gmail.com>2014-02-19 18:40:02 +0800
commit0936e5ccf5c8fc842cbd135c02a6abcd009b4e7f (patch)
tree9c867dbb5061be01bb040f9bafcf12236679383e /ethutil
parent24f2b2afc3a848190822c382e6aa31c8ab120f07 (diff)
parent531b3a96ebc408c00f67cee00ebe7fe192bf0b8c (diff)
downloadgo-tangerine-0936e5ccf5c8fc842cbd135c02a6abcd009b4e7f.tar.gz
go-tangerine-0936e5ccf5c8fc842cbd135c02a6abcd009b4e7f.tar.zst
go-tangerine-0936e5ccf5c8fc842cbd135c02a6abcd009b4e7f.zip
Merge branch 'develop' of github.com-obscure:ethereum/eth-go into develop
Conflicts: ethutil/config.go
Diffstat (limited to 'ethutil')
-rw-r--r--ethutil/config.go2
-rw-r--r--ethutil/encoding_test.go30
2 files changed, 31 insertions, 1 deletions
diff --git a/ethutil/config.go b/ethutil/config.go
index 70553fb5b..e61c347de 100644
--- a/ethutil/config.go
+++ b/ethutil/config.go
@@ -39,7 +39,7 @@ func ReadConfig(base string) *config {
_, err := os.Stat(path)
if err != nil {
if os.IsNotExist(err) {
- log.Printf("Debug logging directory %s doesn't exist, creating it", path)
+ log.Printf("Debug logging directory %s doesn't exist, creating it\n", path)
os.Mkdir(path, 0777)
}
}
diff --git a/ethutil/encoding_test.go b/ethutil/encoding_test.go
index bcabab0b1..cbfbc0eaf 100644
--- a/ethutil/encoding_test.go
+++ b/ethutil/encoding_test.go
@@ -35,3 +35,33 @@ func TestCompactHexDecode(t *testing.T) {
t.Error("Error compact hex decode. Expected", exp, "got", res)
}
}
+
+func TestCompactDecode(t *testing.T) {
+ exp := []int{1, 2, 3, 4, 5}
+ res := CompactDecode("\x11\x23\x45")
+
+ if !CompareIntSlice(res, exp) {
+ t.Error("odd compact decode. Expected", exp, "got", res)
+ }
+
+ exp = []int{0, 1, 2, 3, 4, 5}
+ res = CompactDecode("\x00\x01\x23\x45")
+
+ if !CompareIntSlice(res, exp) {
+ t.Error("even compact decode. Expected", exp, "got", res)
+ }
+
+ exp = []int{0, 15, 1, 12, 11, 8 /*term*/, 16}
+ res = CompactDecode("\x20\x0f\x1c\xb8")
+
+ if !CompareIntSlice(res, exp) {
+ t.Error("even terminated compact decode. Expected", exp, "got", res)
+ }
+
+ exp = []int{15, 1, 12, 11, 8 /*term*/, 16}
+ res = CompactDecode("\x3f\x1c\xb8")
+
+ if !CompareIntSlice(res, exp) {
+ t.Error("even terminated compact decode. Expected", exp, "got", res)
+ }
+} \ No newline at end of file