Class CompareEquivalentFunctions

  • Direct Known Subclasses:
    CompareIdenticalFunctions

    public abstract class CompareEquivalentFunctions
    extends java.lang.Object
    Provides a formalism for comparing two sets of functions which should produce identical results.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected CompareEquivalentFunctions​(java.lang.Class<?> testClass, java.lang.Class<?>... validationClass)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void compareMethod​(java.lang.Class<?> validationClass, java.lang.reflect.Method target, java.lang.String validationName)
      Allows directly comparing two functions to each other without going through all the other functions
      void compareMethod​(java.lang.reflect.Method target, java.lang.String validationName)  
      protected abstract void compareResults​(java.lang.Object targetResult, java.lang.Object[] targetParam, java.lang.Object validationResult, java.lang.Object[] validationParam)
      Compares the two sets of results from the target and validation methods.
      protected abstract java.lang.Object[][] createInputParam​(java.lang.reflect.Method candidate, java.lang.reflect.Method validation)
      Creates the set of input parameters for the functions.
      protected java.lang.Object[] createSubImageInputs​(java.lang.Object[] param)  
      protected abstract boolean isEquivalent​(java.lang.reflect.Method candidate, java.lang.reflect.Method validation)
      Returns two if the two methods provide results that should be compared
      protected abstract boolean isTestMethod​(java.lang.reflect.Method m)
      Checks to see if the provided method from the test class is a method that should be tested
      void performTests​(int numMethods)  
      protected abstract java.lang.Object[] reformatForValidation​(java.lang.reflect.Method m, java.lang.Object[] targetParam)
      Adjusts the input for the validation method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • methodTest

        protected java.lang.reflect.Method methodTest
      • methodValidation

        protected java.lang.reflect.Method methodValidation
      • ignoreSubimage

        protected boolean[] ignoreSubimage
    • Constructor Detail

      • CompareEquivalentFunctions

        protected CompareEquivalentFunctions​(java.lang.Class<?> testClass,
                                             java.lang.Class<?>... validationClass)
    • Method Detail

      • performTests

        public void performTests​(int numMethods)
      • compareMethod

        public void compareMethod​(java.lang.Class<?> validationClass,
                                  java.lang.reflect.Method target,
                                  java.lang.String validationName)
        Allows directly comparing two functions to each other without going through all the other functions
        Parameters:
        target - The method being compared
        validationName - Name of the method in the validation class
      • compareMethod

        public void compareMethod​(java.lang.reflect.Method target,
                                  java.lang.String validationName)
      • createSubImageInputs

        protected java.lang.Object[] createSubImageInputs​(java.lang.Object[] param)
      • isTestMethod

        protected abstract boolean isTestMethod​(java.lang.reflect.Method m)
        Checks to see if the provided method from the test class is a method that should be tested
      • isEquivalent

        protected abstract boolean isEquivalent​(java.lang.reflect.Method candidate,
                                                java.lang.reflect.Method validation)
        Returns two if the two methods provide results that should be compared
      • createInputParam

        protected abstract java.lang.Object[][] createInputParam​(java.lang.reflect.Method candidate,
                                                                 java.lang.reflect.Method validation)
        Creates the set of input parameters for the functions. Tests on multiple inputs are handled by returning multiple sets of parameters
      • reformatForValidation

        protected abstract java.lang.Object[] reformatForValidation​(java.lang.reflect.Method m,
                                                                    java.lang.Object[] targetParam)
        Adjusts the input for the validation method. Allows methods with different parameter sets to be used.
      • compareResults

        protected abstract void compareResults​(java.lang.Object targetResult,
                                               java.lang.Object[] targetParam,
                                               java.lang.Object validationResult,
                                               java.lang.Object[] validationParam)
        Compares the two sets of results from the target and validation methods.