|
1 Object subclass:#CompilerTest |
|
2 instanceVariableNames:'' |
|
3 classVariableNames:'' |
|
4 poolDictionaries:'' |
|
5 category:'Tests - Compiler' |
|
6 ! |
|
7 |
|
8 |
|
9 !CompilerTest methodsFor:'tests - constant folding'! |
|
10 |
|
11 testFloat_pi |
|
12 ^ Float pi |
|
13 ! |
|
14 |
|
15 testFloat_unity |
|
16 ^ Float unity |
|
17 ! |
|
18 |
|
19 testFloat_zero |
|
20 ^ Float zero |
|
21 ! |
|
22 |
|
23 testSmalltalk_if_else_isSmalltalkX |
|
24 Smalltalk isSmalltalkX ifTrue:[ |
|
25 ^ 'yes' |
|
26 ] ifFalse:[ |
|
27 ^ 'no' |
|
28 ] |
|
29 ! |
|
30 |
|
31 testSmalltalk_if_else_isVisualWorks |
|
32 Smalltalk isVisualWorks ifTrue:[ |
|
33 ^ 'yes' |
|
34 ] ifFalse:[ |
|
35 ^ 'no' |
|
36 ] |
|
37 ! |
|
38 |
|
39 testSmalltalk_if_isSmalltalkX |
|
40 Smalltalk isSmalltalkX ifTrue:[ |
|
41 ^ 'yes' |
|
42 ]. |
|
43 ^ 'no' |
|
44 ! |
|
45 |
|
46 testSmalltalk_if_isSqueak |
|
47 Smalltalk isSqueak ifTrue:[ |
|
48 ^ 'yes' |
|
49 ]. |
|
50 ^ 'no' |
|
51 ! |
|
52 |
|
53 testSmalltalk_if_isVisualWorks |
|
54 Smalltalk isVisualWorks ifTrue:[ |
|
55 ^ 'yes' |
|
56 ]. |
|
57 ^ 'no' |
|
58 ! |
|
59 |
|
60 testSmalltalk_isSmalltalkX |
|
61 ^ Smalltalk isSmalltalkX |
|
62 ! |
|
63 |
|
64 testSmalltalk_isSqueak |
|
65 ^ Smalltalk isSqueak |
|
66 ! |
|
67 |
|
68 testSmalltalk_isVisualAge |
|
69 ^ Smalltalk isVisualAge |
|
70 ! |
|
71 |
|
72 testSmalltalk_isVisualWorks |
|
73 ^ Smalltalk isVisualWorks |
|
74 ! |
|
75 |
|
76 testUnaryFolding |
|
77 self testFloat_pi ~= (Float perform:#pi) ifTrue:[self halt]. |
|
78 self testFloat_unity ~= (Float perform:#unity) ifTrue:[self halt]. |
|
79 self testFloat_zero ~= (Float perform:#zero) ifTrue:[self halt]. |
|
80 |
|
81 self testSmalltalk_isSmalltalkX ~= (Smalltalk perform:#isSmalltalkX) ifTrue:[self halt]. |
|
82 self testSmalltalk_isSqueak ~= (Smalltalk perform:#isSqueak) ifTrue:[self halt]. |
|
83 self testSmalltalk_isVisualWorks ~= (Smalltalk perform:#isVisualWorks) ifTrue:[self halt]. |
|
84 self testSmalltalk_isVisualAge ~= (Smalltalk perform:#isVisualAge) ifTrue:[self halt]. |
|
85 |
|
86 " |
|
87 self basicNew testUnaryFolding |
|
88 " |
|
89 ! ! |
|
90 |
|
91 !CompilerTest class methodsFor:'documentation'! |
|
92 |
|
93 version |
|
94 ^ '$Header$' |
|
95 ! ! |