Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
brianasapp committed Jun 24, 2017
1 parent ee456a4 commit daa706e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 0 additions & 2 deletions sputter.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ func charClass(r *syntax.Regexp) string {
default:
// randomly select from available ranges
i := random(0, len(r.Rune)/2) * 2

// add one to n2 because random will not select max value
n1, n2 := int(r.Rune[i]), int(r.Rune[i+1])
if n2-n1 == 0 {
return string(r.Rune[i : i+1])
Expand Down
10 changes: 6 additions & 4 deletions sputter_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package sputter

import (
"fmt"
"regexp"
"testing"
)
Expand All @@ -14,14 +13,17 @@ func TestCharClassSingle(t *testing.T) {
testSputHundredEmoji(t, "[A]")
}

func TestCharClassRange(t *testing.T) {
testSputHundredEmoji(t, "[A0-9]")
func TestCharClassSingleRange(t *testing.T) {
testSputHundredEmoji(t, "[0-9]")
}

func TestCharClassMultipleRange(t *testing.T) {
testSputHundredEmoji(t, "[A-Z0-9]")
}

func testSputHundredEmoji(t *testing.T, exp string) {
for i := 0; i < 100; i++ {
s, err := Gen(exp)
fmt.Println(s)
if err != nil {
t.Error("error from Gen:", err)
}
Expand Down

0 comments on commit daa706e

Please sign in to comment.