Class SmartOracle


  • public class SmartOracle
    extends Oracle
    Compares expected and actual outputs to determine if they match.
    • Constructor Detail

      • SmartOracle

        public SmartOracle​(OracleProperties config,
                           TestCase testCase,
                           Submission submission,
                           Stage submitterStage)
        Create a new smart oracle.
        Parameters:
        config - configuration properties
        testCase - the test case to which this oracle will apply
        submission - the submission being judged
        submitterStage - the stage where the submitted code has been built
    • Method Detail

      • compare

        public 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 settings.
        Specified by:
        compare in class Oracle
        Parameters:
        expected - the expected string
        actual - the string being examined
        Returns:
        true if actual is an acceptable variant of expected.
      • displayInContext

        public static java.lang.String displayInContext​(Token token,
                                                        java.lang.String line,
                                                        java.lang.String startMarker,
                                                        java.lang.String endMarker)
        Display a token within the line where it occurs.
        Parameters:
        token - a token
        line - the line in which it occurs
        startMarker - string to display just before the changed token
        endMarker - string to display just after the changed token
        Returns:
        a string containing parts of the line before and after the token itself.