MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestFromAccountAndNonce

Function TestFromAccountAndNonce

proto/proto_test.go:82–113  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

80}
81
82func TestFromAccountAndNonce(t *testing.T) {
83 target := []struct {
84 account string
85 nonce uint32
86 result string
87 }{
88 {
89 "aecd0b238518f023a81db3bdce5b2f1211b4e383dac96efc5d7205c761e15519",
90 1,
91 "a2710c0f9550c2713e9ff25543d9b5ef96bdc4927ea8d56262bb938718b8b717",
92 },
93 {
94 "8374e39c82c847681341245d9964f31a15cf2844994ec64a9b99c38dd3b7f54b",
95 2,
96 "da05187b8da4ec8dc3320c7d103590573d4f40beed414ad2afed7c3bdbaca628",
97 },
98 {
99 "72cb315f225c8ce03cd4b8d8ef802e871f9aa0924ddd9a358b647f4187730b12",
100 0,
101 "293e94eecddd941eab73d47e0cb967102b271bd4fc3a1398c1c1496c3dd06f0f",
102 },
103 }
104 Convey("Generate DatabaseID", t, func() {
105 for i := range target {
106 h, err := hash.NewHashFromStr(target[i].account)
107 So(err, ShouldBeNil)
108 a := AccountAddress(*h)
109 dbID := FromAccountAndNonce(a, target[i].nonce)
110 So(string(dbID), ShouldResemble, target[i].result)
111 }
112 })
113}

Callers

nothing calls this directly

Calls 3

NewHashFromStrFunction · 0.92
FromAccountAndNonceFunction · 0.85
AccountAddressTypeAlias · 0.70

Tested by

no test coverage detected