Commit 00744e3c authored by Fred Eisele's avatar Fred Eisele
Browse files

activate the tests that fail

parent 27131db7
......@@ -42,7 +42,7 @@ public class Examples {
continue;
}
for (Language l : Language.values()) {
if (dir.getName().equals(l.fileExtension())) {
if (dir.getName().equals(l.filePath())) {
for (File ex : dir.listFiles()) {
if (ex.isHidden()) {
continue;
......@@ -135,7 +135,7 @@ public class Examples {
try (FileSystem fileSystem = FileSystems.newFileSystem(uri, Collections.emptyMap())) {
for (Language l : Language.values()) {
List<Example> list = examples2.get(l);
Path myPath = fileSystem.getPath("examples/" + l.fileExtension() + "/");
Path myPath = fileSystem.getPath("examples/" + l.filePath() + "/");
try (Stream<Path> walk = Files.walk(myPath, 1)) {
for (Iterator<Path> it = walk.iterator(); it.hasNext();) {
Path p = it.next();
......
......@@ -20,7 +20,8 @@ public enum Language {
FPQL,
OPL,
MPL,
AQL;
AQL,
AQL_ALT;
public static Language getDefault() {
return AQL;
......@@ -43,6 +44,7 @@ public enum Language {
case OPL: return "OPL";
case MPL: return "MPL";
case AQL: return "AQL";
case AQL_ALT: return "AQL ALT";
case EASIK: return "EASIK";
case SKETCH: return "Sketch";
default:
......@@ -59,6 +61,7 @@ public enum Language {
case OPL: return "O";
case MPL: return "M";
case AQL: return " ";
case AQL_ALT: return " ";
case EASIK: return "E";
case SKETCH: return "S";
default:
......@@ -66,21 +69,39 @@ public enum Language {
}
throw new RuntimeException("Anomaly - please report");
}
public String fileExtension() {
switch (this) {
case FQL: return "fql";
case FQLPP: return "fqlpp";
case FPQL: return "fpql";
case OPL: return "opl";
case MPL: return "mpl";
case AQL: return "aql";
case EASIK: return "easik";
case SKETCH: return "sketch";
default:
throw new RuntimeException("Anomaly - please report");
case FQL: return "fql";
case FQLPP: return "fqlpp";
case FPQL: return "fpql";
case OPL: return "opl";
case MPL: return "mpl";
case AQL: return "aql";
case AQL_ALT: return "aql";
case EASIK: return "easik";
case SKETCH: return "sketch";
default:
throw new RuntimeException("Anomaly - please report");
}
}
public String filePath() {
switch (this) {
case FQL: return "fql";
case FQLPP: return "fqlpp";
case FPQL: return "fpql";
case OPL: return "opl";
case MPL: return "mpl";
case AQL: return "aql";
case AQL_ALT: return "aql_extra";
case EASIK: return "easik";
case SKETCH: return "sketch";
default:
throw new RuntimeException("Anomaly - please report");
}
}
@SuppressWarnings({ "rawtypes" })
......@@ -92,6 +113,7 @@ public enum Language {
case FQL: return new FqlCodeEditor(title,id, content);
case MPL: return new MplCodeEditor(title, id, content);
case AQL: return new AqlCodeEditor(title, id, content);
case AQL_ALT: return new AqlCodeEditor(title, id, content);
case EASIK:
case SKETCH:
default:
......@@ -120,6 +142,7 @@ public enum Language {
case FQL: return Examples.getExamples(Language.FQL);
case MPL: return Examples.getExamples(Language.MPL);
case AQL: return Examples.getExamples(Language.AQL);
case AQL_ALT: return Examples.getExamples(Language.AQL_ALT);
case EASIK: return Examples.getExamples(Language.EASIK);
case SKETCH: return Examples.getExamples(Language.SKETCH);
default:
......
......@@ -30,6 +30,11 @@ public class AqlExampleTest {
if (lastEnv.exn != null) {
throw lastEnv.exn;
}
final String msg = new StringBuilder()
.append("Test failed AS EXPECTED for test case '")
.append(description)
.append("' \n")
.toString();
} catch (Exception e) {
final String msg = new StringBuilder()
.append("Test failed for test case '")
......@@ -39,13 +44,41 @@ public class AqlExampleTest {
.append("'.\n")
.append(e.getStackTrace())
.toString();
// System.out.println( msg );
fail(msg);
}
}
public static Stream<Arguments> loadExamples() {
return Examples.getExamples(Language.AQL).stream()
return Examples
.getExamples(Language.AQL).stream()
.map(example -> Arguments.of(example.getName(), example.getText()));
}
@ParameterizedTest
@MethodSource("loadDefectiveExamples")
public void testDefectiveSourceText(String description, String src) {
System.out.println("testing example: " + description);
try {
final Program<Exp<?>> prog = AqlParserFactory.getParser().parseProgram(src);
final AqlMultiDriver driver = new AqlMultiDriver(prog, new String[1], null);
driver.start();
final AqlEnv lastEnv = driver.env;
if (lastEnv.exn != null) {
throw lastEnv.exn;
}
final String msg = new StringBuilder()
.append("Test succeeded for test case '")
.append(description)
.append("' \n")
.toString();
fail(msg);
} catch (Exception e) {
}
}
public static Stream<Arguments> loadDefectiveExamples() {
return Examples
.getExamples(Language.AQL_ALT).stream()
.map(example -> Arguments.of(example.getName(), example.getText()));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment