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

Function TestTypes

blockproducer/interfaces/transaction_test.go:25–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func TestTypes(t *testing.T) {
26 Convey("Transaction types should be consistent to convert to/from bytes", t, func() {
27 for tt := TransactionType(0); tt < TransactionTypeNumber; tt++ {
28 So(tt, ShouldEqual, FromBytes(tt.Bytes()))
29 }
30 })
31 Convey("Transaction types should be hash stable", t, func() {
32 var (
33 h1, h2 []byte
34 err error
35 )
36 for tt := TransactionType(0); tt < TransactionTypeNumber; tt++ {
37 h1, err = tt.MarshalHash()
38 So(err, ShouldBeNil)
39 h2, err = tt.MarshalHash()
40 So(err, ShouldBeNil)
41 So(h1, ShouldResemble, h2)
42 }
43 })
44 Convey("Nonce should be hash stable", t, func() {
45 var (
46 h1, h2 []byte
47 err error
48 )
49 for n := AccountNonce(0); n < AccountNonce(10); n++ {
50 h1, err = n.MarshalHash()
51 So(err, ShouldBeNil)
52 h2, err = n.MarshalHash()
53 So(err, ShouldBeNil)
54 So(h1, ShouldResemble, h2)
55 }
56 })
57 Convey("test string", t, func() {
58 for i := TransactionTypeTransfer; i != TransactionTypeNumber+1; i++ {
59 So(i.String(), ShouldNotBeEmpty)
60 }
61 })
62}

Callers

nothing calls this directly

Calls 6

TransactionTypeTypeAlias · 0.85
FromBytesFunction · 0.85
AccountNonceTypeAlias · 0.85
MarshalHashMethod · 0.65
BytesMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected