Lines Matching +full:- +full:l
1 //===-- StringLexerTest.cpp -----------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
15 StringLexer l("foo"); in TEST() local
16 EXPECT_EQ("foo", l.GetUnlexed()); in TEST()
17 l.Next(); in TEST()
18 EXPECT_EQ("oo", l.GetUnlexed()); in TEST()
19 l.Next(); in TEST()
20 l.Next(); in TEST()
21 EXPECT_EQ("", l.GetUnlexed()); in TEST()
25 StringLexer l("foo"); in TEST() local
26 EXPECT_FALSE(l.HasAtLeast(5)); in TEST()
27 EXPECT_FALSE(l.HasAtLeast(4)); in TEST()
28 EXPECT_TRUE(l.HasAtLeast(3)); in TEST()
29 EXPECT_TRUE(l.HasAtLeast(2)); in TEST()
30 EXPECT_TRUE(l.HasAtLeast(1)); in TEST()
32 l.Next(); in TEST()
33 EXPECT_FALSE(l.HasAtLeast(5)); in TEST()
34 EXPECT_FALSE(l.HasAtLeast(4)); in TEST()
35 EXPECT_FALSE(l.HasAtLeast(3)); in TEST()
36 EXPECT_TRUE(l.HasAtLeast(2)); in TEST()
37 EXPECT_TRUE(l.HasAtLeast(1)); in TEST()
39 l.Next(); in TEST()
40 l.Next(); in TEST()
41 EXPECT_FALSE(l.HasAtLeast(5)); in TEST()
42 EXPECT_FALSE(l.HasAtLeast(4)); in TEST()
43 EXPECT_FALSE(l.HasAtLeast(3)); in TEST()
44 EXPECT_FALSE(l.HasAtLeast(2)); in TEST()
45 EXPECT_FALSE(l.HasAtLeast(1)); in TEST()
49 StringLexer l("foobar"); in TEST() local
51 EXPECT_FALSE(l.AdvanceIf("oo")); in TEST()
53 EXPECT_TRUE(l.AdvanceIf("fo")); in TEST()
54 EXPECT_FALSE(l.AdvanceIf("obarz")); in TEST()
56 EXPECT_TRUE(l.AdvanceIf("obar")); in TEST()
58 EXPECT_FALSE(l.AdvanceIf("obarz")); in TEST()
59 EXPECT_FALSE(l.AdvanceIf("foo")); in TEST()
60 EXPECT_FALSE(l.AdvanceIf("o")); in TEST()
61 EXPECT_FALSE(l.AdvanceIf(" ")); in TEST()
65 StringLexer l("foo"); in TEST() local
67 l.Next(); in TEST()
68 l.PutBack(1); in TEST()
69 EXPECT_EQ("foo", l.GetUnlexed()); in TEST()
71 l.Next(); in TEST()
72 l.Next(); in TEST()
73 l.Next(); in TEST()
74 l.PutBack(2); in TEST()
75 EXPECT_EQ("oo", l.GetUnlexed()); in TEST()
77 l.PutBack(1); in TEST()
78 EXPECT_EQ("foo", l.GetUnlexed()); in TEST()
82 StringLexer l("foo"); in TEST() local
84 EXPECT_EQ('f', l.Peek()); in TEST()
85 l.Next(); in TEST()
86 EXPECT_EQ('o', l.Peek()); in TEST()
87 l.Next(); in TEST()
88 EXPECT_EQ('o', l.Peek()); in TEST()
92 StringLexer l("foo"); in TEST() local
93 EXPECT_EQ('f', l.Next()); in TEST()
94 EXPECT_EQ('o', l.Next()); in TEST()
95 EXPECT_EQ('o', l.Next()); in TEST()
99 StringLexer l("foo"); in TEST() local
101 EXPECT_FALSE(l.NextIf('\0')); in TEST()
102 EXPECT_FALSE(l.NextIf(' ')); in TEST()
103 EXPECT_FALSE(l.NextIf('o')); in TEST()
105 EXPECT_TRUE(l.NextIf('f')); in TEST()
107 EXPECT_FALSE(l.NextIf('\0')); in TEST()
108 EXPECT_FALSE(l.NextIf(' ')); in TEST()
109 EXPECT_FALSE(l.NextIf('f')); in TEST()
111 EXPECT_TRUE(l.NextIf('o')); in TEST()
113 EXPECT_FALSE(l.NextIf('\0')); in TEST()
114 EXPECT_FALSE(l.NextIf(' ')); in TEST()
115 EXPECT_FALSE(l.NextIf('f')); in TEST()
117 EXPECT_TRUE(l.NextIf('o')); in TEST()
121 StringLexer l("foo"); in TEST() local
123 EXPECT_FALSE(l.NextIf({'\0', ' ', 'o'}).first); in TEST()
125 auto r = l.NextIf({'f'}); in TEST()
129 EXPECT_FALSE(l.NextIf({'\0', ' ', 'f'}).first); in TEST()
131 r = l.NextIf({'f', 'o'}); in TEST()
135 EXPECT_FALSE(l.NextIf({'\0', ' ', 'f'}).first); in TEST()
137 r = l.NextIf({'*', 'f', 'o', 'o'}); in TEST()