1 |
aw0a |
1 |
# This file is part of the ASCEND Modeling Library and is released |
2 |
|
|
# under the GNU Public License as described at the end of this file. |
3 |
|
|
# |
4 |
|
|
# beginning test suite for compiler features. |
5 |
|
|
# by Ben Allan, Nov. 1997 |
6 |
|
|
# |
7 |
|
|
# The models used in this script are not intended to be reusable, nor |
8 |
|
|
# to be examples of good style, nor to be read by anyone except system |
9 |
|
|
# developers. They are included as part of the ascend library to prove |
10 |
|
|
# that we really do test things before we put them out on the net. We |
11 |
|
|
# test a lot more than what is shown here. Here we have boundary and |
12 |
|
|
# completeness tests for features not ordinarily exercised in |
13 |
|
|
# tastefully written models. |
14 |
|
|
|
15 |
|
|
# test atom/relation child alignment |
16 |
|
|
DELETE TYPES; |
17 |
|
|
READ FILE "z-align.a4c"; |
18 |
|
|
COMPILE tall OF testall; |
19 |
|
|
BROWSE {tall}; |
20 |
|
|
CLEAR_VARS {tall}; |
21 |
|
|
|
22 |
|
|
# test parsing of ARE_ALIKE statements. |
23 |
|
|
# All fail_* models should fail, passes should have |
24 |
|
|
# style warnings, and there should be 4 definitions |
25 |
|
|
# in the Library from z-alike.a4c: |
26 |
|
|
# a, box, pass_1, pass_2_legal_aa_... |
27 |
|
|
# All but a should compile without warnings other than missing default_self. |
28 |
|
|
DELETE TYPES; |
29 |
|
|
READ FILE "z-alike.a4c"; |
30 |
|
|
COMPILE box OF box; |
31 |
|
|
COMPILE pass_1 OF pass_1; |
32 |
|
|
COMPILE pass_2 OF pass_2_legal_aa_down_in_unparameterized_object; |
33 |
|
|
|
34 |
|
|
# test context checking for methods/cases. |
35 |
|
|
# all models except 'pass' should fail. |
36 |
|
|
DELETE TYPES; |
37 |
|
|
READ FILE "z-context.a4c"; |
38 |
|
|
|
39 |
|
|
# checks passing of empty array object. |
40 |
|
|
# No error messages should appear. |
41 |
|
|
DELETE TYPES; |
42 |
|
|
READ FILE "z-emptyarg.a4c"; |
43 |
|
|
COMPILE test OF test; |
44 |
|
|
BROWSE {test.b}; |
45 |
|
|
|
46 |
|
|
# test indirect addressing in defining associative arrays. |
47 |
|
|
# no warnings/errors should occur other than missing default_self. |
48 |
|
|
DELETE TYPES; |
49 |
|
|
READ FILE "z-indirect.a4c"; |
50 |
|
|
COMPILE testind OF testindirect; |
51 |
|
|
|
52 |
|
|
|
53 |
|
|
# testing where-created calculations. |
54 |
|
|
# see NOTES in the model 'testwherecreated' for |
55 |
|
|
# details. |
56 |
|
|
DELETE TYPES; |
57 |
|
|
READ FILE "z-isawhere.a4c"; |
58 |
|
|
COMPILE a OF testwherecreated; |
59 |
|
|
BROWSE {a}; |
60 |
|
|
BROWSE {a.y}; |
61 |
|
|
BROWSE {a.z}; |
62 |
|
|
BROWSE {a.p1}; |
63 |
|
|
BROWSE {a.p2}; |
64 |
|
|
BROWSE {a.w}; |
65 |
|
|
|
66 |
|
|
# test unlabeled equation name generation and conflict |
67 |
|
|
# resolution. No errors should occur except missing default_self. |
68 |
|
|
DELETE TYPES; |
69 |
|
|
READ FILE "z-relname.a4c"; |
70 |
|
|
COMPILE t OF testrelname; |
71 |
|
|
BROWSE {t.g}; |
72 |
|
|
BROWSE {t.testrelname_1}; |
73 |
|
|
BROWSE {t.testrelname_2}; |
74 |
|
|
BROWSE {t.testrelname_4}; |
75 |
|
|
BROWSE {t.testrelname_5a}; |
76 |
|
|
BROWSE {t.testrelname_6}; |
77 |
|
|
|
78 |
|
|
# Parser test of adding methods and replacing methods. |
79 |
|
|
# Pass conditions are noted in the models. |
80 |
|
|
# The add and replace methods blocks for type b1 |
81 |
|
|
# should fail. The others should pass. |
82 |
|
|
DELETE TYPES; |
83 |
|
|
READ FILE "z-addmethod.a4c"; |
84 |
|
|
|
85 |
|
|
### |
86 |
|
|
### The following tests document one or more known bugs. |
87 |
|
|
### These need to be fixed, but are sufficiently marginal in |
88 |
|
|
### impact that we are not panicking about getting the fix |
89 |
|
|
### done yesterday. |
90 |
|
|
### These cases arise because with a small syntax you cannot |
91 |
|
|
### stop some really bizarre productions. |
92 |
|
|
### |
93 |
|
|
|
94 |
|
|
# test if logic evaluation. |
95 |
|
|
# at present, only t.nif[6] fails. |
96 |
|
|
DELETE TYPES; |
97 |
|
|
READ FILE "z-iflogic.a4c"; |
98 |
|
|
COMPILE t OF testif; |
99 |
|
|
BROWSE {t}; |
100 |
|
|
RUN {t.test}; |
101 |
|
|
BROWSE t.eval; |
102 |
|
|
BROWSE t.pass; |
103 |
|
|
BROWSE t.if; |
104 |
|
|
BROWSE t.nif; |
105 |
|
|
|
106 |
|
|
# test execution of for loops with empty resulting arrays. |
107 |
|
|
# currently empty relation arrays fail this test. |
108 |
|
|
DELETE TYPES; |
109 |
|
|
READ FILE "z-emptyfor.a4c"; |
110 |
|
|
COMPILE t OF testfor; |
111 |
|
|
BROWSE {t}; |
112 |
|
|
|
113 |
|
|
# test execution of arrays with bogus subscripts. |
114 |
|
|
# parts w,w2,x,x2 should appear UNDEFINED arrays. |
115 |
|
|
DELETE TYPES; |
116 |
|
|
READ FILE "z-arsubs.a4c"; |
117 |
|
|
COMPILE t OF range_test; |
118 |
|
|
BROWSE {t}; |
119 |
|
|
|
120 |
|
|
########## z-suite.a4s ends here ########## |
121 |
|
|
# |
122 |
|
|
# z-suite.a4s |
123 |
|
|
# by Benjamin Allan |
124 |
|
|
# December 02, 1997 |
125 |
|
|
# Part of the ASCEND Library |
126 |
|
|
# $Date: 1998/06/17 20:08:52 $ |
127 |
|
|
# $Revision: 1.6 $ |
128 |
|
|
# $Author: mthomas $ |
129 |
|
|
# $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/z-suite.a4s,v $ |
130 |
|
|
# |
131 |
|
|
# This file is part of the ASCEND Modeling Library. |
132 |
|
|
# |
133 |
|
|
# Copyright (C) 1997 - 1998 Carnegie Mellon University |
134 |
|
|
# |
135 |
|
|
# The ASCEND Modeling Library is free software. You can redistribute |
136 |
|
|
# it and/or modify it under the terms of the GNU General Public |
137 |
|
|
# License as published by the Free Software Foundation---either |
138 |
|
|
# version 2 of the License, or (at your option) any later version. |
139 |
|
|
# |
140 |
|
|
# The ASCEND Modeling Library is distributed in hope that it |
141 |
|
|
# will be useful, but WITHOUT ANY WARRANTY--without even the implied |
142 |
|
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
143 |
|
|
# See the GNU General Public License for more details. |
144 |
|
|
# |
145 |
|
|
# You should have received a copy of the GNU General Public License |
146 |
|
|
# along with the program. If not, write to the Free Software |
147 |
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check |
148 |
|
|
# the file named COPYING. |