github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/cmd/metrics-v2_gen_test.go (about) 1 package cmd 2 3 // Code generated by github.com/tinylib/msgp DO NOT EDIT. 4 5 import ( 6 "testing" 7 8 "github.com/tinylib/msgp/msgp" 9 ) 10 11 func TestMarshalUnmarshalMetricDescription(t *testing.T) { 12 v := MetricDescription{} 13 bts, err := v.MarshalMsg(nil) 14 if err != nil { 15 t.Fatal(err) 16 } 17 left, err := v.UnmarshalMsg(bts) 18 if err != nil { 19 t.Fatal(err) 20 } 21 if len(left) > 0 { 22 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 23 } 24 25 left, err = msgp.Skip(bts) 26 if err != nil { 27 t.Fatal(err) 28 } 29 if len(left) > 0 { 30 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 31 } 32 } 33 34 func BenchmarkMarshalMsgMetricDescription(b *testing.B) { 35 v := MetricDescription{} 36 b.ReportAllocs() 37 b.ResetTimer() 38 for i := 0; i < b.N; i++ { 39 v.MarshalMsg(nil) 40 } 41 } 42 43 func BenchmarkAppendMsgMetricDescription(b *testing.B) { 44 v := MetricDescription{} 45 bts := make([]byte, 0, v.Msgsize()) 46 bts, _ = v.MarshalMsg(bts[0:0]) 47 b.SetBytes(int64(len(bts))) 48 b.ReportAllocs() 49 b.ResetTimer() 50 for i := 0; i < b.N; i++ { 51 bts, _ = v.MarshalMsg(bts[0:0]) 52 } 53 } 54 55 func BenchmarkUnmarshalMetricDescription(b *testing.B) { 56 v := MetricDescription{} 57 bts, _ := v.MarshalMsg(nil) 58 b.ReportAllocs() 59 b.SetBytes(int64(len(bts))) 60 b.ResetTimer() 61 for i := 0; i < b.N; i++ { 62 _, err := v.UnmarshalMsg(bts) 63 if err != nil { 64 b.Fatal(err) 65 } 66 } 67 } 68 69 func TestMarshalUnmarshalMetricV2(t *testing.T) { 70 v := MetricV2{} 71 bts, err := v.MarshalMsg(nil) 72 if err != nil { 73 t.Fatal(err) 74 } 75 left, err := v.UnmarshalMsg(bts) 76 if err != nil { 77 t.Fatal(err) 78 } 79 if len(left) > 0 { 80 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 81 } 82 83 left, err = msgp.Skip(bts) 84 if err != nil { 85 t.Fatal(err) 86 } 87 if len(left) > 0 { 88 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 89 } 90 } 91 92 func BenchmarkMarshalMsgMetricV2(b *testing.B) { 93 v := MetricV2{} 94 b.ReportAllocs() 95 b.ResetTimer() 96 for i := 0; i < b.N; i++ { 97 v.MarshalMsg(nil) 98 } 99 } 100 101 func BenchmarkAppendMsgMetricV2(b *testing.B) { 102 v := MetricV2{} 103 bts := make([]byte, 0, v.Msgsize()) 104 bts, _ = v.MarshalMsg(bts[0:0]) 105 b.SetBytes(int64(len(bts))) 106 b.ReportAllocs() 107 b.ResetTimer() 108 for i := 0; i < b.N; i++ { 109 bts, _ = v.MarshalMsg(bts[0:0]) 110 } 111 } 112 113 func BenchmarkUnmarshalMetricV2(b *testing.B) { 114 v := MetricV2{} 115 bts, _ := v.MarshalMsg(nil) 116 b.ReportAllocs() 117 b.SetBytes(int64(len(bts))) 118 b.ResetTimer() 119 for i := 0; i < b.N; i++ { 120 _, err := v.UnmarshalMsg(bts) 121 if err != nil { 122 b.Fatal(err) 123 } 124 } 125 } 126 127 func TestMarshalUnmarshalMetricsGroupOpts(t *testing.T) { 128 v := MetricsGroupOpts{} 129 bts, err := v.MarshalMsg(nil) 130 if err != nil { 131 t.Fatal(err) 132 } 133 left, err := v.UnmarshalMsg(bts) 134 if err != nil { 135 t.Fatal(err) 136 } 137 if len(left) > 0 { 138 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 139 } 140 141 left, err = msgp.Skip(bts) 142 if err != nil { 143 t.Fatal(err) 144 } 145 if len(left) > 0 { 146 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 147 } 148 } 149 150 func BenchmarkMarshalMsgMetricsGroupOpts(b *testing.B) { 151 v := MetricsGroupOpts{} 152 b.ReportAllocs() 153 b.ResetTimer() 154 for i := 0; i < b.N; i++ { 155 v.MarshalMsg(nil) 156 } 157 } 158 159 func BenchmarkAppendMsgMetricsGroupOpts(b *testing.B) { 160 v := MetricsGroupOpts{} 161 bts := make([]byte, 0, v.Msgsize()) 162 bts, _ = v.MarshalMsg(bts[0:0]) 163 b.SetBytes(int64(len(bts))) 164 b.ReportAllocs() 165 b.ResetTimer() 166 for i := 0; i < b.N; i++ { 167 bts, _ = v.MarshalMsg(bts[0:0]) 168 } 169 } 170 171 func BenchmarkUnmarshalMetricsGroupOpts(b *testing.B) { 172 v := MetricsGroupOpts{} 173 bts, _ := v.MarshalMsg(nil) 174 b.ReportAllocs() 175 b.SetBytes(int64(len(bts))) 176 b.ResetTimer() 177 for i := 0; i < b.N; i++ { 178 _, err := v.UnmarshalMsg(bts) 179 if err != nil { 180 b.Fatal(err) 181 } 182 } 183 } 184 185 func TestMarshalUnmarshalMetricsGroupV2(t *testing.T) { 186 v := MetricsGroupV2{} 187 bts, err := v.MarshalMsg(nil) 188 if err != nil { 189 t.Fatal(err) 190 } 191 left, err := v.UnmarshalMsg(bts) 192 if err != nil { 193 t.Fatal(err) 194 } 195 if len(left) > 0 { 196 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 197 } 198 199 left, err = msgp.Skip(bts) 200 if err != nil { 201 t.Fatal(err) 202 } 203 if len(left) > 0 { 204 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 205 } 206 } 207 208 func BenchmarkMarshalMsgMetricsGroupV2(b *testing.B) { 209 v := MetricsGroupV2{} 210 b.ReportAllocs() 211 b.ResetTimer() 212 for i := 0; i < b.N; i++ { 213 v.MarshalMsg(nil) 214 } 215 } 216 217 func BenchmarkAppendMsgMetricsGroupV2(b *testing.B) { 218 v := MetricsGroupV2{} 219 bts := make([]byte, 0, v.Msgsize()) 220 bts, _ = v.MarshalMsg(bts[0:0]) 221 b.SetBytes(int64(len(bts))) 222 b.ReportAllocs() 223 b.ResetTimer() 224 for i := 0; i < b.N; i++ { 225 bts, _ = v.MarshalMsg(bts[0:0]) 226 } 227 } 228 229 func BenchmarkUnmarshalMetricsGroupV2(b *testing.B) { 230 v := MetricsGroupV2{} 231 bts, _ := v.MarshalMsg(nil) 232 b.ReportAllocs() 233 b.SetBytes(int64(len(bts))) 234 b.ResetTimer() 235 for i := 0; i < b.N; i++ { 236 _, err := v.UnmarshalMsg(bts) 237 if err != nil { 238 b.Fatal(err) 239 } 240 } 241 }