github.com/hanwen/go-fuse@v1.0.0/benchmark/latencymap_test.go (about) 1 // Copyright 2016 the Go-FUSE Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package benchmark 6 7 import ( 8 "testing" 9 "time" 10 ) 11 12 func TestLatencyMap(t *testing.T) { 13 m := NewLatencyMap() 14 m.Add("foo", 100*time.Millisecond) 15 m.Add("foo", 200*time.Millisecond) 16 c, d := m.Get("foo") 17 if c != 2 || d != 300*time.Millisecond { 18 t.Errorf("got %v, %d, want 2, 150ms", c, d) 19 } 20 }