good morning!!!!

Skip to content
Snippets Groups Projects
Commit 0747aa3a authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

Removed logs from tests and updated rlp encoding to include byte slices

parent 74bc4511
No related branches found
No related tags found
No related merge requests found
...@@ -132,7 +132,7 @@ func Encode(object interface{}) []byte { ...@@ -132,7 +132,7 @@ func Encode(object interface{}) []byte {
case []byte: case []byte:
// Cast the byte slice to a string // Cast the byte slice to a string
//buff.Write(Encode(string(t))) buff.Write(Encode(string(t)))
case []interface{}, []string: case []interface{}, []string:
// Inline function for writing the slice header // Inline function for writing the slice header
......
...@@ -7,13 +7,14 @@ import ( ...@@ -7,13 +7,14 @@ import (
func TestEncode(t *testing.T) { func TestEncode(t *testing.T) {
strRes := "Cdog" strRes := "Cdog"
bytes := Encode("dog") bytes := Encode("dog")
str := string(bytes) str := string(bytes)
if str != strRes { if str != strRes {
t.Error(fmt.Sprintf("Expected %q, got %q", strRes, str)) t.Error(fmt.Sprintf("Expected %q, got %q", strRes, str))
} }
dec,_ := Decode(bytes, 0) //dec,_ := Decode(bytes, 0)
fmt.Printf("raw: %v encoded: %q == %v\n", dec, str, "dog")
sliceRes := "\x83CdogCgodCcat" sliceRes := "\x83CdogCgodCcat"
strs := []string{"dog", "god", "cat"} strs := []string{"dog", "god", "cat"}
...@@ -23,8 +24,7 @@ func TestEncode(t *testing.T) { ...@@ -23,8 +24,7 @@ func TestEncode(t *testing.T) {
t.Error(fmt.Sprintf("Expected %q, got %q", sliceRes, slice)) t.Error(fmt.Sprintf("Expected %q, got %q", sliceRes, slice))
} }
dec,_ = Decode(bytes, 0) //dec,_ = Decode(bytes, 0)
fmt.Printf("raw: %v encoded: %q == %v\n", dec, slice, strs)
} }
func TestMultiEncode(t *testing.T) { func TestMultiEncode(t *testing.T) {
...@@ -42,10 +42,8 @@ func TestMultiEncode(t *testing.T) { ...@@ -42,10 +42,8 @@ func TestMultiEncode(t *testing.T) {
} }
bytes := Encode(inter) bytes := Encode(inter)
fmt.Printf("%q\n", bytes)
dec, _ := Decode(bytes, 0) Decode(bytes, 0)
fmt.Println(dec)
} }
func BenchmarkEncodeDecode(b *testing.B) { func BenchmarkEncodeDecode(b *testing.B) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment