summaryrefslogtreecommitdiff
path: root/data/bookkeeping/msgp_gen_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'data/bookkeeping/msgp_gen_test.go')
-rw-r--r--data/bookkeeping/msgp_gen_test.go60
1 files changed, 60 insertions, 0 deletions
diff --git a/data/bookkeeping/msgp_gen_test.go b/data/bookkeeping/msgp_gen_test.go
index 44ff62e2d..8bad96593 100644
--- a/data/bookkeeping/msgp_gen_test.go
+++ b/data/bookkeeping/msgp_gen_test.go
@@ -312,6 +312,66 @@ func BenchmarkUnmarshalGenesisAllocation(b *testing.B) {
}
}
+func TestMarshalUnmarshalParticipationUpdates(t *testing.T) {
+ partitiontest.PartitionTest(t)
+ v := ParticipationUpdates{}
+ 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 TestRandomizedEncodingParticipationUpdates(t *testing.T) {
+ protocol.RunEncodingTest(t, &ParticipationUpdates{})
+}
+
+func BenchmarkMarshalMsgParticipationUpdates(b *testing.B) {
+ v := ParticipationUpdates{}
+ b.ReportAllocs()
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ v.MarshalMsg(nil)
+ }
+}
+
+func BenchmarkAppendMsgParticipationUpdates(b *testing.B) {
+ v := ParticipationUpdates{}
+ 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 BenchmarkUnmarshalParticipationUpdates(b *testing.B) {
+ v := ParticipationUpdates{}
+ 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)
+ }
+ }
+}
+
func TestMarshalUnmarshalRewardsState(t *testing.T) {
partitiontest.PartitionTest(t)
v := RewardsState{}