Skip to content

Commit 96eb620

Browse files
splitting tests
1 parent 65ed99d commit 96eb620

4 files changed

Lines changed: 989 additions & 273 deletions

File tree

SMT-Extension/src/main/java/edu/uiowa/alloy2smt/utils/AlloyUtils.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,8 @@ public synchronized static CommandResult runAlloyFile(String fileName, boolean i
4141
Translation translation = Utils.translateFromFile(fileName, alloySettings);
4242
Cvc4Task task = new Cvc4Task();
4343
CommandResult result = task.run(translation, includeScope, commandIndex);
44-
/*
45-
id_lock.acquire()
46-
app.unique_id = app.unique_id + 1
47-
app.robots_dictionary[app.unique_id] = None
48-
client_directory = app.upload_directory + '/' + str(app.unique_id)
49-
if not os.path.exists(client_directory):
50-
os.makedirs(client_directory)
51-
id_lock.release()
52-
return jsonify({'id': app.unique_id})
53-
*/
54-
int index = 0;
55-
String smtFile = fileName.replace(".als", "") + "_" + index + "_" + result.satResult + ".smt2";
56-
while (Files.exists(Paths.get(smtFile)))
57-
{
58-
index++;
59-
smtFile = fileName.replace(".als", "") + "_" + index + "_" + result.satResult + ".smt2";
60-
}
44+
45+
String smtFile = fileName.replace(".als", "") + "_" + commandIndex + "_" + result.satResult + ".smt2";
6146

6247
try (Formatter formatter = new Formatter(smtFile))
6348
{
Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
package ordering.models;
2+
3+
import static org.junit.Assert.*;
4+
import org.junit.Test;
5+
import org.junit.Ignore;
6+
import org.junit.Before;
7+
8+
import edu.uiowa.alloy2smt.utils.AlloyUtils;
9+
import edu.uiowa.alloy2smt.utils.CommandResult;
10+
11+
12+
public class BookExamplesTests
13+
{
14+
15+
@Test
16+
public void addressBook3a() throws Exception
17+
{
18+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3a.als", true, 0);
19+
assertEquals("sat", result.satResult);
20+
}
21+
22+
@Test
23+
public void addressBook3b0() throws Exception
24+
{
25+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3b.als", true, 0);
26+
assertEquals("unsat", result.satResult);
27+
}
28+
29+
@Test
30+
public void addressBook3b1() throws Exception
31+
{
32+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3b.als", true, 1);
33+
assertEquals("unsat", result.satResult);
34+
}
35+
36+
37+
@Test
38+
public void addressBook3b2() throws Exception
39+
{
40+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3b.als", true, 2);
41+
assertEquals("unsat", result.satResult);
42+
}
43+
44+
45+
@Test
46+
public void addressBook3b3() throws Exception
47+
{
48+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3b.als", true, 3);
49+
assertEquals("sat", result.satResult);
50+
}
51+
52+
@Test
53+
public void addressBook3c0() throws Exception
54+
{
55+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3c.als", true, 0);
56+
assertEquals("unsat", result.satResult);
57+
}
58+
59+
@Test
60+
public void addressBook3c1() throws Exception
61+
{
62+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3c.als", true, 1);
63+
assertEquals("unsat", result.satResult);
64+
}
65+
66+
@Test
67+
public void addressBook3c2() throws Exception
68+
{
69+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3c.als", true, 2);
70+
assertEquals("unsat", result.satResult);
71+
}
72+
73+
@Test
74+
public void addressBook3c3() throws Exception
75+
{
76+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3c.als", true, 3);
77+
assertEquals("sat", result.satResult);
78+
}
79+
80+
@Test
81+
public void addressBook3d0() throws Exception
82+
{
83+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3d.als", true, 0);
84+
assertEquals("unsat", result.satResult);
85+
}
86+
87+
@Test
88+
public void addressBook3d1() throws Exception
89+
{
90+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3d.als", true, 1);
91+
assertEquals("unsat", result.satResult);
92+
}
93+
94+
@Test
95+
public void addressBook3d2() throws Exception
96+
{
97+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3d.als", true, 2);
98+
assertEquals("unsat", result.satResult);
99+
}
100+
101+
@Test
102+
public void addressBook3d3() throws Exception
103+
{
104+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3d.als", true, 3);
105+
assertEquals("unsat", result.satResult);
106+
}
107+
108+
@Test
109+
public void addressBook3d4() throws Exception
110+
{
111+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter2/addressBook3d.als", true, 4);
112+
assertEquals("unsat", result.satResult);
113+
}
114+
115+
@Test
116+
public void hotel1() throws Exception
117+
{
118+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/hotel1.als", true, 0);
119+
assertEquals("sat", result.satResult);
120+
}
121+
122+
@Test
123+
public void hotel2_0() throws Exception
124+
{
125+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/hotel2.als", true, 0);
126+
assertEquals("unsat", result.satResult);
127+
}
128+
129+
130+
@Test
131+
public void hotel2_1() throws Exception
132+
{
133+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/hotel2.als", true, 1);
134+
assertEquals("unsat", result.satResult);
135+
}
136+
137+
138+
@Test
139+
public void hotel2_2() throws Exception
140+
{
141+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/hotel2.als", true, 2);
142+
assertEquals("unsat", result.satResult);
143+
}
144+
145+
@Test
146+
public void hotel3() throws Exception
147+
{
148+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/hotel3.als", true, 0);
149+
150+
assertEquals("sat", result.satResult);
151+
152+
}
153+
154+
@Test
155+
public void hotel4() throws Exception
156+
{
157+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/hotel4.als", true, 0);
158+
159+
assertEquals("unsat", result.satResult);
160+
}
161+
162+
@Test
163+
public void ringElection1_0() throws Exception
164+
{
165+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/ringElection1.als", true, 0);
166+
assertEquals("sat", result.satResult);
167+
}
168+
169+
@Test
170+
public void ringElection1_1() throws Exception
171+
{
172+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/ringElection1.als", true, 1);
173+
assertEquals("unsat", result.satResult);
174+
}
175+
176+
@Test
177+
public void ringElection1_2() throws Exception
178+
{
179+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/ringElection1.als", true, 2);
180+
assertEquals("sat", result.satResult);
181+
}
182+
183+
@Test
184+
public void ringElection_0() throws Exception
185+
{
186+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/ringElection2.als", true, 0);
187+
188+
assertEquals("sat", result.satResult);
189+
}
190+
191+
@Test
192+
public void ringElection_1() throws Exception
193+
{
194+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/ringElection2.als", true, 1);
195+
196+
assertEquals("unsat", result.satResult);
197+
}
198+
199+
@Test
200+
public void ringElection_2() throws Exception
201+
{
202+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/ringElection2.als", true, 2);
203+
204+
assertEquals("unsat", result.satResult);
205+
}
206+
207+
208+
@Test
209+
public void ringElection_3() throws Exception
210+
{
211+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/ringElection2.als", true, 3);
212+
213+
assertEquals("sat", result.satResult);
214+
}
215+
216+
@Test
217+
public void ringElection_4() throws Exception
218+
{
219+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/chapter6/ringElection2.als", true, 4);
220+
221+
assertEquals("unsat", result.satResult);
222+
}
223+
224+
225+
@Test
226+
public void p300_hotel() throws Exception
227+
{
228+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/appendixE/p300-hotel.als", true, 0);
229+
assertEquals("sat", result.satResult);
230+
}
231+
232+
@Test
233+
public void p303_hotel_0() throws Exception
234+
{
235+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/appendixE/p303-hotel.als", true, 0);
236+
assertEquals("unsat", result.satResult);
237+
}
238+
239+
@Test
240+
public void p303_hotel_1() throws Exception
241+
{
242+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/appendixE/p303-hotel.als", true, 1);
243+
assertEquals("sat", result.satResult);
244+
}
245+
246+
@Test
247+
public void p306_hotel_0() throws Exception
248+
{
249+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/appendixE/p306-hotel.als", true, 0);
250+
assertEquals("unsat", result.satResult);
251+
}
252+
253+
@Test
254+
public void p306_hotel_1() throws Exception
255+
{
256+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/appendixE/p306-hotel.als", true, 1);
257+
assertEquals("unsat", result.satResult);
258+
}
259+
260+
@Test
261+
public void p306_hotel_2() throws Exception
262+
{
263+
CommandResult result = AlloyUtils.runAlloyFile("../org.alloytools.alloy.extra/extra/models/book/appendixE/p306-hotel.als", true, 2);
264+
assertEquals("unsat", result.satResult);
265+
}
266+
}

0 commit comments

Comments
 (0)