tests/IRBuilderTest.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 30 Oct 2014 22:27:09 +0000
changeset 44 840c68a91cdd
child 46 2fb37cf149fb
permissions -rw-r--r--
Tests moved to separate subpackage to follow St/X conventions.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'ctu:ircompiler/tests' }"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
TestCase subclass:#IRBuilderTest
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
	instanceVariableNames:''
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
	classVariableNames:'TestToPush'
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	poolDictionaries:''
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	category:'IR Compiler-Tests'
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
!IRBuilderTest class methodsFor:'as yet unclassified'!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
testToPush
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
	^TestToPush
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
testToPush: anObject
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
	TestToPush := anObject
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
! !
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
!IRBuilderTest methodsFor:'mock methods'!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
mock1: arg1 with: arg2
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
    ^arg1 + arg2
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
    "Created: / 02-12-2008 / 09:11:46 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
mock2
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
    ^[ testSelector ]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
    decompiling IRBuilderTest>>mock2
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
    nA: 0 nV: 0 nT: 2   
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
    
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
    1: 37 04 00 00             makeBlock 4 (7) nv=0 na=0
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
    5: 5A                      pushInstVar1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
    6: 00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
    7: 08 03                   LINE[3]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
    9: 00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
    "Created: / 28-03-2009 / 18:47:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
    "Modified: / 28-03-2009 / 20:16:08 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
mock3
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
    | b |
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
    b := 1.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
    ^[ b ]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
    decompiling IRBuilderTest>>mock3
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
    nA: 0 nV: 1 nT: 2
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
    1: 79                      push1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
    2: 64                      storeMethodVar1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
    3: 37 04 00 00             makeBlock 4 (9) nv=0 na=0
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
    7: 50                      pushMethodVar1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
    8: 00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
    9: 08 04                   LINE[4]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
    11:00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
    "Created: / 28-03-2009 / 20:16:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
mock4
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
    ^[:arg| arg ]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
    decompiling IRBuilderTest>>mock4
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
    nA: 0 nV: 0 nT: 2
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    1: 37 04 00 01             makeBlock 4 (7) nv=0 na=1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
    5: 8C                      pushBlockArg1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
    6: 00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
    7: 08 03                   LINE[3]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
    9: 00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
    "Created: / 28-03-2009 / 20:18:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
mock5
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
    ^[|temp| temp ]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
    decompiling IRBuilderTest>>mock5
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
    nA: 0 nV: 0 nT: 2
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
    
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
    1: 37 04 01 00             makeBlock 4 (7) nv=1 na=0
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
    5: E8                      pushBlockVar1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
    6: 00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
    7: 08 03                   LINE[3]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
    9: 00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
    "Created: / 28-03-2009 / 20:19:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   110
mock6
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
    ^[|temp| [ temp ] ]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   113
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
    decompiling IRBuilderTest>>mock6
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
    nA: 0 nV: 0 nT: 3
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
    1: 37 0B 01 00             makeBlock 11 (14) nv=1 na=0
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
    5: 37 06 00 00             makeBlock 6 (13) nv=0 na=0
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
    9: 80 01 01                pushOuterBlockVar 1 lvl: 1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   121
    12:00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
    13:00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
    14:08 03                   LINE[3]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
    16:00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   127
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
    "Created: / 28-03-2009 / 20:20:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   130
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   131
mock7
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   132
    | b |
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
    b := 1.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
    ^[ ^b ]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
    decompiling IRBuilderTest>>mock7
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
    nA: 0 nV: 1 nT: 2
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
    1: 79                      push1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
    2: 64                      storeMethodVar1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   142
    3: 37 06 00 00             makeBlock 6 (11) nv=0 na=0
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
    7: 50                      pushMethodVar1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   144
    8: 08 04                   LINE[4]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
    10:07                      homeRetTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
    11:08 04                   LINE[4]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   147
    13:00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   148
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   149
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   150
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   151
    "Created: / 28-03-2009 / 20:21:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   152
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
mock8
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   156
    ^([:arg| arg ] value: 22)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   157
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   158
    "Created: / 30-03-2009 / 19:21:48 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   160
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   161
mock9
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   163
    ^[:barg1 | [:barg2 | barg2 ] value: barg1 ]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   164
        value: 22
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   165
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   166
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   167
    decompiling IRBuilderTest>>mock9
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
    nA: 0 nV: 0 nT: 3
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   169
    
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   170
     1: 37 0C 00 01             makeBlock 12 (15) nv=0 na=1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   171
     5: 37 04 00 01             makeBlock 4 (11) nv=0 na=1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   172
     9: 8C                      pushBlockArg1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   173
    10: 00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   174
    11: 8C                      pushBlockArg1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   175
    12: 98 03                   send1 #value:[3]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   176
    14: 00                      retTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   177
    15: 10 16                   pushNum 22
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   178
    17: 98 04                   send1 #value:[4]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   179
    19: 08 03                   LINE[3]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   180
    21: 00 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   181
    
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   182
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   183
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   184
    "Created: / 11-05-2009 / 23:09:57 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   185
! !
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   186
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   187
!IRBuilderTest methodsFor:'testing'!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   188
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   189
halt
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   190
        "Redefinition for testing the #send:toSuperOf:"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   191
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   192
    "Created: / 11-06-2008 / 16:08:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   193
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   194
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   195
isThisEverCalled
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   196
	"Redefinition for testing the #send:toSuperOf:"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   197
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   198
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   199
testDup
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   200
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   201
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   202
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   203
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   204
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   205
                pushLiteral:3;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   206
                pushDup;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   207
                send:#'=';
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   208
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   209
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   210
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   211
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   212
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   213
        assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   214
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   215
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   216
testInstVar
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   217
    |aCompiledMethod irBuilder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   218
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   219
    irBuilder := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   220
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   221
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   222
                pushInstVar:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   223
                pushInstVar:2;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   224
                send:#'+';
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   225
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   226
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   227
    aCompiledMethod := irBuilder compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   228
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   229
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   230
        assert:((aCompiledMethod valueWithReceiver:(3 @ 4) arguments:#()) = 7).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   231
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   232
    "Modified: / 11-06-2008 / 13:16:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   233
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   234
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   235
testJumpAheadTo
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   236
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   237
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   238
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   239
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   240
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   241
                pushTemp:#self;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   242
                jumpAheadTo:#end;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   243
                pushLiteral:3;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   244
                jumpAheadTarget:#end;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   245
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   246
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   247
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   248
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   249
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   250
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   251
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   252
testJumpAheadToIf
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   253
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   254
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   255
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   256
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   257
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   258
                pushTemp:#self;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   259
                pushLiteral:true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   260
                jumpAheadTo:#end if:true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   261
                pushLiteral:3;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   262
                jumpAheadTarget:#end;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   263
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   264
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   265
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   266
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   267
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   268
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   269
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   270
testJumpBackTo
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   271
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   272
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   273
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   274
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   275
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   276
                pushTemp:#self;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   277
                pushLiteral:false;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   278
                jumpBackTarget:#begin;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   279
                jumpAheadTo:#end if:true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   280
                pushLiteral:true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   281
                jumpBackTo:#begin;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   282
                jumpAheadTarget:#end;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   283
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   284
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   285
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   286
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   287
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   288
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   289
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   290
testLine1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   291
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   292
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   293
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   294
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   295
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   296
                line:5;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   297
                pushLiteral:true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   298
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   299
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   300
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   301
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   302
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   303
        assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   304
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   305
    "Created: / 02-12-2008 / 09:11:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   306
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   307
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   308
testLine2
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   309
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   310
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   311
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   312
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   313
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   314
                line:5;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   315
                pushLiteral:true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   316
                pushLiteral:false;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   317
                send:#'&';
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   318
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   319
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   320
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   321
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   322
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   323
        assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = false).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   324
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   325
    "Created: / 02-12-2008 / 09:11:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   326
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   327
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   328
testLiteralArray
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   329
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   330
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   331
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   332
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   333
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   334
                pushLiteral:#( #test 4 #you );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   335
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   336
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   337
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   338
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   339
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   340
                = #( #test 4 #you )).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   341
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   342
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   343
testLiteralBoolean
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   344
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   345
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   346
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   347
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   348
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   349
                pushLiteral:true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   350
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   351
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   352
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   353
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   354
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   355
        assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   356
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   357
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   358
testLiteralCharacter
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   359
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   360
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   361
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   362
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   363
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   364
                pushLiteral:$e;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   365
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   366
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   367
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   368
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   369
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = $e).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   370
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   371
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   372
testLiteralFloat
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   373
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   374
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   375
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   376
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   377
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   378
                pushLiteral:2.0;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   379
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   380
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   381
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   382
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   383
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 2.0).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   384
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   385
    "Modified: / 03-11-2008 / 08:39:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   386
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   387
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   388
testLiteralInteger
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   389
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   390
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   391
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   392
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   393
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   394
                pushLiteral:2;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   395
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   396
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   397
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   398
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   399
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 2).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   400
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   401
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   402
testLiteralNil
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   403
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   404
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   405
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   406
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   407
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   408
                pushLiteral:nil;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   409
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   410
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   411
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   412
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   413
    self assert:((aCompiledMethod valueWithReceiver:4 arguments:#()) = nil).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   414
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   415
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   416
testLiteralString
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   417
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   418
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   419
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   420
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   421
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   422
                pushLiteral:'hello';
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   423
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   424
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   425
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   426
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   427
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   428
        assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 'hello').
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   429
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   430
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   431
testLiteralSymbole
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   432
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   433
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   434
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   435
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   436
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   437
                pushLiteral:#you;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   438
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   439
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   440
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   441
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   442
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   443
        assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = #you).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   444
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   445
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   446
testLiteralVariableClass
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   447
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   448
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   449
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   450
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   451
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   452
                pushLiteralVariable:Object binding;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   453
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   454
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   455
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   456
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   457
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   458
        assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = Object).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   459
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   460
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   461
testLiteralVariableClassVariable
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   462
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   463
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   464
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   465
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   466
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   467
                pushLiteralVariable:(ArithmeticValue bindingOf:#ArithmeticSignal);
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   468
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   469
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   470
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   471
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   472
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   473
                = ArithmeticValue arithmeticSignal).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   474
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   475
    "Modified: / 11-06-2008 / 11:31:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   476
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   477
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   478
testLiteralVariableGlobale
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   479
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   480
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   481
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   482
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   483
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   484
                pushLiteralVariable:Smalltalk binding;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   485
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   486
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   487
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   488
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   489
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   490
        assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = Smalltalk).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   491
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   492
    "Modified: / 11-06-2008 / 11:32:07 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   493
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   494
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   495
testPopTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   496
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   497
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   498
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   499
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   500
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   501
                pushLiteral:true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   502
                pushLiteral:false;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   503
                popTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   504
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   505
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   506
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   507
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   508
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   509
        assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   510
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   511
    "Modified: / 11-06-2008 / 13:22:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   512
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   513
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   514
testPushReceiver
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   515
    |iRMethod aCompiledMethod receiver|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   516
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   517
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   518
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   519
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   520
                pushReceiver;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   521
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   522
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   523
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   524
    receiver := (5 @ 8).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   525
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   526
    self assert:((aCompiledMethod valueWithReceiver:receiver arguments:#()) 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   527
                == receiver).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   528
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   529
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   530
testPushTempArgument
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   531
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   532
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   533
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   534
                numRargs:3;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   535
                addTemps:#( #self #a #b );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   536
                pushTemp:#a;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   537
                pushTemp:#b;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   538
                send:#'+';
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   539
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   540
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   541
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   542
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   543
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   544
        assert:((aCompiledMethod valueWithReceiver:nil arguments:#( 2 8 )) = 10).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   545
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   546
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   547
testPushTempSelf
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   548
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   549
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   550
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   551
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   552
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   553
                pushTemp:#self;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   554
                send:#class;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   555
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   556
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   557
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   558
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   559
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   560
                == UndefinedObject).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   561
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   562
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   563
testPushTempTemp
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   564
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   565
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   566
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   567
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   568
                addTemps:#( #self #a );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   569
                pushTemp:#a;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   570
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   571
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   572
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   573
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   574
    self assert:((aCompiledMethod valueWithReceiver:5 arguments:#()) = nil).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   575
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   576
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   577
testPushThisContext
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   578
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   579
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   580
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   581
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   582
                addTemps:#( #self #a );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   583
                pushThisContext;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   584
                send:#receiver;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   585
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   586
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   587
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   588
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   589
    self assert:((aCompiledMethod valueWithReceiver:5 arguments:#()) = 5).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   590
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   591
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   592
testPushThisEnv
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   593
    |iRMethod aCompiledMethod receiver|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   594
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   595
    ^ self.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   596
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   597
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   598
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   599
                pushThisContext;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   600
                pushLiteral:5;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   601
                pushLiteral:ClosureEnvironment;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   602
                pushLiteral:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   603
                send:#new:;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   604
                send:#privSetInstVar:put:;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   605
                pushThisEnv;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   606
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   607
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   608
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   609
    receiver := Object new.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   610
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   611
    self assert:((aCompiledMethod valueWithReceiver:receiver arguments:#()) 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   612
                isKindOf:ClosureEnvironment)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   613
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   614
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   615
testSendNumArgs1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   616
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   617
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   618
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   619
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   620
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   621
                pushReceiver;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   622
                pushLiteral:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   623
                pushLiteral:2;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   624
                send:#mock1 numArgs:2;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   625
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   626
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   627
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   628
    self class basicAddSelector:#mock1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   629
        withMethod:(self class >> #mock1:with:).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   630
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   631
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   632
        assert:(aCompiledMethod valueWithReceiver:(IRBuilderTest new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   633
                arguments:#()) = 3.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   634
    self class basicRemoveSelector:#mock1.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   635
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   636
    "Created: / 01-12-2008 / 19:58:18 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   637
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   638
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   639
testSendNumArgs2
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   640
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   641
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   642
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   643
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   644
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   645
                pushReceiver;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   646
                pushLiteral:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   647
                send:#mock1 numArgs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   648
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   649
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   650
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   651
    self class basicAddSelector:#mock1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   652
        withMethod:(self class >> #mock1:with:).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   653
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   654
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   655
        should:[
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   656
            (aCompiledMethod valueWithReceiver:(IRBuilderTest new) arguments:#())
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   657
        ]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   658
        raise:Error.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   659
    self class basicRemoveSelector:#mock1.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   660
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   661
    "Created: / 01-12-2008 / 19:59:02 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   662
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   663
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   664
testSendSuper
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   665
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   666
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   667
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   668
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   669
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   670
                pushReceiver;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   671
                send:#halt toSuperOf:IRBuilderTest;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   672
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   673
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   674
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   675
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   676
    self 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   677
        should:[
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   678
            (aCompiledMethod valueWithReceiver:(IRBuilderTest new) arguments:#())
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   679
        ]
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   680
        raise:Error.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   681
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   682
    "Modified: / 11-06-2008 / 16:09:12 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   683
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   684
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   685
testStorIntoVariable
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   686
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   687
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   688
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   689
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   690
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   691
                pushLiteral:4;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   692
                storeIntoLiteralVariable:(IRBuilderTest bindingOf:#TestToPush);
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   693
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   694
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   695
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   696
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   697
    aCompiledMethod valueWithReceiver:nil arguments:#().
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   698
    self assert:(IRBuilderTest testToPush = 4).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   699
    IRBuilderTest testToPush:nil.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   700
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   701
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   702
testStoreTemp
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   703
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   704
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   705
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   706
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   707
                addTemps:#( #self #a );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   708
                pushLiteral:34;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   709
                storeTemp:#a;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   710
                pushTemp:#a;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   711
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   712
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   713
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   714
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   715
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 34).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   716
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   717
    "Modified: / 11-06-2008 / 16:24:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   718
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   719
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   720
testStoreThisEnv
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   721
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   722
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   723
    ^ self.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   724
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   725
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   726
                addTemps:#( #self #a );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   727
                pushLiteral:ClosureEnvironment;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   728
                pushLiteral:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   729
                send:#new:;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   730
                storeThisEnv;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   731
                pushThisContext;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   732
                pushLiteral:5;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   733
                send:#privGetInstVar:;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   734
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   735
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   736
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   737
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   738
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   739
                isKindOf:ClosureEnvironment).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   740
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   741
    "Modified: / 11-06-2008 / 14:47:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   742
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   743
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   744
testTwoJumpAheadToIfsToSameTarget
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   745
    |iRMethod aCompiledMethod|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   746
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   747
    iRMethod := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   748
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   749
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   750
                pushTemp:#self;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   751
                pushLiteral:false;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   752
                jumpAheadTo:#end if:true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   753
                pushLiteral:true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   754
                jumpAheadTo:#end if:true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   755
                pushLiteral:3;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   756
                jumpAheadTarget:#end;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   757
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   758
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   759
    aCompiledMethod := iRMethod compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   760
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   761
    self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   762
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   763
    "Created: / 03-11-2008 / 13:34:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   764
! !
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   765
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   766
!IRBuilderTest methodsFor:'testing - blocks'!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   767
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   768
testBlock_blockNesting_1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   769
    |aCompiledMethod irBuilder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   770
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   771
    irBuilder := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   772
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   773
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   774
                pushBlockUsingBuilder:[:builder | 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   775
                        builder
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   776
                            numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   777
                            addTemps:#( #barg1 );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   778
                            pushBlockUsingBuilder:[:builder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   779
                                builder
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   780
                                    numRargs: 1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   781
                                    addTemps: #( #barg2 );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   782
                                    pushTemp: #barg2;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   783
                                    returnTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   784
                            ];
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   785
                            pushTemp: #barg1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   786
                            send: #value:;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   787
                            returnTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   788
                    ];
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   789
                pushLiteral: 22;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   790
                send:#value;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   791
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   792
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   793
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   794
        irBuilder ir
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   795
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   796
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   797
    aCompiledMethod := irBuilder compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   798
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   799
    self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   800
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   801
    "Created: / 11-05-2009 / 23:04:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   802
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   803
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   804
testBlock_blockTempArg
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   805
    |aCompiledMethod irBuilder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   806
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   807
    irBuilder := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   808
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   809
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   810
                pushBlockUsingBuilder:[:builder | 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   811
                        builder
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   812
                            numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   813
                            addTemps:#( #barg1 );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   814
                            pushTemp:#barg1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   815
                            returnTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   816
                    ];
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   817
                pushLiteral:22;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   818
                send:#value:;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   819
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   820
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   821
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   822
        irBuilder ir
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   823
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   824
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   825
    aCompiledMethod := irBuilder compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   826
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   827
    self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   828
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   829
    "Created: / 30-03-2009 / 14:26:18 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   830
    "Modified: / 30-03-2009 / 19:16:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   831
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   832
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   833
testBlock_blockTempVar
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   834
    |aCompiledMethod irBuilder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   835
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   836
    irBuilder := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   837
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   838
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   839
                pushBlockUsingBuilder:[:builder | 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   840
                        builder
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   841
                            numRargs:0;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   842
                            addTemps:#( #bvar1 );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   843
                            pushLiteral: 22;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   844
                            storeTemp:#bvar1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   845
                            pushTemp: #bvar1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   846
                            returnTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   847
                    ];
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   848
                send:#value;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   849
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   850
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   851
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   852
        irBuilder ir
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   853
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   854
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   855
    aCompiledMethod := irBuilder compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   856
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   857
    self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   858
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   859
    "Created: / 30-03-2009 / 23:03:48 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   860
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   861
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   862
testBlock_block_in_another_basic_block
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   863
    |aCompiledMethod irBuilder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   864
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   865
    irBuilder := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   866
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   867
                addTemps:#( #self );
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   868
                pushLiteral: false;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   869
                pushLiteral: true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   870
                jumpAheadTo: #end if: false;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   871
                pushBlockUsingBuilder:[:builder | 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   872
                        builder
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   873
                            numRargs: 0;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   874
                            pushLiteral: true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   875
                            returnTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   876
                    ];
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   877
                send: #value;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   878
                jumpAheadTarget: #end;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   879
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   880
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   881
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   882
        irBuilder ir
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   883
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   884
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   885
    aCompiledMethod := irBuilder compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   886
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   887
    self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   888
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   889
    "Created: / 13-05-2009 / 11:24:48 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   890
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   891
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   892
testBlock_exceptionHandler
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   893
    |aCompiledMethod irBuilder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   894
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   895
    irBuilder := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   896
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   897
                addTemps:#( #self);
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   898
               pushBlockUsingBuilder:[:builder | 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   899
                        builder
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   900
                            numRargs:0;  
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   901
                            pushLiteral: 1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   902
                            pushLiteral: 0;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   903
                            send: #/;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   904
                            pushLiteral: false;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   905
                            remoteReturn
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   906
                    ];
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   907
                pushLiteralVariable: #Error;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   908
                pushBlockUsingBuilder:[:builder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   909
                    builder
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   910
                        numRargs:0;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   911
                        pushLiteral: true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   912
                        remoteReturn];
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   913
                send: #on:do:;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   914
                pushLiteral: false;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   915
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   916
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   917
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   918
        irBuilder ir
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   919
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   920
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   921
    aCompiledMethod := irBuilder compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   922
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   923
    self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   924
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   925
    "Created: / 11-05-2009 / 21:53:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   926
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   927
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   928
testBlock_exceptionHandler_noRemoteReturn
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   929
    |aCompiledMethod irBuilder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   930
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   931
    irBuilder := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   932
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   933
                addTemps:#( #self);
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   934
               pushBlockUsingBuilder:[:builder | 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   935
                        builder
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   936
                            numRargs:0;  
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   937
                            pushLiteral: 1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   938
                            pushLiteral: 0;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   939
                            send: #/;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   940
                            pushLiteral: false;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   941
                            returnTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   942
                    ];
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   943
                pushLiteralVariable: #Error;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   944
                pushBlockUsingBuilder:[:builder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   945
                    builder
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   946
                        numRargs:0;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   947
                        pushLiteral: true;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   948
                        returnTop];
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   949
                send: #on:do:;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   950
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   951
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   952
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   953
        irBuilder ir
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   954
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   955
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   956
    aCompiledMethod := irBuilder compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   957
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   958
    self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   959
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   960
    "Created: / 11-05-2009 / 21:53:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   961
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   962
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   963
testBlock_invalid_instruction_ordering_bug_1
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   964
    |aCompiledMethod irBuilder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   965
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   966
    irBuilder := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   967
                    numRargs: 1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   968
                    addTemps: #(self i);
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   969
                    pushTemp: #i;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   970
                    pushLiteral: 3;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   971
                    pushReceiver;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   972
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   973
                    pushBlockUsingBuilder: [ :builder | 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   974
                        builder
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   975
                            numRargs: 0;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   976
                            addTemps: #();
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   977
                            pushTemp: #i;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   978
                            returnTop.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   979
                    ];
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   980
                    returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   981
                    ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   982
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   983
        irBuilder ir
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   984
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   985
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   986
    aCompiledMethod := irBuilder compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   987
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   988
    self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) isKindOf: Block).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   989
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   990
    "Created: / 11-05-2009 / 21:55:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   991
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   992
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   993
testBlock_methodTempVar
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   994
    |aCompiledMethod irBuilder|
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   995
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   996
    irBuilder := (IRBuilder new)
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   997
                numRargs:1;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   998
                addTemps:#( #self #a);
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   999
                pushLiteral: 22;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1000
                storeTemp: #a;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1001
                pushBlockUsingBuilder:[:builder | 
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1002
                        builder
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1003
                            numRargs:0;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1004
                            pushTemp: #a;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1005
                            returnTop
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1006
                    ];
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1007
                send:#value;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1008
                returnTop;
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1009
                ir.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1010
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1011
        irBuilder ir
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1012
    "
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1013
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1014
    aCompiledMethod := irBuilder compiledCode.
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1015
    self assert:(aCompiledMethod isKindOf:CompiledMethod).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1016
    self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1017
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1018
    "Created: / 30-03-2009 / 23:05:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1019
    "Modified: / 01-04-2009 / 19:43:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1020
! !
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1021
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1022
!IRBuilderTest class methodsFor:'documentation'!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1023
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1024
version_CVS
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1025
    ^ 'Header: /cvs/stx/cvut/stx/goodies/newcompiler/IRBuilderTest.st,v 1.3 2009/10/08 12:03:51 fm Exp '
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1026
!
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1027
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1028
version_SVN
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1029
    ^ '$Id::                                                                                                                        $'
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1030
! !
840c68a91cdd Tests moved to separate subpackage to follow St/X conventions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1031