good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
0747aa3a
Commit
0747aa3a
authored
Dec 29, 2013
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
Removed logs from tests and updated rlp encoding to include byte slices
parent
74bc4511
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
rlp.go
+1
-1
1 addition, 1 deletion
rlp.go
rlp_test.go
+5
-7
5 additions, 7 deletions
rlp_test.go
with
6 additions
and
8 deletions
rlp.go
+
1
−
1
View file @
0747aa3a
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
rlp_test.go
+
5
−
7
View file @
0747aa3a
...
@@ -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
:=
"
\x83
CdogCgodCcat"
sliceRes
:=
"
\x83
CdogCgodCcat"
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
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment