Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
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
elixxir
client
Commits
7b7d7cf6
Commit
7b7d7cf6
authored
Oct 22, 2021
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
fixed tests and made it backwards compatible
parent
ec804810
No related branches found
No related tags found
1 merge request
!67
Release
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
interfaces/preimage/generate.go
+4
-0
4 additions, 0 deletions
interfaces/preimage/generate.go
storage/edge/edge_test.go
+9
-9
9 additions, 9 deletions
storage/edge/edge_test.go
with
13 additions
and
9 deletions
interfaces/preimage/generate.go
+
4
−
0
View file @
7b7d7cf6
...
...
@@ -6,6 +6,10 @@ import (
)
func
Generate
(
data
[]
byte
,
t
string
)
[]
byte
{
if
t
==
Default
{
return
data
}
// Hash fingerprints
h
,
_
:=
blake2b
.
New256
(
nil
)
h
.
Write
(
data
)
...
...
This diff is collapsed.
Click to expand it.
storage/edge/edge_test.go
+
9
−
9
View file @
7b7d7cf6
...
...
@@ -149,7 +149,7 @@ func TestStore_Add(t *testing.T) {
"
\n
expected: %d
\n
received: %d"
,
identities
[
0
],
3
,
len
(
pis
))
}
expected
:=
Preimage
{
preimage
.
Generate
(
identities
[
0
]
.
Bytes
(),
preimage
.
Default
),
preimage
.
Default
,
identities
[
0
]
.
Bytes
()}
expected
:=
Preimage
{
preimage
.
MakeDefault
(
identities
[
0
]),
preimage
.
Default
,
identities
[
0
]
.
Bytes
()}
if
!
reflect
.
DeepEqual
(
pis
[
expected
.
key
()],
expected
)
{
t
.
Errorf
(
"First Preimage of first Preimages does not match expected."
+
"
\n
expected: %+v
\n
received: %+v"
,
expected
,
pis
[
expected
.
key
()])
...
...
@@ -174,7 +174,7 @@ func TestStore_Add(t *testing.T) {
"
\n
expected: %d
\n
received: %d"
,
identities
[
1
],
2
,
len
(
pis
))
}
expected
=
Preimage
{
preimage
.
Generate
(
identities
[
1
]
.
Bytes
(),
preimage
.
Default
),
preimage
.
Default
,
identities
[
1
]
.
Bytes
()}
expected
=
Preimage
{
preimage
.
MakeDefault
(
identities
[
1
]),
preimage
.
Default
,
identities
[
1
]
.
Bytes
()}
if
!
reflect
.
DeepEqual
(
pis
[
expected
.
key
()],
expected
)
{
t
.
Errorf
(
"First Preimage of second Preimages does not match expected."
+
"
\n
expected: %+v
\n
received: %+v"
,
expected
,
pis
[
expected
.
key
()])
...
...
@@ -292,7 +292,7 @@ func TestStore_Remove(t *testing.T) {
t
.
Errorf
(
"Remove returned an error: %+v"
,
err
)
}
if
len
(
s
.
edge
)
!=
3
{
if
len
(
s
.
edge
)
!=
2
{
t
.
Errorf
(
"Length of edge incorrect.
\n
expected: %d
\n
received: %d"
,
2
,
len
(
s
.
edge
))
}
...
...
@@ -318,9 +318,9 @@ func TestStore_Remove(t *testing.T) {
pis
=
s
.
edge
[
*
identities
[
1
]]
if
len
(
pis
)
!=
1
{
if
len
(
pis
)
!=
0
{
t
.
Errorf
(
"Length of preimages for identity %s inocrrect."
+
"
\n
expected: %d
\n
received: %d"
,
identities
[
1
],
1
,
len
(
pis
))
"
\n
expected: %d
\n
received: %d"
,
identities
[
1
],
0
,
len
(
pis
))
}
wg
.
Wait
()
...
...
@@ -349,7 +349,7 @@ func TestStore_Get(t *testing.T) {
}
expected
:=
[]
Preimage
{
{
preimage
.
Generate
(
identities
[
0
]
.
Bytes
(),
preimage
.
Default
),
preimage
.
Default
,
identities
[
0
]
.
Bytes
()},
{
preimage
.
MakeDefault
(
identities
[
0
]),
preimage
.
Default
,
identities
[
0
]
.
Bytes
()},
preimages
[
0
],
preimages
[
2
],
}
...
...
@@ -375,7 +375,7 @@ top:
}
expected
=
[]
Preimage
{
{
preimage
.
Generate
(
identities
[
1
]
.
Bytes
(),
preimage
.
Default
),
preimage
.
Default
,
identities
[
1
]
.
Bytes
()},
{
preimage
.
MakeDefault
(
identities
[
1
]),
preimage
.
Default
,
identities
[
1
]
.
Bytes
()},
preimages
[
1
],
}
...
...
@@ -475,12 +475,12 @@ func TestLoadStore(t *testing.T) {
expectedPis
:=
[][]
Preimage
{
{
Preimage
{
preimage
.
Generate
(
identities
[
0
]
.
Bytes
(),
preimage
.
Default
),
preimage
.
Default
,
identities
[
0
]
.
Bytes
()},
Preimage
{
preimage
.
MakeDefault
(
identities
[
0
]),
preimage
.
Default
,
identities
[
0
]
.
Bytes
()},
preimages
[
0
],
preimages
[
2
],
},
{
Preimage
{
preimage
.
Generate
(
identities
[
1
]
.
Bytes
(),
preimage
.
Default
),
preimage
.
Default
,
identities
[
1
]
.
Bytes
()},
Preimage
{
preimage
.
MakeDefault
(
identities
[
1
]),
preimage
.
Default
,
identities
[
1
]
.
Bytes
()},
preimages
[
1
],
},
}
...
...
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