org.jmodelica.modelica.compiler.TestCase Class Reference

base class for test cases. More...

Inheritance diagram for org.jmodelica.modelica.compiler.TestCase:

org.jmodelica.modelica.compiler.CodeGenTestCase org.jmodelica.modelica.compiler.ErrorTestCase org.jmodelica.modelica.compiler.FClassMethodTestCase org.jmodelica.modelica.compiler.FlatteningTestCase org.jmodelica.modelica.compiler.TransformCanonicalTestCase org.jmodelica.modelica.compiler.CADCodeGenTestCase org.jmodelica.modelica.compiler.CCodeGenTestCase org.jmodelica.modelica.compiler.GenericCodeGenTestCase org.jmodelica.modelica.compiler.XMLCodeGenTestCase org.jmodelica.modelica.compiler.XMLValueGenTestCase org.jmodelica.modelica.compiler.ComplianceErrorTestCase org.jmodelica.modelica.compiler.WarningTestCase

List of all members.

Classes

interface  Assert
 Interface for proxy class used to remove dependency on junit from TestCase.

Public Member Functions

 TestCase ()
 TestCase (String name, String description, String sourceFileName, String className)
void setStringOption (String key, String value)
 Set a string option to be used during compilation.
void setBooleanOption (String key, boolean value)
 Set a boolean option to be used during compilation.
void setIntegerOption (String key, int value)
 Set an integer option to be used during compilation.
void setRealOption (String key, double value)
 Set a real option to be used during compilation.
void dumpJunit (StringBuilder str, int index)
String getName ()
void setName (String name)
String getDescription ()
void setDescription (String description)
String getSourceFileName ()
void setSourceFileName (String sourceFileName)
String getClassName ()
void setClassName (String className)
void setFilter (boolean val)
 Activate or deactivate filtering (see filter(String)).
void setCheckAll (boolean val)
 Activate or deactivate incusion of warnings and compliance errors in error check (see filterProblems(Collection<Problem>)).
String removeWhitespace (String str)
 Replace all sequences of whitespace with a single space each.
void testMe (Assert a)
void performTest () throws ParserException, beaver.Parser.Exception, IOException, ModelicaClassNotFoundException

Static Public Member Functions

static FClass createFClass (InstClassDecl icd)

Protected Member Functions

OptionRegistry createOptionsRegistry ()
 Create the OptionsRegistry to be used during compilation.
String filter (String str)
 Perform filtering on string, if activated.
void fail (String msg)
 Signal that the test failed.
void fail (Exception e)
 Signal that the test failed.
boolean testSemanticProblems (Collection< Problem > problems)
 Perform tests on the set of semantic problems found in the instance tree.
boolean testFlattened (FClass fc)
 Perform tests on flattened class.
boolean testTransformed (FClass fc)
 Perform tests on flat class after transform canonical step.
boolean testTransformedProblems (Collection< Problem > problems)
 Perform tests on the set of semantic problems found after transform canonical step.
boolean testProblems (Collection< Problem > problems)
 Perform tests on a set of semantic problems.
void filterProblems (Collection< Problem > problems)
 Filters out any uninteresting problems from a set of semantic problems.
void testPrettyPrint (FClass fc, String correct)
 Compare a flat class to a pretty-printed correct model and fail if different.
String sortLines (String str)
 Sort lines in string alphabetically.
String compareMsg (String actual, String expected)
 Generate the part of an error message that shows expected and actual result.


Detailed Description

base class for test cases.

Note that for each attribute (e.g. "attributeName") in the test case annotation, there must be a corresponding method (e.g. "setAttributeName()") in that subclass of TestCase. Any attribute in the test case annotation with a name containing an underscore ("_"), is instead interpreted as a compiler option, and is set with setXXXOption().

Author:
jakesson class :0

Constructor & Destructor Documentation

org.jmodelica.modelica.compiler.TestCase.TestCase (  ) 

org.jmodelica.modelica.compiler.TestCase.TestCase ( String  name,
String  description,
String  sourceFileName,
String  className 
)

Parameters:
name 
description 
sourceFileName 
className 


Member Function Documentation

String org.jmodelica.modelica.compiler.TestCase.compareMsg ( String  actual,
String  expected 
) [protected]

Generate the part of an error message that shows expected and actual result.

static FClass org.jmodelica.modelica.compiler.TestCase.createFClass ( InstClassDecl  icd  )  [static]

OptionRegistry org.jmodelica.modelica.compiler.TestCase.createOptionsRegistry (  )  [protected]

Create the OptionsRegistry to be used during compilation.

Options may be further changed by test annotation.

void org.jmodelica.modelica.compiler.TestCase.dumpJunit ( StringBuilder  str,
int  index 
)

void org.jmodelica.modelica.compiler.TestCase.fail ( Exception  e  )  [protected]

Signal that the test failed.

Parameters:
e the exception that caused the failure

void org.jmodelica.modelica.compiler.TestCase.fail ( String  msg  )  [protected]

Signal that the test failed.

Parameters:
msg a message describing what went wrong

String org.jmodelica.modelica.compiler.TestCase.filter ( String  str  )  [protected]

Perform filtering on string, if activated.

void org.jmodelica.modelica.compiler.TestCase.filterProblems ( Collection< Problem problems  )  [protected]

Filters out any uninteresting problems from a set of semantic problems.

Default implementation removes any warnings and any COMPLIANCE errors.

Reimplemented in org.jmodelica.modelica.compiler.ComplianceErrorTestCase, and org.jmodelica.modelica.compiler.WarningTestCase.

String org.jmodelica.modelica.compiler.TestCase.getClassName (  ) 

Returns:
the className

String org.jmodelica.modelica.compiler.TestCase.getDescription (  ) 

Returns:
the description

String org.jmodelica.modelica.compiler.TestCase.getName (  ) 

Returns:
the name

String org.jmodelica.modelica.compiler.TestCase.getSourceFileName (  ) 

Returns:
the sourceFileName

void org.jmodelica.modelica.compiler.TestCase.performTest (  )  throws ParserException, beaver.Parser.Exception, IOException, ModelicaClassNotFoundException

String org.jmodelica.modelica.compiler.TestCase.removeWhitespace ( String  str  ) 

Replace all sequences of whitespace with a single space each.

void org.jmodelica.modelica.compiler.TestCase.setBooleanOption ( String  key,
boolean  value 
)

Set a boolean option to be used during compilation.

void org.jmodelica.modelica.compiler.TestCase.setCheckAll ( boolean  val  ) 

Activate or deactivate incusion of warnings and compliance errors in error check (see filterProblems(Collection<Problem>)).

void org.jmodelica.modelica.compiler.TestCase.setClassName ( String  className  ) 

Parameters:
className the className to set

void org.jmodelica.modelica.compiler.TestCase.setDescription ( String  description  ) 

Parameters:
description the description to set

void org.jmodelica.modelica.compiler.TestCase.setFilter ( boolean  val  ) 

Activate or deactivate filtering (see filter(String)).

void org.jmodelica.modelica.compiler.TestCase.setIntegerOption ( String  key,
int  value 
)

Set an integer option to be used during compilation.

void org.jmodelica.modelica.compiler.TestCase.setName ( String  name  ) 

Parameters:
name the name to set

void org.jmodelica.modelica.compiler.TestCase.setRealOption ( String  key,
double  value 
)

Set a real option to be used during compilation.

void org.jmodelica.modelica.compiler.TestCase.setSourceFileName ( String  sourceFileName  ) 

Parameters:
sourceFileName the sourceFileName to set

void org.jmodelica.modelica.compiler.TestCase.setStringOption ( String  key,
String  value 
)

Set a string option to be used during compilation.

String org.jmodelica.modelica.compiler.TestCase.sortLines ( String  str  )  [protected]

Sort lines in string alphabetically.

boolean org.jmodelica.modelica.compiler.TestCase.testFlattened ( FClass  fc  )  [protected]

Perform tests on flattened class.

Returns:
true if test case shoule stop after this method

Reimplemented in org.jmodelica.modelica.compiler.FlatteningTestCase.

void org.jmodelica.modelica.compiler.TestCase.testMe ( Assert  a  ) 

void org.jmodelica.modelica.compiler.TestCase.testPrettyPrint ( FClass  fc,
String  correct 
) [protected]

Compare a flat class to a pretty-printed correct model and fail if different.

boolean org.jmodelica.modelica.compiler.TestCase.testProblems ( Collection< Problem problems  )  [protected]

Perform tests on a set of semantic problems.

Default implementation fails if any errors other than COMPLIANCE were found, and returns false otherwise.

Returns:
true if test case shoule stop after this method

Reimplemented in org.jmodelica.modelica.compiler.ErrorTestCase.

boolean org.jmodelica.modelica.compiler.TestCase.testSemanticProblems ( Collection< Problem problems  )  [protected]

Perform tests on the set of semantic problems found in the instance tree.

Default implementation fails if any errors other than COMPLIANCE were found, and returns false otherwise.

Returns:
true if test case shoule stop after this method

boolean org.jmodelica.modelica.compiler.TestCase.testTransformed ( FClass  fc  )  [protected]

Perform tests on flat class after transform canonical step.

Returns:
true if test case shoule stop after this method

Reimplemented in org.jmodelica.modelica.compiler.CodeGenTestCase, org.jmodelica.modelica.compiler.FClassMethodTestCase, and org.jmodelica.modelica.compiler.TransformCanonicalTestCase.

boolean org.jmodelica.modelica.compiler.TestCase.testTransformedProblems ( Collection< Problem problems  )  [protected]

Perform tests on the set of semantic problems found after transform canonical step.

Default implementation fails if any errors other than COMPLIANCE were found, and returns false otherwise.

Returns:
true if test case shoule stop after this method

Reimplemented in org.jmodelica.modelica.compiler.ErrorTestCase.


The documentation for this class was generated from the following file:

Generated on Fri Oct 7 14:51:11 2011 for JModelica.org by  doxygen 1.5.8