MCPcopy Create free account
hub / github.com/CPChain/chain / TestWritePrivateStateRoot

Function TestWritePrivateStateRoot

core/private_database_test.go:76–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

74}
75
76func TestWritePrivateStateRoot(t *testing.T) {
77 db := database.NewMemDatabase()
78 blockRoot := common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8})
79 privateRoot := common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8})
80
81 type args struct {
82 db database.Database
83 blockRoot common.Hash
84 root common.Hash
85 }
86 tests := []struct {
87 name string
88 args args
89 wantErr bool
90 }{
91 {
92 name: "Positive Case: write a private state root",
93 args: args{
94 db: db,
95 blockRoot: blockRoot,
96 root: privateRoot,
97 },
98 wantErr: false,
99 },
100 }
101 for _, tt := range tests {
102 t.Run(tt.name, func(t *testing.T) {
103 if err := WritePrivateStateRoot(tt.args.db, tt.args.blockRoot, tt.args.root); (err != nil) != tt.wantErr {
104 t.Errorf("WritePrivateStateRoot() error = %v, wantErr %v", err, tt.wantErr)
105 }
106 })
107 }
108}
109
110func TestWritePrivateReceipt(t *testing.T) {
111 type args struct {

Callers

nothing calls this directly

Calls 2

WritePrivateStateRootFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected