(t *testing.T)
| 32 | ) |
| 33 | |
| 34 | func TestGetPrivateStateRoot(t *testing.T) { |
| 35 | db := database.NewMemDatabase() |
| 36 | blockRoot := common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}) |
| 37 | privateRoot := common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}) |
| 38 | |
| 39 | WritePrivateStateRoot(db, blockRoot, privateRoot) |
| 40 | |
| 41 | type args struct { |
| 42 | db database.Database |
| 43 | blockRoot common.Hash |
| 44 | } |
| 45 | tests := []struct { |
| 46 | name string |
| 47 | args args |
| 48 | want common.Hash |
| 49 | }{ |
| 50 | { |
| 51 | name: "Positive Case: get private state root", |
| 52 | args: args{ |
| 53 | db: db, |
| 54 | blockRoot: blockRoot, |
| 55 | }, |
| 56 | want: privateRoot, |
| 57 | }, |
| 58 | { |
| 59 | name: "Get private state root which does not exist ", |
| 60 | args: args{ |
| 61 | db: db, |
| 62 | blockRoot: common.Hash{}, |
| 63 | }, |
| 64 | want: common.Hash{}, |
| 65 | }, |
| 66 | } |
| 67 | for _, tt := range tests { |
| 68 | t.Run(tt.name, func(t *testing.T) { |
| 69 | if got := GetPrivateStateRoot(tt.args.db, tt.args.blockRoot); !reflect.DeepEqual(got, tt.want) { |
| 70 | t.Errorf("GetPrivateStateRoot() = %v, want %v", got, tt.want) |
| 71 | } |
| 72 | }) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | func TestWritePrivateStateRoot(t *testing.T) { |
| 77 | db := database.NewMemDatabase() |
nothing calls this directly
no test coverage detected