-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmath_basic_tests.xml
90 lines (84 loc) · 2.58 KB
/
math_basic_tests.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<project name="math_basic_tests" basedir="." default="suite"
xmlns:a="antlib:ise.antelope.tasks">
<target name="test1">
<!-- 12 + 6 = 18 -->
<a:var name="op1" value="12"/>
<a:var name="op2" value="6"/>
<a:var name="op" value="+"/>
<a:math result="result" operand1="${op1}"
operation="${op}" operand2="${op2}" datatype="int"/>
<a:assert name="result" value="18" message="failed simple add via attributes"/>
</target>
<target name="test2">
<!-- (4 + 2) - 2 = 4 -->
<a:math result="a" datatype="int">
<a:op op="-">
<a:op op="+">
<a:num value="4"/>
<a:num value="2"/>
</a:op>
<a:num value="2"/>
</a:op>
</a:math>
<a:assert name="a" value="4" message="failed Matt's test case"/>
</target>
<target name="test3">
<!-- (4 + 2) - (2 + 2) = 2 -->
<a:math result="b" datatype="int">
<a:op op="-">
<a:op op="+">
<a:num value="4"/>
<a:num value="2"/>
</a:op>
<a:op op="+">
<a:num value="2"/>
<a:num value="2"/>
</a:op>
</a:op>
</a:math>
<a:assert name="b" value="2" message="failed additive grouping"/>
</target>
<target name="test4">
<!-- 2 - (4 + 2) = -4 -->
<a:math result="c" datatype="int">
<a:op op="-">
<a:num value="2"/>
<a:op op="+">
<a:num value="4"/>
<a:num value="2"/>
</a:op>
</a:op>
</a:math>
<a:assert name="c" value="-4" message="failed variation of Matt's test case"/>
</target>
<target name="test5">
<!-- variation of 4 + 2 = 6 -->
<a:math result="d" datatype="int">
<a:op op="+">
<a:num value="4"/>
<a:num value="2"/>
</a:op>
</a:math>
<a:assert name="d" value="6" message="failed simple add with nested op"/>
</target>
<target name="test6">
<!-- (4 + 2) * (2 + 2) = 24 -->
<a:math result="b" datatype="double">
<a:op op="*">
<a:op op="+">
<a:num value="4"/>
<a:num value="2"/>
</a:op>
<a:op op="+">
<a:num value="2"/>
<a:num value="2"/>
</a:op>
</a:op>
</a:math>
<a:assert message="failed multiplying additive groups">
<a:bool>
<a:mathequals arg1="${b}" arg2="24"/>
</a:bool>
</a:assert>
</target>
</project>