...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package utils
17
18 import (
19 "testing"
20
21 . "github.com/onsi/gomega"
22 )
23
24 func TestEncodeClkIds(t *testing.T) {
25 g := NewGomegaWithT(t)
26
27 mask, err := EncodeClkIds([]string{"CLOCK_REALTIME"})
28 g.Expect(err).ShouldNot(HaveOccurred(), "error: %+v", err)
29 g.Expect(mask).Should(Equal(uint64(1)))
30
31 mask, err = EncodeClkIds([]string{"CLOCK_REALTIME", "CLOCK_MONOTONIC"})
32 g.Expect(err).ShouldNot(HaveOccurred(), "error: %+v", err)
33 g.Expect(mask).Should(Equal(uint64(3)))
34
35 mask, err = EncodeClkIds([]string{"CLOCK_MONOTONIC"})
36 g.Expect(err).ShouldNot(HaveOccurred(), "error: %+v", err)
37 g.Expect(mask).Should(Equal(uint64(2)))
38 }
39