MCPcopy Create free account
hub / github.com/distributedio/titan / TestGetString

Function TestGetString

db/string_test.go:50–106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48)
49
50func TestGetString(t *testing.T) {
51 txn, err := mockDB.Begin()
52 assert.NoError(t, err)
53 NewString(txn, TestExistKey)
54 type args struct {
55 txn *Transaction
56 key []byte
57 }
58 type want struct {
59 key *String
60 val []byte
61 }
62 tests := []struct {
63 name string
64 args args
65 want want
66 }{
67 {
68 name: "GetExistString",
69 args: args{
70 txn: txn,
71 key: TestExistKey,
72 },
73 want: want{
74 key: &String{
75 key: TestExistKey,
76 txn: txn,
77 },
78 val: value,
79 },
80 },
81 {
82 name: "GetNoExistString",
83 args: args{
84 txn: txn,
85 key: TestNoExistKey,
86 },
87 want: want{
88 key: &String{
89 key: TestNoExistKey,
90 txn: txn,
91 },
92 val: nil,
93 },
94 },
95 }
96 for _, tt := range tests {
97 t.Run(tt.name, func(t *testing.T) {
98 callFunc := func(txn *Transaction) {
99 got, err := GetString(tt.args.txn, tt.args.key)
100 assert.NoError(t, err)
101 compareGetString(t, tt.want.key, got)
102 }
103 MockTest(t, callFunc)
104 })
105 }
106}
107

Callers

nothing calls this directly

Calls 5

NewStringFunction · 0.85
GetStringFunction · 0.85
compareGetStringFunction · 0.85
MockTestFunction · 0.85
BeginMethod · 0.80

Tested by

no test coverage detected