-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlexer_helper_test.go
62 lines (51 loc) · 1.17 KB
/
lexer_helper_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package streamingjsongo
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_matchStack0(t *testing.T) {
stack := []int{
TOKEN_LEFT_BRACE,
}
tokens := []int{
TOKEN_LEFT_BRACE,
}
matchResult := matchStack(stack, tokens)
assert.Equal(t, true, matchResult, "the tokens should be match")
}
func Test_matchStack1(t *testing.T) {
stack := []int{
TOKEN_RIGHT_BRACE,
TOKEN_ALPHABET_LOWERCASE_L,
TOKEN_ALPHABET_LOWERCASE_L,
TOKEN_ALPHABET_LOWERCASE_U,
TOKEN_ALPHABET_LOWERCASE_N,
TOKEN_COLON,
}
tokens := []int{
TOKEN_RIGHT_BRACE,
TOKEN_ALPHABET_LOWERCASE_L,
TOKEN_ALPHABET_LOWERCASE_L,
TOKEN_ALPHABET_LOWERCASE_U,
TOKEN_ALPHABET_LOWERCASE_N,
TOKEN_COLON,
}
matchResult := matchStack(stack, tokens)
assert.Equal(t, true, matchResult, "the tokens should be match")
}
func Test_matchStack2(t *testing.T) {
stack := []int{
TOKEN_LEFT_BRACE,
TOKEN_QUOTE,
TOKEN_QUOTE,
TOKEN_COLON,
TOKEN_ALPHABET_LOWERCASE_N,
TOKEN_ALPHABET_LOWERCASE_U,
}
tokens := []int{
TOKEN_ALPHABET_LOWERCASE_N,
TOKEN_ALPHABET_LOWERCASE_U,
}
matchResult := matchStack(stack, tokens)
assert.Equal(t, true, matchResult, "the tokens should be match")
}