mirror of https://github.com/minio/minio.git
1254 lines
26 KiB
Go
1254 lines
26 KiB
Go
|
package cmd
|
||
|
|
||
|
// Code generated by github.com/tinylib/msgp DO NOT EDIT.
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/tinylib/msgp/msgp"
|
||
|
)
|
||
|
|
||
|
func TestMarshalUnmarshalBatchJobReplicateCredentials(t *testing.T) {
|
||
|
v := BatchJobReplicateCredentials{}
|
||
|
bts, err := v.MarshalMsg(nil)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
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 BenchmarkMarshalMsgBatchJobReplicateCredentials(b *testing.B) {
|
||
|
v := BatchJobReplicateCredentials{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgBatchJobReplicateCredentials(b *testing.B) {
|
||
|
v := BatchJobReplicateCredentials{}
|
||
|
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 BenchmarkUnmarshalBatchJobReplicateCredentials(b *testing.B) {
|
||
|
v := BatchJobReplicateCredentials{}
|
||
|
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 TestEncodeDecodeBatchJobReplicateCredentials(t *testing.T) {
|
||
|
v := BatchJobReplicateCredentials{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecodeBatchJobReplicateCredentials Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := BatchJobReplicateCredentials{}
|
||
|
err := msgp.Decode(&buf, &vn)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
|
||
|
buf.Reset()
|
||
|
msgp.Encode(&buf, &v)
|
||
|
err = msgp.NewReader(&buf).Skip()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkEncodeBatchJobReplicateCredentials(b *testing.B) {
|
||
|
v := BatchJobReplicateCredentials{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
en := msgp.NewWriter(msgp.Nowhere)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.EncodeMsg(en)
|
||
|
}
|
||
|
en.Flush()
|
||
|
}
|
||
|
|
||
|
func BenchmarkDecodeBatchJobReplicateCredentials(b *testing.B) {
|
||
|
v := BatchJobReplicateCredentials{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
||
|
dc := msgp.NewReader(rd)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
err := v.DecodeMsg(dc)
|
||
|
if err != nil {
|
||
|
b.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestMarshalUnmarshalBatchJobReplicateFlags(t *testing.T) {
|
||
|
v := BatchJobReplicateFlags{}
|
||
|
bts, err := v.MarshalMsg(nil)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
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 BenchmarkMarshalMsgBatchJobReplicateFlags(b *testing.B) {
|
||
|
v := BatchJobReplicateFlags{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgBatchJobReplicateFlags(b *testing.B) {
|
||
|
v := BatchJobReplicateFlags{}
|
||
|
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 BenchmarkUnmarshalBatchJobReplicateFlags(b *testing.B) {
|
||
|
v := BatchJobReplicateFlags{}
|
||
|
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 TestEncodeDecodeBatchJobReplicateFlags(t *testing.T) {
|
||
|
v := BatchJobReplicateFlags{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecodeBatchJobReplicateFlags Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := BatchJobReplicateFlags{}
|
||
|
err := msgp.Decode(&buf, &vn)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
|
||
|
buf.Reset()
|
||
|
msgp.Encode(&buf, &v)
|
||
|
err = msgp.NewReader(&buf).Skip()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkEncodeBatchJobReplicateFlags(b *testing.B) {
|
||
|
v := BatchJobReplicateFlags{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
en := msgp.NewWriter(msgp.Nowhere)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.EncodeMsg(en)
|
||
|
}
|
||
|
en.Flush()
|
||
|
}
|
||
|
|
||
|
func BenchmarkDecodeBatchJobReplicateFlags(b *testing.B) {
|
||
|
v := BatchJobReplicateFlags{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
||
|
dc := msgp.NewReader(rd)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
err := v.DecodeMsg(dc)
|
||
|
if err != nil {
|
||
|
b.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestMarshalUnmarshalBatchJobReplicateKV(t *testing.T) {
|
||
|
v := BatchJobReplicateKV{}
|
||
|
bts, err := v.MarshalMsg(nil)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
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 BenchmarkMarshalMsgBatchJobReplicateKV(b *testing.B) {
|
||
|
v := BatchJobReplicateKV{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgBatchJobReplicateKV(b *testing.B) {
|
||
|
v := BatchJobReplicateKV{}
|
||
|
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 BenchmarkUnmarshalBatchJobReplicateKV(b *testing.B) {
|
||
|
v := BatchJobReplicateKV{}
|
||
|
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 TestEncodeDecodeBatchJobReplicateKV(t *testing.T) {
|
||
|
v := BatchJobReplicateKV{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecodeBatchJobReplicateKV Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := BatchJobReplicateKV{}
|
||
|
err := msgp.Decode(&buf, &vn)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
|
||
|
buf.Reset()
|
||
|
msgp.Encode(&buf, &v)
|
||
|
err = msgp.NewReader(&buf).Skip()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkEncodeBatchJobReplicateKV(b *testing.B) {
|
||
|
v := BatchJobReplicateKV{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
en := msgp.NewWriter(msgp.Nowhere)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.EncodeMsg(en)
|
||
|
}
|
||
|
en.Flush()
|
||
|
}
|
||
|
|
||
|
func BenchmarkDecodeBatchJobReplicateKV(b *testing.B) {
|
||
|
v := BatchJobReplicateKV{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
||
|
dc := msgp.NewReader(rd)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
err := v.DecodeMsg(dc)
|
||
|
if err != nil {
|
||
|
b.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestMarshalUnmarshalBatchJobReplicateSource(t *testing.T) {
|
||
|
v := BatchJobReplicateSource{}
|
||
|
bts, err := v.MarshalMsg(nil)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
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 BenchmarkMarshalMsgBatchJobReplicateSource(b *testing.B) {
|
||
|
v := BatchJobReplicateSource{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgBatchJobReplicateSource(b *testing.B) {
|
||
|
v := BatchJobReplicateSource{}
|
||
|
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 BenchmarkUnmarshalBatchJobReplicateSource(b *testing.B) {
|
||
|
v := BatchJobReplicateSource{}
|
||
|
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 TestEncodeDecodeBatchJobReplicateSource(t *testing.T) {
|
||
|
v := BatchJobReplicateSource{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecodeBatchJobReplicateSource Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := BatchJobReplicateSource{}
|
||
|
err := msgp.Decode(&buf, &vn)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
|
||
|
buf.Reset()
|
||
|
msgp.Encode(&buf, &v)
|
||
|
err = msgp.NewReader(&buf).Skip()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkEncodeBatchJobReplicateSource(b *testing.B) {
|
||
|
v := BatchJobReplicateSource{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
en := msgp.NewWriter(msgp.Nowhere)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.EncodeMsg(en)
|
||
|
}
|
||
|
en.Flush()
|
||
|
}
|
||
|
|
||
|
func BenchmarkDecodeBatchJobReplicateSource(b *testing.B) {
|
||
|
v := BatchJobReplicateSource{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
||
|
dc := msgp.NewReader(rd)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
err := v.DecodeMsg(dc)
|
||
|
if err != nil {
|
||
|
b.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestMarshalUnmarshalBatchJobReplicateTarget(t *testing.T) {
|
||
|
v := BatchJobReplicateTarget{}
|
||
|
bts, err := v.MarshalMsg(nil)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
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 BenchmarkMarshalMsgBatchJobReplicateTarget(b *testing.B) {
|
||
|
v := BatchJobReplicateTarget{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgBatchJobReplicateTarget(b *testing.B) {
|
||
|
v := BatchJobReplicateTarget{}
|
||
|
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 BenchmarkUnmarshalBatchJobReplicateTarget(b *testing.B) {
|
||
|
v := BatchJobReplicateTarget{}
|
||
|
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 TestEncodeDecodeBatchJobReplicateTarget(t *testing.T) {
|
||
|
v := BatchJobReplicateTarget{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecodeBatchJobReplicateTarget Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := BatchJobReplicateTarget{}
|
||
|
err := msgp.Decode(&buf, &vn)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
|
||
|
buf.Reset()
|
||
|
msgp.Encode(&buf, &v)
|
||
|
err = msgp.NewReader(&buf).Skip()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkEncodeBatchJobReplicateTarget(b *testing.B) {
|
||
|
v := BatchJobReplicateTarget{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
en := msgp.NewWriter(msgp.Nowhere)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.EncodeMsg(en)
|
||
|
}
|
||
|
en.Flush()
|
||
|
}
|
||
|
|
||
|
func BenchmarkDecodeBatchJobReplicateTarget(b *testing.B) {
|
||
|
v := BatchJobReplicateTarget{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
||
|
dc := msgp.NewReader(rd)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
err := v.DecodeMsg(dc)
|
||
|
if err != nil {
|
||
|
b.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestMarshalUnmarshalBatchJobReplicateV1(t *testing.T) {
|
||
|
v := BatchJobReplicateV1{}
|
||
|
bts, err := v.MarshalMsg(nil)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
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 BenchmarkMarshalMsgBatchJobReplicateV1(b *testing.B) {
|
||
|
v := BatchJobReplicateV1{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgBatchJobReplicateV1(b *testing.B) {
|
||
|
v := BatchJobReplicateV1{}
|
||
|
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 BenchmarkUnmarshalBatchJobReplicateV1(b *testing.B) {
|
||
|
v := BatchJobReplicateV1{}
|
||
|
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 TestEncodeDecodeBatchJobReplicateV1(t *testing.T) {
|
||
|
v := BatchJobReplicateV1{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecodeBatchJobReplicateV1 Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := BatchJobReplicateV1{}
|
||
|
err := msgp.Decode(&buf, &vn)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
|
||
|
buf.Reset()
|
||
|
msgp.Encode(&buf, &v)
|
||
|
err = msgp.NewReader(&buf).Skip()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkEncodeBatchJobReplicateV1(b *testing.B) {
|
||
|
v := BatchJobReplicateV1{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
en := msgp.NewWriter(msgp.Nowhere)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.EncodeMsg(en)
|
||
|
}
|
||
|
en.Flush()
|
||
|
}
|
||
|
|
||
|
func BenchmarkDecodeBatchJobReplicateV1(b *testing.B) {
|
||
|
v := BatchJobReplicateV1{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
||
|
dc := msgp.NewReader(rd)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
err := v.DecodeMsg(dc)
|
||
|
if err != nil {
|
||
|
b.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestMarshalUnmarshalBatchJobRequest(t *testing.T) {
|
||
|
v := BatchJobRequest{}
|
||
|
bts, err := v.MarshalMsg(nil)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
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 BenchmarkMarshalMsgBatchJobRequest(b *testing.B) {
|
||
|
v := BatchJobRequest{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgBatchJobRequest(b *testing.B) {
|
||
|
v := BatchJobRequest{}
|
||
|
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 BenchmarkUnmarshalBatchJobRequest(b *testing.B) {
|
||
|
v := BatchJobRequest{}
|
||
|
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 TestEncodeDecodeBatchJobRequest(t *testing.T) {
|
||
|
v := BatchJobRequest{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecodeBatchJobRequest Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := BatchJobRequest{}
|
||
|
err := msgp.Decode(&buf, &vn)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
|
||
|
buf.Reset()
|
||
|
msgp.Encode(&buf, &v)
|
||
|
err = msgp.NewReader(&buf).Skip()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkEncodeBatchJobRequest(b *testing.B) {
|
||
|
v := BatchJobRequest{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
en := msgp.NewWriter(msgp.Nowhere)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.EncodeMsg(en)
|
||
|
}
|
||
|
en.Flush()
|
||
|
}
|
||
|
|
||
|
func BenchmarkDecodeBatchJobRequest(b *testing.B) {
|
||
|
v := BatchJobRequest{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
||
|
dc := msgp.NewReader(rd)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
err := v.DecodeMsg(dc)
|
||
|
if err != nil {
|
||
|
b.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestMarshalUnmarshalBatchReplicateFilter(t *testing.T) {
|
||
|
v := BatchReplicateFilter{}
|
||
|
bts, err := v.MarshalMsg(nil)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
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 BenchmarkMarshalMsgBatchReplicateFilter(b *testing.B) {
|
||
|
v := BatchReplicateFilter{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgBatchReplicateFilter(b *testing.B) {
|
||
|
v := BatchReplicateFilter{}
|
||
|
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 BenchmarkUnmarshalBatchReplicateFilter(b *testing.B) {
|
||
|
v := BatchReplicateFilter{}
|
||
|
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 TestEncodeDecodeBatchReplicateFilter(t *testing.T) {
|
||
|
v := BatchReplicateFilter{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecodeBatchReplicateFilter Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := BatchReplicateFilter{}
|
||
|
err := msgp.Decode(&buf, &vn)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
|
||
|
buf.Reset()
|
||
|
msgp.Encode(&buf, &v)
|
||
|
err = msgp.NewReader(&buf).Skip()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkEncodeBatchReplicateFilter(b *testing.B) {
|
||
|
v := BatchReplicateFilter{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
en := msgp.NewWriter(msgp.Nowhere)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.EncodeMsg(en)
|
||
|
}
|
||
|
en.Flush()
|
||
|
}
|
||
|
|
||
|
func BenchmarkDecodeBatchReplicateFilter(b *testing.B) {
|
||
|
v := BatchReplicateFilter{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
||
|
dc := msgp.NewReader(rd)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
err := v.DecodeMsg(dc)
|
||
|
if err != nil {
|
||
|
b.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestMarshalUnmarshalBatchReplicateNotification(t *testing.T) {
|
||
|
v := BatchReplicateNotification{}
|
||
|
bts, err := v.MarshalMsg(nil)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
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 BenchmarkMarshalMsgBatchReplicateNotification(b *testing.B) {
|
||
|
v := BatchReplicateNotification{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgBatchReplicateNotification(b *testing.B) {
|
||
|
v := BatchReplicateNotification{}
|
||
|
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 BenchmarkUnmarshalBatchReplicateNotification(b *testing.B) {
|
||
|
v := BatchReplicateNotification{}
|
||
|
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 TestEncodeDecodeBatchReplicateNotification(t *testing.T) {
|
||
|
v := BatchReplicateNotification{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecodeBatchReplicateNotification Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := BatchReplicateNotification{}
|
||
|
err := msgp.Decode(&buf, &vn)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
|
||
|
buf.Reset()
|
||
|
msgp.Encode(&buf, &v)
|
||
|
err = msgp.NewReader(&buf).Skip()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkEncodeBatchReplicateNotification(b *testing.B) {
|
||
|
v := BatchReplicateNotification{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
en := msgp.NewWriter(msgp.Nowhere)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.EncodeMsg(en)
|
||
|
}
|
||
|
en.Flush()
|
||
|
}
|
||
|
|
||
|
func BenchmarkDecodeBatchReplicateNotification(b *testing.B) {
|
||
|
v := BatchReplicateNotification{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
||
|
dc := msgp.NewReader(rd)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
err := v.DecodeMsg(dc)
|
||
|
if err != nil {
|
||
|
b.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestMarshalUnmarshalBatchReplicateRetry(t *testing.T) {
|
||
|
v := BatchReplicateRetry{}
|
||
|
bts, err := v.MarshalMsg(nil)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
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 BenchmarkMarshalMsgBatchReplicateRetry(b *testing.B) {
|
||
|
v := BatchReplicateRetry{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgBatchReplicateRetry(b *testing.B) {
|
||
|
v := BatchReplicateRetry{}
|
||
|
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 BenchmarkUnmarshalBatchReplicateRetry(b *testing.B) {
|
||
|
v := BatchReplicateRetry{}
|
||
|
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 TestEncodeDecodeBatchReplicateRetry(t *testing.T) {
|
||
|
v := BatchReplicateRetry{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecodeBatchReplicateRetry Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := BatchReplicateRetry{}
|
||
|
err := msgp.Decode(&buf, &vn)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
|
||
|
buf.Reset()
|
||
|
msgp.Encode(&buf, &v)
|
||
|
err = msgp.NewReader(&buf).Skip()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkEncodeBatchReplicateRetry(b *testing.B) {
|
||
|
v := BatchReplicateRetry{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
en := msgp.NewWriter(msgp.Nowhere)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.EncodeMsg(en)
|
||
|
}
|
||
|
en.Flush()
|
||
|
}
|
||
|
|
||
|
func BenchmarkDecodeBatchReplicateRetry(b *testing.B) {
|
||
|
v := BatchReplicateRetry{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
||
|
dc := msgp.NewReader(rd)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
err := v.DecodeMsg(dc)
|
||
|
if err != nil {
|
||
|
b.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestMarshalUnmarshalbatchJobInfo(t *testing.T) {
|
||
|
v := batchJobInfo{}
|
||
|
bts, err := v.MarshalMsg(nil)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
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 BenchmarkMarshalMsgbatchJobInfo(b *testing.B) {
|
||
|
v := batchJobInfo{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgbatchJobInfo(b *testing.B) {
|
||
|
v := batchJobInfo{}
|
||
|
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 BenchmarkUnmarshalbatchJobInfo(b *testing.B) {
|
||
|
v := batchJobInfo{}
|
||
|
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 TestEncodeDecodebatchJobInfo(t *testing.T) {
|
||
|
v := batchJobInfo{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecodebatchJobInfo Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := batchJobInfo{}
|
||
|
err := msgp.Decode(&buf, &vn)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
|
||
|
buf.Reset()
|
||
|
msgp.Encode(&buf, &v)
|
||
|
err = msgp.NewReader(&buf).Skip()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkEncodebatchJobInfo(b *testing.B) {
|
||
|
v := batchJobInfo{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
en := msgp.NewWriter(msgp.Nowhere)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.EncodeMsg(en)
|
||
|
}
|
||
|
en.Flush()
|
||
|
}
|
||
|
|
||
|
func BenchmarkDecodebatchJobInfo(b *testing.B) {
|
||
|
v := batchJobInfo{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
b.SetBytes(int64(buf.Len()))
|
||
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
||
|
dc := msgp.NewReader(rd)
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
err := v.DecodeMsg(dc)
|
||
|
if err != nil {
|
||
|
b.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
}
|