MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / Test_EntryCreation

Function Test_EntryCreation

internal/core/entry_test.go:28–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func Test_EntryCreation(t *testing.T) {
29 k := []byte("k")
30 v := []byte("v")
31 ttl := 12
32 txId := 121212
33 entry := core.NewEntry().
34 WithKey(k).
35 WithValue(v).
36 WithMeta(
37 core.NewMetaData().
38 WithTTL(uint32(ttl)).
39 WithTxID(uint64(txId)).
40 WithDs(core.DataStructureBTree).
41 WithKeySize(1).WithValueSize(1),
42 )
43
44 assert.Equal(
45 t,
46 []byte(strconv2.Int64ToStr(int64(txId))),
47 entry.GetTxIDBytes())
48 assert.Equal(
49 t,
50 uint32(ttl),
51 entry.Meta.TTL,
52 )
53 assert.Equal(t, entry.Key, k)
54 assert.Equal(t, entry.Value, v)
55 assert.True(t, entry.IsBelongsToBTree())
56 assert.False(t, entry.IsZero())
57}
58
59func Test_EntryMostFunctions(t *testing.T) {
60 r := require.New(t)

Callers

nothing calls this directly

Calls 13

NewEntryFunction · 0.92
NewMetaDataFunction · 0.92
WithMetaMethod · 0.80
WithKeySizeMethod · 0.80
WithDsMethod · 0.80
GetTxIDBytesMethod · 0.80
IsBelongsToBTreeMethod · 0.80
IsZeroMethod · 0.80
WithValueMethod · 0.45
WithKeyMethod · 0.45
WithValueSizeMethod · 0.45
WithTxIDMethod · 0.45

Tested by

no test coverage detected