/[ascend]/trunk/models/johnpye/when_test.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/when_test.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (show annotations) (download) (as text)
Fri Dec 23 00:59:32 2005 UTC (16 years, 9 months ago) by johnpye
File MIME type: text/x-ascend
File size: 471 byte(s)
Fixing up self-testing models
1 REQUIRE "atoms.a4l";
2
3 MODEL when_test;
4
5 x IS_A solver_var;
6 y IS_A solver_var;
7
8 lin: y = x - 1;
9 quad: y = x^2 / 4;
10
11 linear IS_A boolean_var;
12 linear == (x > 2);
13
14 WHEN(linear)
15 CASE TRUE:
16 USE lin;
17 CASE FALSE:
18 USE quad;
19 END WHEN;
20
21 METHODS
22 METHOD default_self;
23 RUN reset;
24 RUN values;
25 END default_self;
26
27 METHOD specify;
28 x.fixed := TRUE;
29 END specify;
30
31 METHOD values;
32 x := -4;
33 END values;
34
35 METHOD self_test;
36 ASSERT y == 4;
37 END self_test;
38
39 END when_test;
40

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22