| 1 | // Copyright 2013 Google Inc. 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 | package getoptscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/ |
| 6 | |
| 7 | import ( |
| 8 | "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/" |
| 9 | "stringsscip-go gomod github.com/golang/go/src go1.13 strings/" |
| 10 | "testingscip-go gomod github.com/golang/go/src go1.13 testing/" |
| 11 | ) |
| 12 | |
| 13 | var unsignedTestsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests. = []struct { |
| 14 | wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:where. string |
| 15 | inscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:in. []string |
| 16 | lscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:l. UnsignedLimitscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit# |
| 17 | outscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:out. uint64 |
| 18 | errscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:err. string |
| 19 | }{ |
| 20 | { |
| 21 | wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:where.: locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(), |
| 22 | }, |
| 23 | { |
| 24 | locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(), |
| 25 | []string{"test", "-n", "1010"}, |
| 26 | UnsignedLimitscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#{Basescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Base.: 2, Bitsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Bits.: 5}, |
| 27 | 10, |
| 28 | "", |
| 29 | }, |
| 30 | { |
| 31 | locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(), |
| 32 | []string{"test", "-n", "1010"}, |
| 33 | UnsignedLimitscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#{Basescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Base.: 2, Bitsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Bits.: 4}, |
| 34 | 10, |
| 35 | "", |
| 36 | }, |
| 37 | { |
| 38 | locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(), |
| 39 | []string{"test", "-n", "1010"}, |
| 40 | UnsignedLimitscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#{Basescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Base.: 2, Bitsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Bits.: 3}, |
| 41 | 0, |
| 42 | "test: value out of range: 1010\n", |
| 43 | }, |
| 44 | { |
| 45 | locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(), |
| 46 | []string{"test", "-n", "3"}, |
| 47 | UnsignedLimitscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#{Minscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Min.: 4, Maxscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Max.: 6}, |
| 48 | 0, |
| 49 | "test: value out of range (<4): 3\n", |
| 50 | }, |
| 51 | { |
| 52 | locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(), |
| 53 | []string{"test", "-n", "4"}, |
| 54 | UnsignedLimitscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#{Minscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Min.: 4, Maxscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Max.: 6}, |
| 55 | 4, |
| 56 | "", |
| 57 | }, |
| 58 | { |
| 59 | locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(), |
| 60 | []string{"test", "-n", "5"}, |
| 61 | UnsignedLimitscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#{Minscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Min.: 4, Maxscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Max.: 6}, |
| 62 | 5, |
| 63 | "", |
| 64 | }, |
| 65 | { |
| 66 | locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(), |
| 67 | []string{"test", "-n", "6"}, |
| 68 | UnsignedLimitscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#{Minscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Min.: 4, Maxscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Max.: 6}, |
| 69 | 6, |
| 70 | "", |
| 71 | }, |
| 72 | { |
| 73 | locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(), |
| 74 | []string{"test", "-n", "7"}, |
| 75 | UnsignedLimitscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#{Minscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Min.: 4, Maxscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/UnsignedLimit#Max.: 6}, |
| 76 | 0, |
| 77 | "test: value out of range (>6): 7\n", |
| 78 | }, |
| 79 | } |
| 80 | |
| 81 | func TestUnsignedsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/TestUnsigneds().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 82 | for x, tt := range unsignedTestsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests. { |
| 83 | if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Indexscip-go gomod github.com/golang/go/src go1.13 strings/Index().(tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:where., ":-") > 0 { |
| 84 | tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:where. = fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("#%d", x) |
| 85 | } |
| 86 | |
| 87 | resetscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/reset().() |
| 88 | n := Unsignedscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Unsigned().('n', 0, &tt.lscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:l.) |
| 89 | parsescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/parse().(tt.inscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:in.) |
| 90 | if s := checkErrorscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/checkError().(tt.errscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:err.); s != "" { |
| 91 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: %s", tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:where., s) |
| 92 | } |
| 93 | if *n != tt.outscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:out. { |
| 94 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: got %v, want %v", tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:where., *n, tt.outscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/unsignedTests:out.) |
| 95 | } |
| 96 | } |
| 97 | } |