8784: Fix test for latest firefox.
[arvados.git] / sdk / go / stats / duration_test.go
1 package stats
2
3 import (
4         "testing"
5         "time"
6 )
7
8 func TestString(t *testing.T) {
9         d := Duration(123123123123 * time.Nanosecond)
10         if s, expect := d.String(), "123.123123"; s != expect {
11                 t.Errorf("got %s, expect %s", s, expect)
12         }
13 }
14
15 func TestSet(t *testing.T) {
16         var d Duration
17         if err := d.Set("123.456"); err != nil {
18                 t.Fatal(err)
19         }
20         if got, expect := time.Duration(d).Nanoseconds(), int64(123456000000); got != expect {
21                 t.Errorf("got %d, expect %d", got, expect)
22         }
23 }