Skip to content

Commit

Permalink
Fix options (closes #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
vodkabears committed Jun 17, 2017
1 parent 14ea9c0 commit fcbe15a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
8 changes: 4 additions & 4 deletions config/bitmask.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ const (
// NoSuggest disables suggestions for incorrect words
NoSuggest = 2 << 4
// FlagLatin marks latin words as incorrect
FlagLatin = 2 << 5
FlagLatin = 2 << 6
// ByWords ignores dictionary context
ByWords = 2 << 6
ByWords = 2 << 7
// IgnoreCapitalization ignores the incorrect use of UPPERCASE/lowercase letters
IgnoreCapitalization = 2 << 7
IgnoreCapitalization = 2 << 8
// IgnoreRomanNumerals ignores roman numerals
IgnoreRomanNumerals = 2 << 8
IgnoreRomanNumerals = 2 << 10
)

var masks = map[string]Bitmask{
Expand Down
19 changes: 19 additions & 0 deletions config/bitmask_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"github.com/vodkabears/yaspell/config"
)

const totalBitmaskSum = 3007

func TestBitmaskSet(t *testing.T) {
var b config.Bitmask

Expand All @@ -20,6 +22,23 @@ func TestBitmaskSet(t *testing.T) {
}
}

func TestBitmaskTotalSum(t *testing.T) {
b := config.Bitmask(config.IgnoreUppercase |
config.IgnoreDigits |
config.IgnoreUrls |
config.FindRepeatWords |
config.IgnoreLatin |
config.NoSuggest |
config.FlagLatin |
config.ByWords |
config.IgnoreCapitalization |
config.IgnoreRomanNumerals)

if b != totalBitmaskSum {
t.Errorf("Expected to be equal %d", totalBitmaskSum)
}
}

func TestBitmaskString(t *testing.T) {
sum := config.IgnoreUppercase | config.IgnoreDigits
b := config.Bitmask(sum)
Expand Down

0 comments on commit fcbe15a

Please sign in to comment.