Permalink
Please sign in to comment.
Showing
with
33 additions
and 5 deletions.
- +7 −5 metrics.go
- +26 −0 metrics_amd64_test.go
12
metrics.go
| @@ -0,0 +1,26 @@ | ||
| +package speed | ||
| + | ||
| +import ( | ||
| + "math" | ||
| + "testing" | ||
| +) | ||
| + | ||
| +func TestIsCompatible64(t *testing.T) { | ||
| + cases := []struct { | ||
| + t MetricType | ||
| + v interface{} | ||
| + result bool | ||
| + }{ | ||
| + {Int32Type, math.MinInt32 - 1, false}, | ||
| + {Int32Type, math.MinInt64, false}, | ||
| + {Uint32Type, math.MaxUint32 + 1, false}, | ||
| + {Uint32Type, math.MaxInt64, false}, | ||
| + } | ||
| + | ||
| + for _, c := range cases { | ||
| + r := c.t.IsCompatible(c.v) | ||
| + if r != c.result { | ||
| + t.Errorf("%v.IsCompatible(%v(%T)) should be %v, not %v", c.t, c.v, c.v, c.result, r) | ||
| + } | ||
| + } | ||
| +} |
0 comments on commit
56ec087