85 self assert: (guard message = #isAlphaNumeric) not. |
85 self assert: (guard message = #isAlphaNumeric) not. |
86 |
86 |
87 ! |
87 ! |
88 |
88 |
89 testMessage2 |
89 testMessage2 |
90 guard := PPCGuard new initializeFor: #letter asParser / #digit asParser. |
90 guard := PPCGuard new initializeFor: (#letter asParser / #digit asParser) asCompilerTree. |
91 self assert: guard message = #isAlphaNumeric |
91 self assert: guard message = #isAlphaNumeric |
92 |
92 |
93 ! |
93 ! |
94 |
94 |
|
95 testNot |
|
96 guard := PPCGuard new initializeFor: ('foo' asParser not, 'fee' asParser) asCompilerTree. |
|
97 self assert: (guard classification at: $f asInteger). |
|
98 ! |
|
99 |
|
100 testNot2 |
|
101 guard := PPCGuard new initializeFor: ('foo' asParser not, 'fee' asParser) asCompilerTree optimizeTree. |
|
102 self assert: (guard classification at: $f asInteger). |
|
103 ! |
|
104 |
95 testTestMessage |
105 testTestMessage |
96 guard := PPCGuard new initializeFor: #letter asParser. |
106 guard := PPCGuard new initializeFor: #letter asParser asCompilerTree. |
97 self assert: (guard testMessage: #isLetter). |
107 self assert: (guard testMessage: #isLetter). |
98 self assert: (guard testMessage: #isAlphaNumeric) not. |
108 self assert: (guard testMessage: #isAlphaNumeric) not. |
99 |
109 |
100 guard := PPCGuard new initializeFor: #word asParser. |
110 guard := PPCGuard new initializeFor: #word asParser asCompilerTree. |
101 self assert: (guard testMessage: #isAlphaNumeric). |
111 self assert: (guard testMessage: #isAlphaNumeric). |
102 |
112 |
103 guard := PPCGuard new initializeFor: #digit asParser. |
113 guard := PPCGuard new initializeFor: #digit asParser asCompilerTree. |
104 self assert: (guard testMessage: #isDigit). |
114 self assert: (guard testMessage: #isDigit). |
105 |
115 |
106 guard := PPCGuard new initializeFor: 'a' asParser. |
116 guard := PPCGuard new initializeFor: 'a' asParser asCompilerTree. |
107 self assert: (guard testMessage: #isDigit) not. |
117 self assert: (guard testMessage: #isDigit) not. |
108 self assert: (guard testMessage: #isLetter) not. |
118 self assert: (guard testMessage: #isLetter) not. |
109 self assert: (guard testMessage: #isAlphaNumeric) not. |
119 self assert: (guard testMessage: #isAlphaNumeric) not. |
110 |
120 |
111 ! |
121 ! |
112 |
122 |
113 testTestSingleCharacter |
123 testTestSingleCharacter |
114 guard := PPCGuard new initializeFor: $a asParser. |
124 guard := PPCGuard new initializeFor: $a asParser asCompilerTree. |
115 self assert: guard testSingleCharacter. |
125 self assert: guard testSingleCharacter. |
116 |
126 |
117 guard := PPCGuard new initializeFor: 'foo' asParser. |
127 guard := PPCGuard new initializeFor: 'foo' asParser asCompilerTree. |
118 self assert: guard testSingleCharacter. |
128 self assert: guard testSingleCharacter. |
119 |
129 |
120 guard := PPCGuard new initializeFor: ('foo' asParser / 'bar' asParser). |
130 guard := PPCGuard new initializeFor: ('foo' asParser / 'bar' asParser) asCompilerTree. |
121 self assert: guard testSingleCharacter not. |
131 self assert: guard testSingleCharacter not. |
122 |
132 |
123 guard := PPCGuard new initializeFor: ($a asParser, (#letter asParser / #digit asParser)). |
133 guard := PPCGuard new initializeFor: ($a asParser, (#letter asParser / #digit asParser)) asCompilerTree. |
|
134 self assert: guard testSingleCharacter. |
|
135 |
|
136 guard := PPCGuard new initializeFor: ('foo' asParser / 'fee' asParser) asCompilerTree. |
124 self assert: guard testSingleCharacter. |
137 self assert: guard testSingleCharacter. |
125 ! ! |
138 ! ! |
126 |
139 |
127 !PPCGuardTest class methodsFor:'documentation'! |
140 !PPCGuardTest class methodsFor:'documentation'! |
128 |
141 |