if (logger.getNErrors() > 0) {
Assert.fail("Parsing of module definition failed: " + logger.getCompilerMessages());
}
WorkspaceManager workspaceManager = privateCopyLeccServices.getWorkspaceManager();
workspaceManager.makeModule(new SourceModelModuleSource(moduleDefn), logger);
if (logger.getNErrors() > 0) {
Assert.fail("Compilation of test module (before adding instances) failed: " + logger.getCompilerMessages());
}
String[] typeNames = new String[] {
"Unary", "Binary", "Ternary", "MyWrap", "MyBottomMiddleTop", "MyFooBarBaz", "MyTuple3B"
};
SourceModel.Expr[][] correspTestValues = new SourceModel.Expr[][] {
parseExprs(new String[] {"U1"}),
parseExprs(new String[] {"B1", "B2"}),
parseExprs(new String[] {"T1", "T2", "T3"}),
parseExprs(new String[] {"MyWrap 'a'", "MyWrap 'b'", "MyWrap 'c'"}),
parseExprs(new String[] {"Bottom", "Middle 'a'", "Middle 'b'", "Middle 'c'", "Top"}),
parseExprs(new String[] {"MyFoo 'a'", "MyFoo 'b'", "MyFoo 'c'", "MyBar", "MyBaz 'a'", "MyBaz 'b'", "MyBaz 'c'"}),
parseExprs(new String[] {
"MyTuple3B 'a' 'a' 'a'",
"MyTuple3B 'a' 'a' 'b'",
"MyTuple3B 'a' 'b' 'a'",
"MyTuple3B 'a' 'b' 'b'",
"MyTuple3B 'b' 'a' 'a'",
"MyTuple3B 'b' 'a' 'b'",
"MyTuple3B 'b' 'b' 'a'",
"MyTuple3B 'b' 'b' 'b'"})
};
SourceModel.ModuleDefn compactImplModuleDefn = addInstancesAndTests(moduleDefn, workspaceManager, typeNames, correspTestValues, true, "testAllCompact");
if (SHOW_DEBUGGING_OUTPUT) {
System.out.println("Module with compact instance implementations:");
System.out.println(compactImplModuleDefn);
}
workspaceManager.makeModule(new SourceModelModuleSource(compactImplModuleDefn), logger);
if (logger.getNErrors() > 0) {
Assert.fail("Compilation of compact instance implementations failed: " + logger.getCompilerMessages());
}
CALServicesTestUtilities.runNamedFunction(QualifiedName.make(moduleName, "testAllCompact"), privateCopyLeccServices);
SourceModel.ModuleDefn efficientImplModuleDefn = addInstancesAndTests(moduleDefn, workspaceManager, typeNames, correspTestValues, false, "testAllEfficient");
if (SHOW_DEBUGGING_OUTPUT) {
System.out.println("Module with efficient instance implementations:");
System.out.println(efficientImplModuleDefn);
}
workspaceManager.makeModule(new SourceModelModuleSource(efficientImplModuleDefn), logger);
if (logger.getNErrors() > 0) {
Assert.fail("Compilation of efficient instance implementations failed: " + logger.getCompilerMessages());
}
CALServicesTestUtilities.runNamedFunction(QualifiedName.make(moduleName, "testAllEfficient"), privateCopyLeccServices);