1 | // Copyright 2014 The Go 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 | // Gaps and an offset. |
6 | |
7 | package main |
8 | |
9 | import "fmt" |
10 | |
11 | type Gap int |
12 | |
13 | const ( |
14 | Two Gap = 2 |
15 | Three Gap = 3 |
16 | Five Gap = 5 |
17 | Six Gap = 6 |
18 | Seven Gap = 7 |
19 | Eight Gap = 8 |
20 | Nine Gap = 9 |
21 | Eleven Gap = 11 |
22 | ) |
23 | |
24 | func main() { |
25 | ck(0, "Gap(0)") |
26 | ck(1, "Gap(1)") |
27 | ck(Two, "Two") |
28 | ck(Three, "Three") |
29 | ck(4, "Gap(4)") |
30 | ck(Five, "Five") |
31 | ck(Six, "Six") |
32 | ck(Seven, "Seven") |
33 | ck(Eight, "Eight") |
34 | ck(Nine, "Nine") |
35 | ck(10, "Gap(10)") |
36 | ck(Eleven, "Eleven") |
37 | ck(12, "Gap(12)") |
38 | } |
39 | |
40 | func ck(gap Gap, str string) { |
41 | if fmt.Sprint(gap) != str { |
42 | panic("gap.go: " + str) |
43 | } |
44 | } |
45 |