albertogoffi / toradocu

Toradocu - automated generation of test oracles from Javadoc documentation
Other
42 stars 21 forks source link

Condition is created on array and not array length #67

Closed bjkeller closed 7 years ago

bjkeller commented 7 years ago

From Apache Commons Math StepFunction, Toradocu generates condition method

  // org.apache.commons.math3.analysis.function.StepFunction.StepFunction(double[] x,double[] y)
    public static boolean m0_t2(org.apache.commons.math3.analysis.function.StepFunction receiver0_t2, double[] x, double[] y) {
        // @throws org.apache.commons.math3.exception.NoDataException if x or y are zero-length. ==> args[0]==0 || args[1]==0
        return x == 0 || y == 0;
    }

The condition is on the arrays instead of the length of the arrays, and should be x.length == 0 || y.length == 0

bjkeller commented 7 years ago

Another case:

    // org.apache.commons.math3.analysis.interpolation.BicubicInterpolatingFunction.BicubicInterpolatingFunction(double[] x,double[] y,double[][] f,double[][] dFdX,double[][] dFdY,double[][] d2FdXdY)
    public static boolean m0_t2(org.apache.commons.math3.analysis.interpolation.BicubicInterpolatingFunction receiver0_t2, double[] x, double[] y, double[][] f, double[][] dFdX, double[][] dFdY, double[][] d2FdXdY) {
        // @throws org.apache.commons.math3.exception.NoDataException if any of the arrays has zero length. ==> args[0].length || args[1].length || args[2].length
        return x.length || y.length || f.length;
    }