Class Oracle
- java.lang.Object
-
- edu.odu.cs.zeil.codegrader.oracle.Oracle
-
- Direct Known Subclasses:
ExternalOracle
,FilesExistOracle
,JUnit5Oracle
,SelfScoredOracle
,SmartOracle
,StatusOracle
,TAPOracle
public abstract class Oracle extends java.lang.Object
Compares expected and actual outputs to determine if they match.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Oracle.ScoringOptions
Possible scoring options for test cases.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PASSED_TEST_MESSAGE
What message will be recorded when a test passes with 100 pts.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Oracle(OracleProperties properties, TestCase theTestCase, Submission sub, Stage submitterStage)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract OracleResult
compare(java.lang.String expected, java.lang.String actual)
Compare two strings to see if one is an acceptable variant of the other.int
getCap()
java.lang.String
getCommand()
boolean
getIgnoreCase()
boolean
getIgnoreEmptyLines()
boolean
getIgnorePunctuation()
boolean
getIgnoreWS()
boolean
getNumbersOnly()
java.lang.String
getPattern()
double
getPrecision()
How far floating point numbers may vary and still be considered equal.Oracle.ScoringOptions
getScoring()
Stage
getStage()
Submission
getSubmission()
TestCase
getTestCase()
-
-
-
Field Detail
-
PASSED_TEST_MESSAGE
public static final java.lang.String PASSED_TEST_MESSAGE
What message will be recorded when a test passes with 100 pts.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Oracle
protected Oracle(OracleProperties properties, TestCase theTestCase, Submission sub, Stage submitterStage)
-
-
Method Detail
-
compare
public abstract OracleResult compare(java.lang.String expected, java.lang.String actual)
Compare two strings to see if one is an acceptable variant of the other. The precise meaning of "acceptable" depends on the oracle and its settings.- Parameters:
expected
- the expected stringactual
- the string being examined- Returns:
- score and explanation
-
getIgnoreCase
public boolean getIgnoreCase()
- Returns:
- true iff upper/lower case differences are ignored.
-
getScoring
public Oracle.ScoringOptions getScoring()
- Returns:
- scoring option for this test case.
-
getPrecision
public double getPrecision()
How far floating point numbers may vary and still be considered equal. If negative, the comparison precision is derived from the expected value. E.g., if the expected value is printed with 2 digits after the decimal point, then the precision is 0.01.- Returns:
- precision used when comparing floating point numbers.
-
getIgnoreWS
public boolean getIgnoreWS()
- Returns:
- true iff differences in whitespace are being ignored.
-
getIgnoreEmptyLines
public boolean getIgnoreEmptyLines()
- Returns:
- true iff empty lines are ignored.
-
getIgnorePunctuation
public boolean getIgnorePunctuation()
- Returns:
- true iff punctuation is ignored.
-
getNumbersOnly
public boolean getNumbersOnly()
- Returns:
- true if only numbers in the output are being checked.
-
getCommand
public java.lang.String getCommand()
- Returns:
- command string to launch an external oracle.
-
getCap
public int getCap()
- Returns:
- maximum number of points that can be scored.
-
getTestCase
public TestCase getTestCase()
- Returns:
- the test case being examined.
-
getSubmission
public Submission getSubmission()
- Returns:
- the submission
-
getStage
public Stage getStage()
- Returns:
- the stage
-
getPattern
public java.lang.String getPattern()
- Returns:
- the pattern
-
-