Skip to content

Commit 022f42b

Browse files
committed
Add test on bitwise operators
1 parent 8e09e15 commit 022f42b

1 file changed

Lines changed: 41 additions & 8 deletions

File tree

src/FAST-Python-Tools-Tests/FASTPythonImporterTest.class.st

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ FASTPythonImporterTest >> testAssignment [
9898
self assert: (assignment expression isOfType: FASTPyInteger)
9999
]
100100

101-
{ #category : 'tests - opererators' }
101+
{ #category : 'tests - operators' }
102102
FASTPythonImporterTest >> testBinaryOperator [
103103

104104
| operator |
@@ -117,7 +117,7 @@ FASTPythonImporterTest >> testBinaryOperator [
117117
self assert: operator operator equals: '+'
118118
]
119119

120-
{ #category : 'tests - opererators' }
120+
{ #category : 'tests - operators' }
121121
FASTPythonImporterTest >> testBinaryOperatorInBinaryOperator [
122122

123123
| operator left |
@@ -143,7 +143,40 @@ FASTPythonImporterTest >> testBinaryOperatorInBinaryOperator [
143143
self assert: left operator equals: '+'
144144
]
145145

146-
{ #category : 'tests - opererators' }
146+
{ #category : 'tests - operators' }
147+
FASTPythonImporterTest >> testBitwiseOperator [
148+
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol: "
149+
150+
self parse: '0b00101101 & 0b00011011'.
151+
152+
self assert: (fast allWithType: FASTPyModule) size equals: 1.
153+
self assert: (fast allWithType: FASTPyInteger) size equals: 2.
154+
self assert: (fast allWithType: FASTPyBinaryOperator) size equals: 1.
155+
156+
stack push: fast rootEntities anyOne genericChildren first.
157+
self assert: self topEntity sourceCode equals: '0b00101101 & 0b00011011'.
158+
self assert: (self topEntity isOfType: FASTPyBinaryOperator).
159+
160+
"Testing value of monovalue relation leftOperand"
161+
self assert: self topEntity leftOperand isNotNil.
162+
163+
stack push: self topEntity leftOperand.
164+
self assert: self topEntity sourceCode equals: '0b00101101'.
165+
self assert: (self topEntity isOfType: FASTPyInteger).
166+
stack pop.
167+
168+
"Testing value of monovalue relation rightOperand"
169+
self assert: self topEntity rightOperand isNotNil.
170+
171+
stack push: self topEntity rightOperand.
172+
self assert: self topEntity sourceCode equals: '0b00011011'.
173+
self assert: (self topEntity isOfType: FASTPyInteger).
174+
stack pop.
175+
self assert: self topEntity operator equals: '&'.
176+
177+
]
178+
179+
{ #category : 'tests - operators' }
147180
FASTPythonImporterTest >> testBooleanOperator [
148181

149182
| operator |
@@ -162,7 +195,7 @@ FASTPythonImporterTest >> testBooleanOperator [
162195
self assert: operator operator equals: 'and'
163196
]
164197

165-
{ #category : 'tests - opererators' }
198+
{ #category : 'tests - operators' }
166199
FASTPythonImporterTest >> testBooleanOperatorInBooleanOperator [
167200

168201
| operator left |
@@ -188,7 +221,7 @@ FASTPythonImporterTest >> testBooleanOperatorInBooleanOperator [
188221
self assert: left operator equals: 'and'
189222
]
190223

191-
{ #category : 'tests - opererators' }
224+
{ #category : 'tests - operators' }
192225
FASTPythonImporterTest >> testChainedComparisonOperator [
193226

194227
| operator |
@@ -226,7 +259,7 @@ FASTPythonImporterTest >> testClassDefinition [
226259
self assert: class name equals: 'AClass'
227260
]
228261

229-
{ #category : 'tests - opererators' }
262+
{ #category : 'tests - operators' }
230263
FASTPythonImporterTest >> testComparisonOperator [
231264

232265
| operator |
@@ -1037,7 +1070,7 @@ FASTPythonImporterTest >> testNone [
10371070
self assert: (boolean isOfType: FASTTLiteral)
10381071
]
10391072

1040-
{ #category : 'tests - opererators' }
1073+
{ #category : 'tests - operators' }
10411074
FASTPythonImporterTest >> testNotOperator [
10421075

10431076
| operator |
@@ -1387,7 +1420,7 @@ FASTPythonImporterTest >> testTwoComments [
13871420
self assertCollection: ((fast allWithType: FASTPyComment) collect: #sourceCode as: Array) hasSameElements: { '# Comment 1'. '# Comment 2' }
13881421
]
13891422

1390-
{ #category : 'tests - opererators' }
1423+
{ #category : 'tests - operators' }
13911424
FASTPythonImporterTest >> testUnaryOperator [
13921425

13931426
| operator |

0 commit comments

Comments
 (0)