Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3 from josephyzhou/develop
Browse files Browse the repository at this point in the history
Migrated to here
  • Loading branch information
obscuren committed Feb 18, 2014
2 parents c866fcc + c5b009b commit bbcf304
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ethutil/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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)
}
}
Expand Down
30 changes: 30 additions & 0 deletions ethutil/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit bbcf304

Please sign in to comment.