diff options
Diffstat (limited to 'Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra')
5 files changed, 539 insertions, 0 deletions
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/AdditionTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/AdditionTest.xtend new file mode 100644 index 00000000..de5f40e1 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/AdditionTest.xtend | |||
@@ -0,0 +1,49 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval | ||
4 | import java.util.Collection | ||
5 | import org.junit.Assert | ||
6 | import org.junit.Test | ||
7 | import org.junit.runner.RunWith | ||
8 | import org.junit.runners.Parameterized | ||
9 | import org.junit.runners.Parameterized.Parameter | ||
10 | import org.junit.runners.Parameterized.Parameters | ||
11 | |||
12 | import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.* | ||
13 | |||
14 | @RunWith(Parameterized) | ||
15 | class AdditionTest { | ||
16 | @Parameters(name = "{index}: {0} + {1} = {2}") | ||
17 | static def Collection<Object[]> data() { | ||
18 | #[ | ||
19 | #[EMPTY, EMPTY, EMPTY], | ||
20 | #[EMPTY, between(-1, 1), EMPTY], | ||
21 | #[between(-1, 1), EMPTY, EMPTY], | ||
22 | #[UNBOUNDED, UNBOUNDED, UNBOUNDED], | ||
23 | #[UNBOUNDED, upTo(2), UNBOUNDED], | ||
24 | #[UNBOUNDED, above(-2), UNBOUNDED], | ||
25 | #[UNBOUNDED, between(-1, 1), UNBOUNDED], | ||
26 | #[upTo(2), UNBOUNDED, UNBOUNDED], | ||
27 | #[upTo(2), upTo(1), upTo(3)], | ||
28 | #[upTo(2), above(-1), UNBOUNDED], | ||
29 | #[upTo(2), between(-1, 2), upTo(4)], | ||
30 | #[above(-2), UNBOUNDED, UNBOUNDED], | ||
31 | #[above(-2), upTo(1), UNBOUNDED], | ||
32 | #[above(-2), above(-1), above(-3)], | ||
33 | #[above(-2), between(-1, 2), above(-3)], | ||
34 | #[between(-2, 3), UNBOUNDED, UNBOUNDED], | ||
35 | #[between(-2, 3), upTo(1), upTo(4)], | ||
36 | #[between(-2, 3), above(-1), above(-3)], | ||
37 | #[between(-2, 3), between(-1, 2.5), between(-3, 5.5)] | ||
38 | ] | ||
39 | } | ||
40 | |||
41 | @Parameter(0) public var Interval a | ||
42 | @Parameter(1) public var Interval b | ||
43 | @Parameter(2) public var Interval result | ||
44 | |||
45 | @Test | ||
46 | def void additionTest() { | ||
47 | Assert.assertEquals(result, a + b) | ||
48 | } | ||
49 | } | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/DivisionTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/DivisionTest.xtend new file mode 100644 index 00000000..3a8c0c5d --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/DivisionTest.xtend | |||
@@ -0,0 +1,202 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval | ||
4 | import java.util.Collection | ||
5 | import org.junit.Assert | ||
6 | import org.junit.Test | ||
7 | import org.junit.runner.RunWith | ||
8 | import org.junit.runners.Parameterized | ||
9 | import org.junit.runners.Parameterized.Parameter | ||
10 | import org.junit.runners.Parameterized.Parameters | ||
11 | |||
12 | import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.* | ||
13 | |||
14 | @RunWith(Parameterized) | ||
15 | class DivisionTest { | ||
16 | @Parameters(name="{index}: {0} / {1} = {2}") | ||
17 | static def Collection<Object[]> data() { | ||
18 | #[ | ||
19 | #[EMPTY, EMPTY, EMPTY], | ||
20 | #[EMPTY, between(-1, 1), EMPTY], | ||
21 | #[between(-1, 1), EMPTY, EMPTY], | ||
22 | #[UNBOUNDED, UNBOUNDED, UNBOUNDED], | ||
23 | #[UNBOUNDED, upTo(-2), UNBOUNDED], | ||
24 | #[UNBOUNDED, upTo(0), UNBOUNDED], | ||
25 | #[UNBOUNDED, upTo(3), UNBOUNDED], | ||
26 | #[UNBOUNDED, above(-2), UNBOUNDED], | ||
27 | #[UNBOUNDED, above(0), UNBOUNDED], | ||
28 | #[UNBOUNDED, above(3), UNBOUNDED], | ||
29 | #[UNBOUNDED, between(-4, -3), UNBOUNDED], | ||
30 | #[UNBOUNDED, between(-4, 0), UNBOUNDED], | ||
31 | #[UNBOUNDED, between(-3, 4), UNBOUNDED], | ||
32 | #[UNBOUNDED, between(0, 4), UNBOUNDED], | ||
33 | #[UNBOUNDED, between(3, 4), UNBOUNDED], | ||
34 | #[UNBOUNDED, ZERO, EMPTY], | ||
35 | #[upTo(-12), UNBOUNDED, UNBOUNDED], | ||
36 | #[upTo(-12), upTo(-2), above(0)], | ||
37 | #[upTo(-12), upTo(0), above(0)], | ||
38 | #[upTo(-12), upTo(3), UNBOUNDED], | ||
39 | #[upTo(-12), above(-2), UNBOUNDED], | ||
40 | #[upTo(-12), above(0), upTo(0)], | ||
41 | #[upTo(-12), above(3), upTo(0)], | ||
42 | #[upTo(-12), between(-4, -3), above(3)], | ||
43 | #[upTo(-12), between(-4, 0), above(3)], | ||
44 | #[upTo(-12), between(-3, 4), UNBOUNDED], | ||
45 | #[upTo(-12), between(0, 4), upTo(-3)], | ||
46 | #[upTo(-12), between(3, 4), upTo(-3)], | ||
47 | #[upTo(-12), ZERO, EMPTY], | ||
48 | #[upTo(0), UNBOUNDED, UNBOUNDED], | ||
49 | #[upTo(0), upTo(-2), above(0)], | ||
50 | #[upTo(0), upTo(0), above(0)], | ||
51 | #[upTo(0), upTo(3), UNBOUNDED], | ||
52 | #[upTo(0), above(-2), UNBOUNDED], | ||
53 | #[upTo(0), above(0), upTo(0)], | ||
54 | #[upTo(0), above(3), upTo(0)], | ||
55 | #[upTo(0), between(-4, -3), above(0)], | ||
56 | #[upTo(0), between(-4, 0), above(0)], | ||
57 | #[upTo(0), between(-3, 4), UNBOUNDED], | ||
58 | #[upTo(0), between(0, 4), upTo(0)], | ||
59 | #[upTo(0), between(3, 4), upTo(0)], | ||
60 | #[upTo(0), ZERO, EMPTY], | ||
61 | #[upTo(12), UNBOUNDED, UNBOUNDED], | ||
62 | #[upTo(12), upTo(-2), above(-6)], | ||
63 | #[upTo(12), upTo(0), UNBOUNDED], | ||
64 | #[upTo(12), upTo(3), UNBOUNDED], | ||
65 | #[upTo(12), above(-2), UNBOUNDED], | ||
66 | #[upTo(12), above(0), UNBOUNDED], | ||
67 | #[upTo(12), above(3), upTo(4)], | ||
68 | #[upTo(12), between(-4, -3), above(-4)], | ||
69 | #[upTo(12), between(-4, 0), UNBOUNDED], | ||
70 | #[upTo(12), between(-3, 4), UNBOUNDED], | ||
71 | #[upTo(12), between(0, 4), UNBOUNDED], | ||
72 | #[upTo(12), between(3, 4), upTo(4)], | ||
73 | #[upTo(12), ZERO, EMPTY], | ||
74 | #[above(-12), UNBOUNDED, UNBOUNDED], | ||
75 | #[above(-12), upTo(-2), upTo(6)], | ||
76 | #[above(-12), upTo(0), UNBOUNDED], | ||
77 | #[above(-12), upTo(3), UNBOUNDED], | ||
78 | #[above(-12), above(-2), UNBOUNDED], | ||
79 | #[above(-12), above(0), UNBOUNDED], | ||
80 | #[above(-12), above(3), above(-4)], | ||
81 | #[above(-12), between(-4, -3), upTo(4)], | ||
82 | #[above(-12), between(-4, 0), UNBOUNDED], | ||
83 | #[above(-12), between(-3, 4), UNBOUNDED], | ||
84 | #[above(-12), between(0, 4), UNBOUNDED], | ||
85 | #[above(-12), between(3, 4), above(-4)], | ||
86 | #[above(-12), ZERO, EMPTY], | ||
87 | #[above(0), UNBOUNDED, UNBOUNDED], | ||
88 | #[above(0), upTo(-2), upTo(0)], | ||
89 | #[above(0), upTo(0), upTo(0)], | ||
90 | #[above(0), upTo(3), UNBOUNDED], | ||
91 | #[above(0), above(-2), UNBOUNDED], | ||
92 | #[above(0), above(0), above(0)], | ||
93 | #[above(0), above(3), above(0)], | ||
94 | #[above(0), between(-4, -3), upTo(0)], | ||
95 | #[above(0), between(-4, 0), upTo(0)], | ||
96 | #[above(0), between(-3, 4), UNBOUNDED], | ||
97 | #[above(0), between(0, 4), above(0)], | ||
98 | #[above(0), between(3, 4), above(0)], | ||
99 | #[above(0), ZERO, EMPTY], | ||
100 | #[above(12), UNBOUNDED, UNBOUNDED], | ||
101 | #[above(12), upTo(-2), upTo(0)], | ||
102 | #[above(12), upTo(0), upTo(0)], | ||
103 | #[above(12), upTo(3), UNBOUNDED], | ||
104 | #[above(12), above(-2), UNBOUNDED], | ||
105 | #[above(12), above(0), above(0)], | ||
106 | #[above(12), above(3), above(0)], | ||
107 | #[above(12), between(-4, -3), upTo(-3)], | ||
108 | #[above(12), between(-4, 0), upTo(-3)], | ||
109 | #[above(12), between(-3, 4), UNBOUNDED], | ||
110 | #[above(12), between(0, 4), above(3)], | ||
111 | #[above(12), between(3, 4), above(3)], | ||
112 | #[above(12), ZERO, EMPTY], | ||
113 | #[between(-36, -12), UNBOUNDED, UNBOUNDED], | ||
114 | #[between(-36, -12), upTo(-2), between(0, 18)], | ||
115 | #[between(-36, -12), upTo(0), above(0)], | ||
116 | #[between(-36, -12), upTo(3), UNBOUNDED], | ||
117 | #[between(-36, -12), above(-2), UNBOUNDED], | ||
118 | #[between(-36, -12), above(0), upTo(0)], | ||
119 | #[between(-36, -12), above(3), between(-12, 0)], | ||
120 | #[between(-36, -12), between(-4, -3), between(3, 12)], | ||
121 | #[between(-36, -12), between(-4, 0), above(3)], | ||
122 | #[between(-36, -12), between(-3, 4), UNBOUNDED], | ||
123 | #[between(-36, -12), between(0, 4), upTo(-3)], | ||
124 | #[between(-36, -12), between(3, 4), between(-12, -3)], | ||
125 | #[between(-36, -12), ZERO, EMPTY], | ||
126 | #[between(-36, 0), UNBOUNDED, UNBOUNDED], | ||
127 | #[between(-36, 0), upTo(-2), between(0, 18)], | ||
128 | #[between(-36, 0), upTo(0), above(0)], | ||
129 | #[between(-36, 0), upTo(3), UNBOUNDED], | ||
130 | #[between(-36, 0), above(-2), UNBOUNDED], | ||
131 | #[between(-36, 0), above(0), upTo(0)], | ||
132 | #[between(-36, 0), above(3), between(-12, 0)], | ||
133 | #[between(-36, 0), between(-4, -3), between(0, 12)], | ||
134 | #[between(-36, 0), between(-4, 0), above(0)], | ||
135 | #[between(-36, 0), between(-3, 4), UNBOUNDED], | ||
136 | #[between(-36, 0), between(0, 4), upTo(0)], | ||
137 | #[between(-36, 0), between(3, 4), between(-12, 0)], | ||
138 | #[between(-36, 0), ZERO, EMPTY], | ||
139 | #[between(-12, 36), UNBOUNDED, UNBOUNDED], | ||
140 | #[between(-12, 36), upTo(-2), between(-18, 6)], | ||
141 | #[between(-12, 36), upTo(0), UNBOUNDED], | ||
142 | #[between(-12, 36), upTo(3), UNBOUNDED], | ||
143 | #[between(-12, 36), above(-2), UNBOUNDED], | ||
144 | #[between(-12, 36), above(0), UNBOUNDED], | ||
145 | #[between(-12, 36), above(3), between(-4, 12)], | ||
146 | #[between(-12, 36), between(-4, -3), between(-12, 4)], | ||
147 | #[between(-12, 36), between(-4, 0), UNBOUNDED], | ||
148 | #[between(-12, 36), between(-3, 4), UNBOUNDED], | ||
149 | #[between(-12, 36), between(0, 4), UNBOUNDED], | ||
150 | #[between(-12, 36), between(3, 4), between(-4, 12)], | ||
151 | #[between(-12, 36), ZERO, EMPTY], | ||
152 | #[between(0, 36), UNBOUNDED, UNBOUNDED], | ||
153 | #[between(0, 36), upTo(-2), between(-18, 0)], | ||
154 | #[between(0, 36), upTo(0), upTo(0)], | ||
155 | #[between(0, 36), upTo(3), UNBOUNDED], | ||
156 | #[between(0, 36), above(-2), UNBOUNDED], | ||
157 | #[between(0, 36), above(0), above(0)], | ||
158 | #[between(0, 36), above(3), between(0, 12)], | ||
159 | #[between(0, 36), between(-4, -3), between(-12, 0)], | ||
160 | #[between(0, 36), between(-4, 0), upTo(0)], | ||
161 | #[between(0, 36), between(-3, 4), UNBOUNDED], | ||
162 | #[between(0, 36), between(0, 4), above(0)], | ||
163 | #[between(0, 36), between(3, 4), between(0, 12)], | ||
164 | #[between(0, 36), ZERO, EMPTY], | ||
165 | #[between(12, 36), UNBOUNDED, UNBOUNDED], | ||
166 | #[between(12, 36), upTo(-2), between(-18, 0)], | ||
167 | #[between(12, 36), upTo(0), upTo(0)], | ||
168 | #[between(12, 36), upTo(3), UNBOUNDED], | ||
169 | #[between(12, 36), above(-2), UNBOUNDED], | ||
170 | #[between(12, 36), above(0), above(0)], | ||
171 | #[between(12, 36), above(3), between(0, 12)], | ||
172 | #[between(12, 36), between(-4, -3), between(-12, -3)], | ||
173 | #[between(12, 36), between(-4, 0), upTo(-3)], | ||
174 | #[between(12, 36), between(-3, 4), UNBOUNDED], | ||
175 | #[between(12, 36), between(0, 4), above(3)], | ||
176 | #[between(12, 36), between(3, 4), between(3, 12)], | ||
177 | #[between(12, 36), ZERO, EMPTY], | ||
178 | #[ZERO, UNBOUNDED, ZERO], | ||
179 | #[ZERO, upTo(-2), ZERO], | ||
180 | #[ZERO, upTo(0), ZERO], | ||
181 | #[ZERO, upTo(3), ZERO], | ||
182 | #[ZERO, above(-2), ZERO], | ||
183 | #[ZERO, above(0), ZERO], | ||
184 | #[ZERO, above(3), ZERO], | ||
185 | #[ZERO, between(-4, -3), ZERO], | ||
186 | #[ZERO, between(-4, 0), ZERO], | ||
187 | #[ZERO, between(-3, 4), ZERO], | ||
188 | #[ZERO, between(0, 4), ZERO], | ||
189 | #[ZERO, between(3, 4), ZERO], | ||
190 | #[ZERO, ZERO, EMPTY] | ||
191 | ] | ||
192 | } | ||
193 | |||
194 | @Parameter(0) public var Interval a | ||
195 | @Parameter(1) public var Interval b | ||
196 | @Parameter(2) public var Interval result | ||
197 | |||
198 | @Test | ||
199 | def void divisionTest() { | ||
200 | Assert.assertEquals(result, a / b) | ||
201 | } | ||
202 | } | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/MultiplicationTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/MultiplicationTest.xtend new file mode 100644 index 00000000..5f997094 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/MultiplicationTest.xtend | |||
@@ -0,0 +1,205 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval | ||
4 | import java.util.Collection | ||
5 | import org.junit.Assert | ||
6 | import org.junit.Test | ||
7 | import org.junit.runner.RunWith | ||
8 | import org.junit.runners.Parameterized | ||
9 | import org.junit.runners.Parameterized.Parameter | ||
10 | import org.junit.runners.Parameterized.Parameters | ||
11 | |||
12 | import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.* | ||
13 | |||
14 | @RunWith(Parameterized) | ||
15 | class MultiplicationTest { | ||
16 | @Parameters(name="{index}: {0} * {1} = {2}") | ||
17 | static def Collection<Object[]> data() { | ||
18 | #[ | ||
19 | #[EMPTY, EMPTY, EMPTY], | ||
20 | #[EMPTY, between(-1, 1), EMPTY], | ||
21 | #[between(-1, 1), EMPTY, EMPTY], | ||
22 | #[UNBOUNDED, UNBOUNDED, UNBOUNDED], | ||
23 | #[UNBOUNDED, upTo(-2), UNBOUNDED], | ||
24 | #[UNBOUNDED, upTo(0), UNBOUNDED], | ||
25 | #[UNBOUNDED, upTo(3), UNBOUNDED], | ||
26 | #[UNBOUNDED, above(-2), UNBOUNDED], | ||
27 | #[UNBOUNDED, above(0), UNBOUNDED], | ||
28 | #[UNBOUNDED, above(3), UNBOUNDED], | ||
29 | #[UNBOUNDED, between(-4, -3), UNBOUNDED], | ||
30 | #[UNBOUNDED, between(-4, 0), UNBOUNDED], | ||
31 | #[UNBOUNDED, between(-3, 4), UNBOUNDED], | ||
32 | #[UNBOUNDED, between(0, 4), UNBOUNDED], | ||
33 | #[UNBOUNDED, between(3, 4), UNBOUNDED], | ||
34 | #[UNBOUNDED, ZERO, ZERO], | ||
35 | #[upTo(-5), UNBOUNDED, UNBOUNDED], | ||
36 | #[upTo(-5), upTo(-2), above(10)], | ||
37 | #[upTo(-5), upTo(0), above(0)], | ||
38 | #[upTo(-5), upTo(3), UNBOUNDED], | ||
39 | #[upTo(-5), above(-2), UNBOUNDED], | ||
40 | #[upTo(-5), above(0), upTo(0)], | ||
41 | #[upTo(-5), above(3), upTo(-15)], | ||
42 | #[upTo(-5), between(-4, -3), above(15)], | ||
43 | #[upTo(-5), between(-4, 0), above(0)], | ||
44 | #[upTo(-5), between(-3, 4), UNBOUNDED], | ||
45 | #[upTo(-5), between(0, 4), upTo(0)], | ||
46 | #[upTo(-5), between(3, 4), upTo(-15)], | ||
47 | #[upTo(-5), ZERO, ZERO], | ||
48 | #[upTo(0), UNBOUNDED, UNBOUNDED], | ||
49 | #[upTo(0), upTo(-2), above(0)], | ||
50 | #[upTo(0), upTo(0), above(0)], | ||
51 | #[upTo(0), upTo(3), UNBOUNDED], | ||
52 | #[upTo(0), above(-2), UNBOUNDED], | ||
53 | #[upTo(0), above(0), upTo(0)], | ||
54 | #[upTo(0), above(3), upTo(0)], | ||
55 | #[upTo(0), between(-4, -3), above(0)], | ||
56 | #[upTo(0), between(-4, 0), above(0)], | ||
57 | #[upTo(0), between(-3, 4), UNBOUNDED], | ||
58 | #[upTo(0), between(0, 4), upTo(0)], | ||
59 | #[upTo(0), between(3, 4), upTo(0)], | ||
60 | #[upTo(0), ZERO, ZERO], | ||
61 | #[upTo(5), UNBOUNDED, UNBOUNDED], | ||
62 | #[upTo(5), upTo(-2), UNBOUNDED], | ||
63 | #[upTo(5), upTo(0), UNBOUNDED], | ||
64 | #[upTo(5), upTo(3), UNBOUNDED], | ||
65 | #[upTo(5), above(-2), UNBOUNDED], | ||
66 | #[upTo(5), above(0), UNBOUNDED], | ||
67 | #[upTo(5), above(3), UNBOUNDED], | ||
68 | #[upTo(5), between(-4, -3), above(-20)], | ||
69 | #[upTo(5), between(-4, 0), above(-20)], | ||
70 | #[upTo(5), between(-3, 4), UNBOUNDED], | ||
71 | #[upTo(5), between(0, 4), upTo(20)], | ||
72 | #[upTo(5), between(3, 4), upTo(20)], | ||
73 | #[upTo(5), ZERO, ZERO], | ||
74 | #[above(-5), UNBOUNDED, UNBOUNDED], | ||
75 | #[above(-5), upTo(-2), UNBOUNDED], | ||
76 | #[above(-5), upTo(0), UNBOUNDED], | ||
77 | #[above(-5), upTo(3), UNBOUNDED], | ||
78 | #[above(-5), above(-2), UNBOUNDED], | ||
79 | #[above(-5), above(0), UNBOUNDED], | ||
80 | #[above(-5), above(3), UNBOUNDED], | ||
81 | #[above(-5), between(-4, -3), upTo(20)], | ||
82 | #[above(-5), between(-4, 0), upTo(20)], | ||
83 | #[above(-5), between(-3, 4), UNBOUNDED], | ||
84 | #[above(-5), between(0, 4), above(-20)], | ||
85 | #[above(-5), between(3, 4), above(-20)], | ||
86 | #[above(-5), ZERO, ZERO], | ||
87 | #[above(0), UNBOUNDED, UNBOUNDED], | ||
88 | #[above(0), upTo(-2), upTo(0)], | ||
89 | #[above(0), upTo(0), upTo(0)], | ||
90 | #[above(0), upTo(3), UNBOUNDED], | ||
91 | #[above(0), above(-2), UNBOUNDED], | ||
92 | #[above(0), above(0), above(0)], | ||
93 | #[above(0), above(3), above(0)], | ||
94 | #[above(0), between(-4, -3), upTo(0)], | ||
95 | #[above(0), between(-4, 0), upTo(0)], | ||
96 | #[above(0), between(-3, 4), UNBOUNDED], | ||
97 | #[above(0), between(0, 4), above(0)], | ||
98 | #[above(0), between(3, 4), above(0)], | ||
99 | #[above(0), ZERO, ZERO], | ||
100 | #[above(5), UNBOUNDED, UNBOUNDED], | ||
101 | #[above(5), upTo(-2), upTo(-10)], | ||
102 | #[above(5), upTo(0), upTo(0)], | ||
103 | #[above(5), upTo(3), UNBOUNDED], | ||
104 | #[above(5), above(-2), UNBOUNDED], | ||
105 | #[above(5), above(0), above(0)], | ||
106 | #[above(5), above(3), above(15)], | ||
107 | #[above(5), between(-4, -3), upTo(-15)], | ||
108 | #[above(5), between(-4, 0), upTo(0)], | ||
109 | #[above(5), between(-3, 4), UNBOUNDED], | ||
110 | #[above(5), between(0, 4), above(0)], | ||
111 | #[above(5), between(3, 4), above(15)], | ||
112 | #[above(5), ZERO, ZERO], | ||
113 | #[between(-6, -5), UNBOUNDED, UNBOUNDED], | ||
114 | #[between(-6, -5), upTo(-2), above(10)], | ||
115 | #[between(-6, -5), upTo(0), above(0)], | ||
116 | #[between(-6, -5), upTo(3), above(-18)], | ||
117 | #[between(-6, -5), above(-2), upTo(12)], | ||
118 | #[between(-6, -5), above(0), upTo(0)], | ||
119 | #[between(-6, -5), above(3), upTo(-15)], | ||
120 | #[between(-6, -5), between(-4, -3), between(15, 24)], | ||
121 | #[between(-6, -5), between(-4, 0), between(0, 24)], | ||
122 | #[between(-6, -5), between(-3, 4), between(-24, 18)], | ||
123 | #[between(-6, -5), between(0, 4), between(-24, 0)], | ||
124 | #[between(-6, -5), between(3, 4), between(-24, -15)], | ||
125 | #[between(-6, -5), ZERO, ZERO], | ||
126 | #[between(-6, 0), UNBOUNDED, UNBOUNDED], | ||
127 | #[between(-6, 0), upTo(-2), above(0)], | ||
128 | #[between(-6, 0), upTo(0), above(0)], | ||
129 | #[between(-6, 0), upTo(3), above(-18)], | ||
130 | #[between(-6, 0), above(-2), upTo(12)], | ||
131 | #[between(-6, 0), above(0), upTo(0)], | ||
132 | #[between(-6, 0), above(3), upTo(0)], | ||
133 | #[between(-6, 0), between(-4, -3), between(0, 24)], | ||
134 | #[between(-6, 0), between(-4, 0), between(0, 24)], | ||
135 | #[between(-6, 0), between(-3, 4), between(-24, 18)], | ||
136 | #[between(-6, 0), between(0, 4), between(-24, 0)], | ||
137 | #[between(-6, 0), between(3, 4), between(-24, 0)], | ||
138 | #[between(-6, 0), ZERO, ZERO], | ||
139 | #[between(-5, 6), UNBOUNDED, UNBOUNDED], | ||
140 | #[between(-5, 6), upTo(-2), UNBOUNDED], | ||
141 | #[between(-5, 6), upTo(0), UNBOUNDED], | ||
142 | #[between(-5, 6), upTo(3), UNBOUNDED], | ||
143 | #[between(-5, 6), above(-2), UNBOUNDED], | ||
144 | #[between(-5, 6), above(0), UNBOUNDED], | ||
145 | #[between(-5, 6), above(3), UNBOUNDED], | ||
146 | #[between(-5, 6), between(-4, -3), between(-24, 20)], | ||
147 | #[between(-5, 6), between(-4, 0), between(-24, 20)], | ||
148 | #[between(-5, 6), between(-3, 4), between(-20, 24)], | ||
149 | #[between(-5, 6), between(-3, 2), between(-18, 15)], | ||
150 | #[between(-5, 1), between(-3, 4), between(-20, 15)], | ||
151 | #[between(-5, 1), between(-3, 2), between(-10, 15)], | ||
152 | #[between(-5, 6), between(0, 4), between(-20, 24)], | ||
153 | #[between(-5, 6), between(3, 4), between(-20, 24)], | ||
154 | #[between(-5, 6), ZERO, ZERO], | ||
155 | #[between(0, 6), UNBOUNDED, UNBOUNDED], | ||
156 | #[between(0, 6), upTo(-2), upTo(0)], | ||
157 | #[between(0, 6), upTo(0), upTo(0)], | ||
158 | #[between(0, 6), upTo(3), upTo(18)], | ||
159 | #[between(0, 6), above(-2), above(-12)], | ||
160 | #[between(0, 6), above(0), above(0)], | ||
161 | #[between(0, 6), above(3), above(0)], | ||
162 | #[between(0, 6), between(-4, -3), between(-24, 0)], | ||
163 | #[between(0, 6), between(-4, 0), between(-24, 0)], | ||
164 | #[between(0, 6), between(-3, 4), between(-18, 24)], | ||
165 | #[between(0, 6), between(0, 4), between(0, 24)], | ||
166 | #[between(0, 6), between(3, 4), between(0, 24)], | ||
167 | #[between(0, 6), ZERO, ZERO], | ||
168 | #[between(5, 6), UNBOUNDED, UNBOUNDED], | ||
169 | #[between(5, 6), upTo(-2), upTo(-10)], | ||
170 | #[between(5, 6), upTo(0), upTo(0)], | ||
171 | #[between(5, 6), upTo(3), upTo(18)], | ||
172 | #[between(5, 6), above(-2), above(-12)], | ||
173 | #[between(5, 6), above(0), above(0)], | ||
174 | #[between(5, 6), above(3), above(15)], | ||
175 | #[between(5, 6), between(-4, -3), between(-24, -15)], | ||
176 | #[between(5, 6), between(-4, 0), between(-24, 0)], | ||
177 | #[between(5, 6), between(-3, 4), between(-18, 24)], | ||
178 | #[between(5, 6), between(0, 4), between(0, 24)], | ||
179 | #[between(5, 6), between(3, 4), between(15, 24)], | ||
180 | #[between(5, 6), ZERO, ZERO], | ||
181 | #[ZERO, UNBOUNDED, ZERO], | ||
182 | #[ZERO, upTo(-2), ZERO], | ||
183 | #[ZERO, upTo(0), ZERO], | ||
184 | #[ZERO, upTo(3), ZERO], | ||
185 | #[ZERO, above(-2), ZERO], | ||
186 | #[ZERO, above(0), ZERO], | ||
187 | #[ZERO, above(3), ZERO], | ||
188 | #[ZERO, between(-4, -3), ZERO], | ||
189 | #[ZERO, between(-4, 0), ZERO], | ||
190 | #[ZERO, between(-3, 4), ZERO], | ||
191 | #[ZERO, between(0, 4), ZERO], | ||
192 | #[ZERO, between(3, 4), ZERO], | ||
193 | #[ZERO, ZERO, ZERO] | ||
194 | ] | ||
195 | } | ||
196 | |||
197 | @Parameter(0) public var Interval a | ||
198 | @Parameter(1) public var Interval b | ||
199 | @Parameter(2) public var Interval result | ||
200 | |||
201 | @Test | ||
202 | def void multiplicatonTest() { | ||
203 | Assert.assertEquals(result, a * b) | ||
204 | } | ||
205 | } | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/NegationTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/NegationTest.xtend new file mode 100644 index 00000000..477e925e --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/NegationTest.xtend | |||
@@ -0,0 +1,34 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval | ||
4 | import java.util.Collection | ||
5 | import org.junit.Assert | ||
6 | import org.junit.Test | ||
7 | import org.junit.runner.RunWith | ||
8 | import org.junit.runners.Parameterized | ||
9 | import org.junit.runners.Parameterized.Parameter | ||
10 | import org.junit.runners.Parameterized.Parameters | ||
11 | |||
12 | import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.* | ||
13 | |||
14 | @RunWith(Parameterized) | ||
15 | class NegationTest { | ||
16 | @Parameters(name = "{index}: -{0} = {1}") | ||
17 | static def Collection<Object[]> data() { | ||
18 | #[ | ||
19 | #[EMPTY, EMPTY], | ||
20 | #[UNBOUNDED, UNBOUNDED], | ||
21 | #[upTo(1), above(-1)], | ||
22 | #[above(1), upTo(-1)], | ||
23 | #[between(2, 3), between(-3, -2)] | ||
24 | ] | ||
25 | } | ||
26 | |||
27 | @Parameter(0) public var Interval a | ||
28 | @Parameter(1) public var Interval result | ||
29 | |||
30 | @Test | ||
31 | def void negationTest() { | ||
32 | Assert.assertEquals(result, -a) | ||
33 | } | ||
34 | } | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/SubtractionTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/SubtractionTest.xtend new file mode 100644 index 00000000..30709a9e --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/interval/SubtractionTest.xtend | |||
@@ -0,0 +1,49 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests.interval | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval | ||
4 | import java.util.Collection | ||
5 | import org.junit.Assert | ||
6 | import org.junit.Test | ||
7 | import org.junit.runner.RunWith | ||
8 | import org.junit.runners.Parameterized | ||
9 | import org.junit.runners.Parameterized.Parameter | ||
10 | import org.junit.runners.Parameterized.Parameters | ||
11 | |||
12 | import static hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval.* | ||
13 | |||
14 | @RunWith(Parameterized) | ||
15 | class SubtractionTest { | ||
16 | @Parameters(name = "{index}: {0} - {1} = {2}") | ||
17 | static def Collection<Object[]> data() { | ||
18 | #[ | ||
19 | #[EMPTY, EMPTY, EMPTY], | ||
20 | #[EMPTY, between(-1, 1), EMPTY], | ||
21 | #[between(-1, 1), EMPTY, EMPTY], | ||
22 | #[UNBOUNDED, UNBOUNDED, UNBOUNDED], | ||
23 | #[UNBOUNDED, upTo(2), UNBOUNDED], | ||
24 | #[UNBOUNDED, above(-2), UNBOUNDED], | ||
25 | #[UNBOUNDED, between(-1, 1), UNBOUNDED], | ||
26 | #[upTo(2), UNBOUNDED, UNBOUNDED], | ||
27 | #[upTo(2), upTo(1), UNBOUNDED], | ||
28 | #[upTo(2), above(-1), upTo(3)], | ||
29 | #[upTo(2), between(-1, 2), upTo(3)], | ||
30 | #[above(-2), UNBOUNDED, UNBOUNDED], | ||
31 | #[above(-2), upTo(1), above(-3)], | ||
32 | #[above(-2), above(-1), UNBOUNDED], | ||
33 | #[above(-2), between(-1, 2), above(-4)], | ||
34 | #[between(-2, 3), UNBOUNDED, UNBOUNDED], | ||
35 | #[between(-2, 3), upTo(1), above(-3)], | ||
36 | #[between(-2, 3), above(-1), upTo(4)], | ||
37 | #[between(-2, 3), between(-1, 2.5), between(-4.5, 4)] | ||
38 | ] | ||
39 | } | ||
40 | |||
41 | @Parameter(0) public var Interval a | ||
42 | @Parameter(1) public var Interval b | ||
43 | @Parameter(2) public var Interval result | ||
44 | |||
45 | @Test | ||
46 | def void subtractionTest() { | ||
47 | Assert.assertEquals(result, a - b) | ||
48 | } | ||
49 | } | ||