462 lines
9 KiB
Go
462 lines
9 KiB
Go
package legacy
|
|
|
|
// Code generated by github.com/tinylib/msgp DO NOT EDIT.
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/tinylib/msgp/msgp"
|
|
)
|
|
|
|
func TestMarshalUnmarshaldataUsageCache(t *testing.T) {
|
|
v := dataUsageCache{}
|
|
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 BenchmarkMarshalMsgdataUsageCache(b *testing.B) {
|
|
v := dataUsageCache{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgdataUsageCache(b *testing.B) {
|
|
v := dataUsageCache{}
|
|
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 BenchmarkUnmarshaldataUsageCache(b *testing.B) {
|
|
v := dataUsageCache{}
|
|
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 TestEncodeDecodedataUsageCache(t *testing.T) {
|
|
v := dataUsageCache{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodedataUsageCache Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := dataUsageCache{}
|
|
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 BenchmarkEncodedataUsageCache(b *testing.B) {
|
|
v := dataUsageCache{}
|
|
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 BenchmarkDecodedataUsageCache(b *testing.B) {
|
|
v := dataUsageCache{}
|
|
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 TestMarshalUnmarshaldataUsageCacheInfo(t *testing.T) {
|
|
v := dataUsageCacheInfo{}
|
|
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 BenchmarkMarshalMsgdataUsageCacheInfo(b *testing.B) {
|
|
v := dataUsageCacheInfo{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgdataUsageCacheInfo(b *testing.B) {
|
|
v := dataUsageCacheInfo{}
|
|
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 BenchmarkUnmarshaldataUsageCacheInfo(b *testing.B) {
|
|
v := dataUsageCacheInfo{}
|
|
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 TestEncodeDecodedataUsageCacheInfo(t *testing.T) {
|
|
v := dataUsageCacheInfo{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodedataUsageCacheInfo Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := dataUsageCacheInfo{}
|
|
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 BenchmarkEncodedataUsageCacheInfo(b *testing.B) {
|
|
v := dataUsageCacheInfo{}
|
|
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 BenchmarkDecodedataUsageCacheInfo(b *testing.B) {
|
|
v := dataUsageCacheInfo{}
|
|
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 TestMarshalUnmarshaldataUsageEntry(t *testing.T) {
|
|
v := dataUsageEntry{}
|
|
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 BenchmarkMarshalMsgdataUsageEntry(b *testing.B) {
|
|
v := dataUsageEntry{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgdataUsageEntry(b *testing.B) {
|
|
v := dataUsageEntry{}
|
|
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 BenchmarkUnmarshaldataUsageEntry(b *testing.B) {
|
|
v := dataUsageEntry{}
|
|
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 TestEncodeDecodedataUsageEntry(t *testing.T) {
|
|
v := dataUsageEntry{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodedataUsageEntry Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := dataUsageEntry{}
|
|
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 BenchmarkEncodedataUsageEntry(b *testing.B) {
|
|
v := dataUsageEntry{}
|
|
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 BenchmarkDecodedataUsageEntry(b *testing.B) {
|
|
v := dataUsageEntry{}
|
|
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 TestMarshalUnmarshalsizeHistogram(t *testing.T) {
|
|
v := sizeHistogram{}
|
|
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 BenchmarkMarshalMsgsizeHistogram(b *testing.B) {
|
|
v := sizeHistogram{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgsizeHistogram(b *testing.B) {
|
|
v := sizeHistogram{}
|
|
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 BenchmarkUnmarshalsizeHistogram(b *testing.B) {
|
|
v := sizeHistogram{}
|
|
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 TestEncodeDecodesizeHistogram(t *testing.T) {
|
|
v := sizeHistogram{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodesizeHistogram Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := sizeHistogram{}
|
|
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 BenchmarkEncodesizeHistogram(b *testing.B) {
|
|
v := sizeHistogram{}
|
|
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 BenchmarkDecodesizeHistogram(b *testing.B) {
|
|
v := sizeHistogram{}
|
|
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)
|
|
}
|
|
}
|
|
}
|