diff options
Diffstat (limited to 'data/account/msgp_gen_test.go')
-rw-r--r-- | data/account/msgp_gen_test.go | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/data/account/msgp_gen_test.go b/data/account/msgp_gen_test.go new file mode 100644 index 000000000..a8927e790 --- /dev/null +++ b/data/account/msgp_gen_test.go @@ -0,0 +1,73 @@ +// +build !skip_msgp_testing + +package account + +// Code generated by github.com/algorand/msgp DO NOT EDIT. + +import ( + "testing" + + "github.com/algorand/go-algorand/protocol" + "github.com/algorand/go-algorand/test/partitiontest" + "github.com/algorand/msgp/msgp" +) + +func TestMarshalUnmarshalParticipationKeyIdentity(t *testing.T) { + partitiontest.PartitionTest(t) + v := ParticipationKeyIdentity{} + bts := v.MarshalMsg(nil) + left, err := v.UnmarshalMsg(bts) + if err != nil { + t.Fatal(err) + } + if len(left) > 0 { + t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) + } + + left, err = msgp.Skip(bts) + if err != nil { + t.Fatal(err) + } + if len(left) > 0 { + t.Errorf("%d bytes left over after Skip(): %q", len(left), left) + } +} + +func TestRandomizedEncodingParticipationKeyIdentity(t *testing.T) { + protocol.RunEncodingTest(t, &ParticipationKeyIdentity{}) +} + +func BenchmarkMarshalMsgParticipationKeyIdentity(b *testing.B) { + v := ParticipationKeyIdentity{} + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + v.MarshalMsg(nil) + } +} + +func BenchmarkAppendMsgParticipationKeyIdentity(b *testing.B) { + v := ParticipationKeyIdentity{} + bts := make([]byte, 0, v.Msgsize()) + bts = v.MarshalMsg(bts[0:0]) + b.SetBytes(int64(len(bts))) + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + bts = v.MarshalMsg(bts[0:0]) + } +} + +func BenchmarkUnmarshalParticipationKeyIdentity(b *testing.B) { + v := ParticipationKeyIdentity{} + bts := v.MarshalMsg(nil) + b.ReportAllocs() + b.SetBytes(int64(len(bts))) + b.ResetTimer() + for i := 0; i < b.N; i++ { + _, err := v.UnmarshalMsg(bts) + if err != nil { + b.Fatal(err) + } + } +} |