File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -29,3 +29,23 @@ func TestMetricItemFromFatStringIllegal(t *testing.T) {
2929 _ , err = MetricItemFromFatString (line2 )
3030 assert .Error (t , err , "Error should occur when parsing malformed line" )
3131}
32+
33+ func TestMetricItemToFatString (t * testing.T ) {
34+ line1 := "1564382218000|2019-07-29 14:36:58|/foo/*|4|9|3|0|25|0|2|1"
35+ item1 , err := MetricItemFromFatString (line1 )
36+ assert .NoError (t , err )
37+ line2 , err := item1 .ToFatString ()
38+
39+ assert .Equal (t , line1 , line2 )
40+ }
41+
42+ func BenchmarkMetricItem_ToFatString (b * testing.B ) {
43+ line := "1564382218000|2019-07-29 14:36:58|/foo/*|4|9|3|0|25|0|2|1"
44+ item , err := MetricItemFromFatString (line )
45+ assert .NoError (b , err )
46+
47+ b .ReportAllocs ()
48+ for i := 0 ; i < b .N ; i ++ {
49+ item .ToFatString ()
50+ }
51+ }
You can’t perform that action at this time.
0 commit comments