Skip to content

Commit

Permalink
go module support and tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali OYGUR committed Jan 8, 2021
1 parent 204f487 commit 8305d85
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 79 deletions.
12 changes: 5 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ install:
- go get github.com/alioygur/is

go:
- 1.1
- 1.2
- 1.3
- 1.4
- 1.5
- 1.6
- 1.7
- 1.7.x
- 1.12.x
- 1.13.x
- 1.14.x
- 1.15.x
- tip
144 changes: 72 additions & 72 deletions benchmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,95 +18,95 @@ type benchmarkCase struct {
var (
benchmarkFuncs = []benchmarkCase{
// Alpha
benchmarkCase{Alpha, "Empty", ""},
benchmarkCase{Alpha, "Space", " "},
benchmarkCase{Alpha, "False", "abc!!!"},
benchmarkCase{Alpha, "True", "abc"},
{Alpha, "Empty", ""},
{Alpha, "Space", " "},
{Alpha, "False", "abc!!!"},
{Alpha, "True", "abc"},
//UTFLetter
benchmarkCase{UTFLetter, "Empty", ""},
benchmarkCase{UTFLetter, "Space", " "},
benchmarkCase{UTFLetter, "False", "\u0026"}, //UTF-8(ASCII): &
benchmarkCase{UTFLetter, "True", "abc"},
{UTFLetter, "Empty", ""},
{UTFLetter, "Space", " "},
{UTFLetter, "False", "\u0026"}, //UTF-8(ASCII): &
{UTFLetter, "True", "abc"},
// Alphanumeric
benchmarkCase{Alphanumeric, "Empty", ""},
benchmarkCase{Alphanumeric, "Space", " "},
benchmarkCase{Alphanumeric, "False", "\u0026"}, //UTF-8(ASCII): &
benchmarkCase{Alphanumeric, "True", "abc123"},
{Alphanumeric, "Empty", ""},
{Alphanumeric, "Space", " "},
{Alphanumeric, "False", "\u0026"}, //UTF-8(ASCII): &
{Alphanumeric, "True", "abc123"},
// UTFLetterNumeric
benchmarkCase{UTFLetterNumeric, "Empty", ""},
benchmarkCase{UTFLetterNumeric, "Space", " "},
benchmarkCase{UTFLetterNumeric, "False", "abc!!!"},
benchmarkCase{UTFLetterNumeric, "True", "abc1"},
{UTFLetterNumeric, "Empty", ""},
{UTFLetterNumeric, "Space", " "},
{UTFLetterNumeric, "False", "abc!!!"},
{UTFLetterNumeric, "True", "abc1"},
// Numeric
benchmarkCase{Numeric, "Empty", ""},
benchmarkCase{Numeric, "Space", " "},
benchmarkCase{Numeric, "False", "abc!!!"},
benchmarkCase{Numeric, "True", "0123"},
{Numeric, "Empty", ""},
{Numeric, "Space", " "},
{Numeric, "False", "abc!!!"},
{Numeric, "True", "0123"},
// UTFNumeric
benchmarkCase{UTFNumeric, "Empty", ""},
benchmarkCase{UTFNumeric, "Space", " "},
benchmarkCase{UTFNumeric, "False", "abc!!!"},
benchmarkCase{UTFNumeric, "True", "\u0030"}, //UTF-8(ASCII): 0
{UTFNumeric, "Empty", ""},
{UTFNumeric, "Space", " "},
{UTFNumeric, "False", "abc!!!"},
{UTFNumeric, "True", "\u0030"}, //UTF-8(ASCII): 0
// UTFDigit
benchmarkCase{UTFDigit, "Empty", ""},
benchmarkCase{UTFDigit, "Space", " "},
benchmarkCase{UTFDigit, "False", "abc!!!"},
benchmarkCase{UTFDigit, "True", "\u0030"}, //UTF-8(ASCII): 0
{UTFDigit, "Empty", ""},
{UTFDigit, "Space", " "},
{UTFDigit, "False", "abc!!!"},
{UTFDigit, "True", "\u0030"}, //UTF-8(ASCII): 0
// LowerCase
benchmarkCase{LowerCase, "Empty", ""},
benchmarkCase{LowerCase, "Space", " "},
benchmarkCase{LowerCase, "False", "ABC"},
benchmarkCase{LowerCase, "True", "abc"},
{LowerCase, "Empty", ""},
{LowerCase, "Space", " "},
{LowerCase, "False", "ABC"},
{LowerCase, "True", "abc"},
// UpperCase
benchmarkCase{UpperCase, "Empty", ""},
benchmarkCase{UpperCase, "Space", " "},
benchmarkCase{UpperCase, "False", "abc"},
benchmarkCase{UpperCase, "True", "ABC"},
{UpperCase, "Empty", ""},
{UpperCase, "Space", " "},
{UpperCase, "False", "abc"},
{UpperCase, "True", "ABC"},
// Int
benchmarkCase{Int, "Empty", ""},
benchmarkCase{Int, "Space", " "},
benchmarkCase{Int, "False", "abc"},
benchmarkCase{Int, "True", "000"},
{Int, "Empty", ""},
{Int, "Space", " "},
{Int, "False", "abc"},
{Int, "True", "000"},
// Email
benchmarkCase{Email, "Empty", ""},
benchmarkCase{Email, "Space", " "},
benchmarkCase{Email, "False", "@invalid.com"},
benchmarkCase{Email, "True", "[email protected]"},
{Email, "Empty", ""},
{Email, "Space", " "},
{Email, "False", "@invalid.com"},
{Email, "True", "[email protected]"},
// URL
benchmarkCase{URL, "Empty", ""},
benchmarkCase{URL, "Space", " "},
benchmarkCase{URL, "False", "./rel/test/dir"},
benchmarkCase{URL, "True", "http://foobar.org/"},
{URL, "Empty", ""},
{URL, "Space", " "},
{URL, "False", "./rel/test/dir"},
{URL, "True", "http://foobar.org/"},
// RequestURL
benchmarkCase{RequestURL, "Empty", ""},
benchmarkCase{RequestURL, "Space", " "},
benchmarkCase{RequestURL, "False", "invalid."},
benchmarkCase{RequestURL, "True", "http://foobar.org/"},
{RequestURL, "Empty", ""},
{RequestURL, "Space", " "},
{RequestURL, "False", "invalid."},
{RequestURL, "True", "http://foobar.org/"},
// RequestURI
benchmarkCase{RequestURI, "Empty", ""},
benchmarkCase{RequestURI, "Space", " "},
benchmarkCase{RequestURI, "False", "invalid."},
benchmarkCase{RequestURI, "True", "http://foobar.org/"},
{RequestURI, "Empty", ""},
{RequestURI, "Space", " "},
{RequestURI, "False", "invalid."},
{RequestURI, "True", "http://foobar.org/"},
// Float
benchmarkCase{Float, "Empty", ""},
benchmarkCase{Float, "Space", " "},
benchmarkCase{Float, "False", "+1f"},
benchmarkCase{Float, "True", "123.123"},
{Float, "Empty", ""},
{Float, "Space", " "},
{Float, "False", "+1f"},
{Float, "True", "123.123"},
// Hexadecimal
benchmarkCase{Hexadecimal, "Empty", ""},
benchmarkCase{Hexadecimal, "Space", " "},
benchmarkCase{Hexadecimal, "False", ".."},
benchmarkCase{Hexadecimal, "True", "deadBEEF"},
{Hexadecimal, "Empty", ""},
{Hexadecimal, "Space", " "},
{Hexadecimal, "False", ".."},
{Hexadecimal, "True", "deadBEEF"},
// Hexcolor
benchmarkCase{Hexcolor, "Empty", ""},
benchmarkCase{Hexcolor, "Space", " "},
benchmarkCase{Hexcolor, "False", "#ff12FG"},
benchmarkCase{Hexcolor, "True", "#f00"},
{Hexcolor, "Empty", ""},
{Hexcolor, "Space", " "},
{Hexcolor, "False", "#ff12FG"},
{Hexcolor, "True", "#f00"},
// RGBcolor
benchmarkCase{RGBcolor, "Empty", ""},
benchmarkCase{RGBcolor, "Space", " "},
benchmarkCase{RGBcolor, "False", "rgba(0,31,255)"},
benchmarkCase{RGBcolor, "True", "rgb(0,31,255)"},
{RGBcolor, "Empty", ""},
{RGBcolor, "Space", " "},
{RGBcolor, "False", "rgba(0,31,255)"},
{RGBcolor, "True", "rgb(0,31,255)"},
}
)

Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/alioygur/is

go 1.15

0 comments on commit 8305d85

Please sign in to comment.