/[ascend]/trunk/models/test/defaultmethods.a4c
ViewVC logotype

Diff of /trunk/models/test/defaultmethods.a4c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1303 by johnpye, Mon Feb 26 06:47:08 2007 UTC revision 1304 by johnpye, Thu Mar 1 06:34:04 2007 UTC
# Line 285  METHODS Line 285  METHODS
285          ASSERT E.y == 8.0;          ASSERT E.y == 8.0;
286      END self_test;      END self_test;
287  END testdefault16;  END testdefault16;
288    
289    (* test with some tricky set notation (see following, related) *)
290    MODEL testdefault17;
291        nodes,head,tail IS_A set OF integer_constant;
292        x IS_A var_default_one;
293        n IS_A integer_constant;
294        n :== 3;
295        nodes :== [1..n];
296        head :== [1];
297        tail :== nodes - head;
298        y[1..n] IS_A var_default_two;
299        FOR i IN head CREATE
300            y_eq[i]: y[i] = x;
301        END FOR;
302        FOR i IN tail CREATE
303            y_eq2[i]: y[i] = y[i-1];
304        END FOR;
305    METHODS
306        METHOD self_test;
307            ASSERT x == 1.0;
308            ASSERT y[1] == 2.0;
309            ASSERT y[1] == 2.0;
310            ASSERT y[1] == 2.0;
311        END self_test;
312    END testdefault17;
313    
314    (* test with NULL children *)
315    MODEL testdefault18;
316        nodes,head,tail IS_A set OF integer_constant;
317        x IS_A var_default_one;
318        n IS_A integer_constant;
319        n :== 3;
320        nodes :== [1..n];
321        head :== [1,2,3];
322        tail :== nodes - head;
323        y[1..n] IS_A var_default_two;
324        FOR i IN head CREATE
325            y_eq[i]: y[i] = x;
326        END FOR;
327        FOR i IN tail CREATE (* empty list *)
328            y_eq2[i]: y[i] = y[i-1];
329        END FOR;
330    METHODS
331        METHOD self_test;
332            ASSERT x == 1.0;
333            ASSERT y[1] == 2.0;
334            ASSERT y[1] == 2.0;
335            ASSERT y[1] == 2.0;
336        END self_test;
337    END testdefault18;
338    
339        
340    
341    
342    

Legend:
Removed from v.1303  
changed lines
  Added in v.1304

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