--- a/IRTransformTest.st Thu Oct 30 22:23:12 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-"{ Package: 'ctu:ircompiler' }"
-
-TestCase subclass:#IRTransformTest
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- category:'IR Compiler-Tests'
-!
-
-
-!IRTransformTest methodsFor:'testing'!
-
-testAdd
- |iRMethod aCompiledMethod|
-
- iRMethod := (IRBuilder new)
- numRargs:1;
- addTemps:#( #self );
- pushLiteral:1;
- returnTop;
- ir.
- (iRMethod allSequences last) last delete.
- (iRMethod allSequences last) last delete.
- (iRMethod allSequences last) add:(IRInstruction pushLiteral:2).
- (iRMethod allSequences last) add:(IRInstruction returnTop).
- aCompiledMethod := iRMethod compiledCode.
- self should:[ (aCompiledMethod valueWithReceiver:nil arguments:#()) = 2 ].
-!
-
-testAddBefore
- |iRMethod aCompiledMethod ret|
-
- iRMethod := (IRBuilder new)
- numRargs:1;
- addTemps:#( #self );
- pushLiteral:1;
- returnTop;
- ir.
- (iRMethod allSequences last) last delete.
- (iRMethod allSequences last) last delete.
- ret := (IRInstruction returnTop).
- (iRMethod allSequences last) add:ret.
- (iRMethod allSequences last) add:(IRInstruction pushLiteral:2) before:ret.
- aCompiledMethod := iRMethod compiledCode.
- self should:[ (aCompiledMethod valueWithReceiver:nil arguments:#()) = 2 ].
-!
-
-testAddIntructions
-
- | iRMethod aCompiledMethod |
-
- iRMethod := IRBuilder new
- numRargs: 1;
- addTemps: #(self); "receiver and args declarations"
- pushLiteral: 1;
- returnTop;
- ir.
-
- (iRMethod allSequences last) last delete.
- (iRMethod allSequences last) last delete.
-
- (iRMethod allSequences last)
- addInstructions: {(IRInstruction pushLiteral: 2). (IRInstruction returnTop)}.
-
- aCompiledMethod := iRMethod compiledCode.
- self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
-
- "Modified: / 30-03-2009 / 19:40:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
-!
-
-testAddIntructionsBefore
-
- | iRMethod aCompiledMethod push |
-
- iRMethod := IRBuilder new
- numRargs: 1;
- addTemps: #(self); "receiver and args declarations"
- pushLiteral: 1;
- returnTop;
- ir.
-
- push := (iRMethod allSequences last) at: (iRMethod allSequences size - 1) .
-
- (iRMethod allSequences last)
- addInstructions: {(IRInstruction pushLiteral: 2). (IRInstruction returnTop)} before: push.
-
- aCompiledMethod := iRMethod compiledCode.
- self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
-
- "Modified: / 30-03-2009 / 19:40:21 / Jan Vrany <vranyj1@fel.cvut.cz>"
-!
-
-testAddIntructionsBeforeFromLList
- |iRMethod aCompiledMethod push llist col|
-
- iRMethod := (IRBuilder new)
- numRargs:1;
- addTemps:#( #self );
- pushLiteral:1;
- returnTop;
- ir.
- push := (iRMethod allSequences last) at:(iRMethod allSequences size - 1).
- llist := LinkedList new.
- llist add:(IRInstruction pushLiteral:2).
- llist add:(IRInstruction returnTop).
- col := llist asOrderedCollection.
- (iRMethod allSequences last) addInstructions:col before:push.
- aCompiledMethod := iRMethod compiledCode.
- self should:[ (aCompiledMethod valueWithReceiver:nil arguments:#()) = 2 ].
-!
-
-testDelete
- |iRMethod aCompiledMethod|
-
- iRMethod := (IRBuilder new)
- numRargs:1;
- addTemps:#( #self );
- pushLiteral:1;
- pushLiteral:2;
- returnTop;
- ir.
- ((iRMethod allSequences last)
- detect:[:each | each isConstant:[:c | c == 2 ] ]) delete.
- aCompiledMethod := iRMethod compiledCode.
- self should:[ (aCompiledMethod valueWithReceiver:nil arguments:#()) = 1 ].
-!
-
-testReplace
- |iRMethod aCompiledMethod|
-
- iRMethod := (IRBuilder new)
- numRargs:1;
- addTemps:#( #self );
- pushLiteral:1;
- returnTop;
- ir.
- (iRMethod allSequences last at:1)
- replaceWith:(IRInstruction pushLiteral:2).
- aCompiledMethod := iRMethod compiledCode.
- self should:[ (aCompiledMethod valueWithReceiver:nil arguments:#()) = 2 ].
-!
-
-testReplaceInstr
-
- | iRMethod aCompiledMethod |
-
- iRMethod := IRBuilder new
- numRargs: 1;
- addTemps: #(self); "receiver and args declarations"
- pushLiteral: 1;
- returnTop;
- ir.
-
- (iRMethod allSequences last at: 1)
- replaceWithInstructions: {(IRInstruction pushLiteral: 2)}.
-
- aCompiledMethod := iRMethod compiledCode.
- self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
-
- "Modified: / 30-03-2009 / 19:40:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
-! !
-
-!IRTransformTest class methodsFor:'documentation'!
-
-version_CVS
- ^ 'Header: /cvs/stx/cvut/stx/goodies/newcompiler/IRTransformTest.st,v 1.3 2009/10/08 11:56:52 fm Exp '
-!
-
-version_SVN
- ^ '$Id:: $'
-! !
-