1 | :- multifile generate/2. | |
2 | :- multifile shrink/3. | |
3 | ||
4 | % any expression | |
5 | generate(prob_ast_expr(Option),Value) :- | |
6 | random_member(Type,[prob_ast_set_expr(Option),prob_ast_int_expr(Option),prob_ast_seq_expr(Option)]), | |
7 | generate(Type,Value). | |
8 | ||
9 | % differenciate between record, integer, set or sequence expression | |
10 | shrink(Type,Value,Shrunken) :- | |
11 | Type =.. [prob_ast_expr|_] , | |
12 | Value = b(_,record(_),_) , | |
13 | shrink(prob_ast_record,Value,Shrunken). | |
14 | ||
15 | shrink(Type,Value,Shrunken) :- | |
16 | Type =.. [prob_ast_expr|_] , | |
17 | Value = b(_,set(_),_) , | |
18 | shrink(prob_ast_set_expr,Value,Shrunken). | |
19 | ||
20 | shrink(Type,Value,Shrunken) :- | |
21 | Type =.. [prob_ast_expr|_] , | |
22 | Value = b(_,seq(_),_) , | |
23 | shrink(prob_ast_seq_expr,Value,Shrunken). | |
24 | ||
25 | shrink(Type,Value,Shrunken) :- | |
26 | Type =.. [prob_ast_expr|_] , | |
27 | Value = b(_,integer,_) , | |
28 | shrink(prob_ast_int_expr,Value,Shrunken). |