blob: 8945f914d9447c640c40c911121eded8bb1b1b55 [file] [log] [blame]
Akron8ef408b2021-08-02 22:11:04 +02001package datokenizer
2
3import (
4 "strings"
5 "testing"
6
7 "github.com/stretchr/testify/assert"
8)
9
10func TestSimpleString(t *testing.T) {
11 assert := assert.New(t)
12
13 // bau | bauamt
14 r := strings.NewReader(`##foma-net 1.0##
15##props##
161 6 7 8 2 2 1 1 1 1 1 2 5B57D486
17##sigma##
180 @_EPSILON_SYMBOL_@
193 a
204 b
215 m
226 t
237 u
24##states##
250 4 1 0
261 3 2 0
272 7 3 0
283 3 4 1
294 5 5 0
305 6 6 0
316 -1 -1 1
32-1 -1 -1 -1 -1
33##end##`)
34
35 tok := parse(r) // ("tokenizer.fst")
36 tok.buildDA()
37 assert.True(tok.match("bau"))
38 assert.True(tok.match("bauamt"))
39 assert.False(tok.match("baum"))
40}