Commit 99fa0c6d authored by Markus Klinik's avatar Markus Klinik
Browse files

refactor test cases

parent ac272aee
......@@ -4,6 +4,7 @@ import lang::java::m3::Core;
import lang::java::m3::AST;
import Relation;
import Set;
import Message;
// Assumption: the given identifier has exactly one name.
str getName(M3 model, loc identifier) = getOneFrom(invert(model.names)[identifier]);
......@@ -19,4 +20,6 @@ set[loc] getMainMethods(M3 model)
// Assumes that there is exactly one Main class in the project
loc getMainClass(M3 model) =
getOneFrom(range(domainR(invert(model.containment), getMainMethods(model))));
\ No newline at end of file
getOneFrom(range(domainR(invert(model.containment), getMainMethods(model))));
set[str] messages(set[Message] errors) = { message | error(message, _) <- errors };
\ No newline at end of file
......@@ -5,6 +5,7 @@ import IO;
import SpecUtil;
import Assignment02Rules;
import Util;
test bool allGood()
{
......@@ -15,19 +16,19 @@ test bool allGood()
test bool wrongProject()
{
errors = allAssignment02Rules(loadTestProject("assignment01-good"));
return "There should be one class called Gallows" in { message | error(message, _) <- errors };
return "There should be one class called Gallows" in messages(errors);
}
test bool mainHasIO()
{
errors = allAssignment02Rules(loadTestProject("assignment02-main-has-io"));
return "All I/O should happen in the view class" in { message | error(message, _) <- errors };
return "All I/O should happen in the view class" in messages(errors);
}
test bool noUseStringBuilder()
{
errors = allAssignment02Rules(loadTestProject("assignment02-no-use-stringbuilder"));
return "Gallows should use StringBuilder" in { message | error(message, _) <- errors };
return "Gallows should use StringBuilder" in messages(errors);
}
// Main class creates a Scanner and passes it on to the View class. This should be allowed.
......
Supports Markdown
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