Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
og-rek
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
og-rek
Commits
add8993d
Commit
add8993d
authored
Nov 23, 2013
by
Damian Gryski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: use reflect.DeepEqual() instead of custom implementation
parent
d00e99e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
38 deletions
+2
-38
ogórek_test.go
ogórek_test.go
+2
-38
No files found.
ogórek_test.go
View file @
add8993d
...
@@ -14,43 +14,6 @@ func bigInt(s string) *big.Int {
...
@@ -14,43 +14,6 @@ func bigInt(s string) *big.Int {
return
i
return
i
}
}
func
equal
(
a
,
b
interface
{})
bool
{
if
reflect
.
TypeOf
(
a
)
!=
reflect
.
TypeOf
(
b
)
{
return
false
}
switch
a
.
(
type
)
{
case
[]
interface
{}
:
ia
:=
a
.
([]
interface
{})
ib
:=
b
.
([]
interface
{})
if
len
(
ia
)
!=
len
(
ib
)
{
return
false
}
for
i
:=
0
;
i
<
len
(
ia
);
i
++
{
if
!
equal
(
ia
[
i
],
ib
[
i
])
{
return
false
}
}
return
true
case
map
[
interface
{}]
interface
{}
:
ia
:=
a
.
(
map
[
interface
{}]
interface
{})
ib
:=
b
.
(
map
[
interface
{}]
interface
{})
if
len
(
ia
)
!=
len
(
ib
)
{
return
false
}
for
k
:=
range
ia
{
if
!
equal
(
ia
[
k
],
ib
[
k
])
{
return
false
}
}
return
true
case
*
big
.
Int
:
return
a
.
(
*
big
.
Int
)
.
Cmp
(
b
.
(
*
big
.
Int
))
==
0
default
:
return
a
==
b
}
}
func
TestMarker
(
t
*
testing
.
T
)
{
func
TestMarker
(
t
*
testing
.
T
)
{
buf
:=
bytes
.
Buffer
{}
buf
:=
bytes
.
Buffer
{}
dec
:=
NewDecoder
(
&
buf
)
dec
:=
NewDecoder
(
&
buf
)
...
@@ -93,7 +56,8 @@ func TestDecode(t *testing.T) {
...
@@ -93,7 +56,8 @@ func TestDecode(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
if
!
equal
(
v
,
test
.
expected
)
{
if
!
reflect
.
DeepEqual
(
v
,
test
.
expected
)
{
t
.
Errorf
(
"%s: got
\n
%q
\n
expected
\n
%q"
,
test
.
name
,
v
,
test
.
expected
)
t
.
Errorf
(
"%s: got
\n
%q
\n
expected
\n
%q"
,
test
.
name
,
v
,
test
.
expected
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment