| 1 | // Copyright 2018 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 | // This file is the same as day.go except the constants have different values. |
| 6 | |
| 7 | package main |
| 8 | |
| 9 | import "fmt" |
| 10 | |
| 11 | type Day int |
| 12 | |
| 13 | const ( |
| 14 | Sunday Day = iota |
| 15 | Monday |
| 16 | Tuesday |
| 17 | Wednesday |
| 18 | Thursday |
| 19 | Friday |
| 20 | Saturday |
| 21 | ) |
| 22 | |
| 23 | func main() { |
| 24 | ck(Monday, "Monday") |
| 25 | ck(Tuesday, "Tuesday") |
| 26 | ck(Wednesday, "Wednesday") |
| 27 | ck(Thursday, "Thursday") |
| 28 | ck(Friday, "Friday") |
| 29 | ck(Saturday, "Saturday") |
| 30 | ck(Sunday, "Sunday") |
| 31 | ck(-127, "Day(-127)") |
| 32 | ck(127, "Day(127)") |
| 33 | } |
| 34 | |
| 35 | func ck(day Day, str string) { |
| 36 | if fmt.Sprint(day) != str { |
| 37 | panic("day.go: " + str) |
| 38 | } |
| 39 | } |
| 40 |
Members