/usr/share/gocode/src/github.com/GeertJohan/go.incremental/uint32_test.go is in golang-github-geertjohan-go.incremental-dev 0.0~git20161212.0.1172aab-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | package incremental
import (
"testing"
)
type someUint32Struct struct {
i Uint32
}
func TestUint32Ptr(t *testing.T) {
i := &Uint32{}
num := i.Next()
if num != 1 {
t.Fatal("expected 1, got %d", num)
}
num = i.Next()
if num != 2 {
t.Fatal("expected 2, got %d", num)
}
num = i.Last()
if num != 2 {
t.Fatal("expected last to be 2, got %d", num)
}
i.Set(42)
num = i.Last()
if num != 42 {
t.Fatal("expected last to be 42, got %d", num)
}
num = i.Next()
if num != 43 {
t.Fatal("expected 43, got %d", num)
}
}
func TestUint32AsField(t *testing.T) {
s := someUint32Struct{}
num := s.i.Next()
if num != 1 {
t.Fatal("expected 1, got %d", num)
}
num = s.i.Next()
if num != 2 {
t.Fatal("expected 2, got %d", num)
}
num = s.i.Last()
if num != 2 {
t.Fatal("expected last to be 2, got %d", num)
}
useSomeUint32Struct(&s, t)
num = s.i.Last()
if num != 3 {
t.Fatal("expected last to be 3, got %d", num)
}
s.i.Set(42)
num = s.i.Last()
if num != 42 {
t.Fatal("expected last to be 42, got %d", num)
}
num = s.i.Next()
if num != 43 {
t.Fatal("expected 43, got %d", num)
}
}
func useSomeUint32Struct(s *someUint32Struct, t *testing.T) {
num := s.i.Next()
if num != 3 {
t.Fatal("expected 3, got %d", num)
}
}
|