Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ikawaha committed Mar 17, 2016
1 parent 9091096 commit fed9387
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tokenizer/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestTokenClassString(t *testing.T) {
}
}

func TestFeatures01(t *testing.T) {
func TestFeaturesAndPos01(t *testing.T) {
tok := Token{
ID: 0,
Class: TokenClass(lattice.KNOWN),
Expand All @@ -56,9 +56,12 @@ func TestFeatures01(t *testing.T) {
if !reflect.DeepEqual(f, expected) {
t.Errorf("got %v, expected %v", f, expected)
}
if p := tok.Pos(); p != f[0] {
t.Errorf("got %v, expected %v", p, f[0])
}
}

func TestFeatures02(t *testing.T) {
func TestFeaturesAndPos02(t *testing.T) {
tok := Token{
ID: 0,
Class: TokenClass(lattice.UNKNOWN),
Expand All @@ -73,9 +76,12 @@ func TestFeatures02(t *testing.T) {
if !reflect.DeepEqual(f, expected) {
t.Errorf("got %v, expected %v", f, expected)
}
if p := tok.Pos(); p != f[0] {
t.Errorf("got %v, expected %v", p, f[0])
}
}

func TestFeatures03(t *testing.T) {
func TestFeaturesAndPos03(t *testing.T) {
tok := Token{
ID: 0,
Class: TokenClass(lattice.USER),
Expand All @@ -95,9 +101,12 @@ func TestFeatures03(t *testing.T) {
if !reflect.DeepEqual(f, expected) {
t.Errorf("got %v, expected %v", f, expected)
}
if p := tok.Pos(); p != f[0] {
t.Errorf("got %v, expected %v", p, f[0])
}
}

func TestFeatures04(t *testing.T) {
func TestFeaturesAndPos04(t *testing.T) {
tok := Token{
ID: 0,
Class: DUMMY,
Expand All @@ -116,6 +125,9 @@ func TestFeatures04(t *testing.T) {
if len(f) != 0 {
t.Errorf("got %v, expected empty", f)
}
if p := tok.Pos(); p != "" {
t.Errorf("got %v, expected empty", p)
}
}

func TestTokenString01(t *testing.T) {
Expand Down

0 comments on commit fed9387

Please sign in to comment.