.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.1.0 / cmd / stringer / testdata / num.go
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 // Signed integers spanning zero.
6
7 package main
8
9 import "fmt"
10
11 type Num int
12
13 const (
14         m_2 Num = -2 + iota
15         m_1
16         m0
17         m1
18         m2
19 )
20
21 func main() {
22         ck(-3, "Num(-3)")
23         ck(m_2, "m_2")
24         ck(m_1, "m_1")
25         ck(m0, "m0")
26         ck(m1, "m1")
27         ck(m2, "m2")
28         ck(3, "Num(3)")
29 }
30
31 func ck(num Num, str string) {
32         if fmt.Sprint(num) != str {
33                 panic("num.go: " + str)
34         }
35 }