-
Notifications
You must be signed in to change notification settings - Fork 67
/
unknown_test.go
42 lines (38 loc) · 1.12 KB
/
unknown_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package verkle
import "testing"
func TestUnknownFuncs(t *testing.T) {
t.Parallel()
un := UnknownNode{}
if err := un.Insert(nil, nil, nil); err != errMissingNodeInStateless {
t.Errorf("got %v, want %v", err, errMissingNodeInStateless)
}
if _, err := un.Delete(nil, nil); err == nil {
t.Errorf("got nil error when deleting from a hashed node")
}
if _, err := un.Get(nil, nil); err != nil {
t.Errorf("got %v, want nil", err)
}
var identity Point
identity.SetIdentity()
if comm := un.Commit(); !comm.Equal(&identity) {
t.Errorf("got %v, want identity", comm)
}
if comm := un.Commitment(); !comm.Equal(&identity) {
t.Errorf("got %v, want identity", comm)
}
if _, _, _, err := un.GetProofItems(nil, nil); err == nil {
t.Errorf("got nil error when getting proof items from a hashed node")
}
if _, err := un.Serialize(); err == nil {
t.Errorf("got nil error when serializing a hashed node")
}
if un != un.Copy() {
t.Errorf("copy returned a different node")
}
if un.toDot("", "") != "" {
t.Errorf("toDot returned a non-empty string")
}
if !un.Hash().Equal(&FrZero) {
t.Errorf("hash returned non-zero")
}
}