Skip to content

Commit

Permalink
Add unicode categories
Browse files Browse the repository at this point in the history
  • Loading branch information
David Moles committed Feb 26, 2019
1 parent bd77bf7 commit b91356d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type SuiteFlags struct {
CountMax uint64

Unicode bool
UnicodeCategories bool
UnicodeScripts bool
UnicodeProperties bool
UnicodeEmoji bool
Expand Down Expand Up @@ -51,14 +52,15 @@ const (
Unicode key support tests are further divided into:
- Unicode category support (--unicode-categories)
- Unicode script support (--unicode-scripts)
- Unicode properties support (--unicode-properties)
- Unicode emoji support (--unicode-emoji)
If --unicode is specified, all of these are run.
Note that there is considerable overlap between the characters in the
script support and properties support tests.
category support, script support, and properties support tests.
`
)

Expand All @@ -83,6 +85,7 @@ func init() {
cmdFlags.Uint64Var(&f.CountMax, "count-max", CountMaxDefault, "max number of files to create, or -1 for no limit")

cmdFlags.BoolVarP(&f.Unicode, "unicode", "u", false, "test Unicode keys")
cmdFlags.BoolVar(&f.UnicodeCategories, "unicode-categories", false, "test Unicode categories")
cmdFlags.BoolVar(&f.UnicodeScripts, "unicode-scripts", false, "test Unicode scripts")
cmdFlags.BoolVar(&f.UnicodeProperties, "unicode-properties", false, "test Unicode properties")
cmdFlags.BoolVar(&f.UnicodeEmoji, "unicode-emoji", false, "test Unicode emoji")
Expand Down
5 changes: 5 additions & 0 deletions internal/suite/unicode.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ const (

func AllUnicodeCases() []Case {
var cases []Case
cases = append(cases, UnicodeCategoriesCases()...)
cases = append(cases, UnicodePropertiesCases()...)
cases = append(cases, UnicodeScriptsCases()...)
cases = append(cases, UnicodeEmojiCases()...)
return cases
}

func UnicodeCategoriesCases() []Case {
return rangeTablesToCases("Unicode categories: ", unicode.Categories)
}

func UnicodePropertiesCases() []Case {
return rangeTablesToCases("Unicode properties: ", unicode.Properties)
}
Expand Down

0 comments on commit b91356d

Please sign in to comment.