Exemplo n.º 1
0
        public static int guessObject(SimpleObject obj)
        {
            if (obj == null)
            {
                return(-1);
            }

            if (obj.getOperationCount() == 2 && obj.getResult() == 3)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 2
0
        //@SetteRequiredStatementCoverage(value = 66)
        public static int guessImpossibleObject(SimpleObject obj)
        {
            if (obj == null)
            {
                return(-1);
            }

            if (obj.getOperationCount() < 0 || obj.getResult() < 0)
            {
                // invalid object, cannot be created with method call, only via
                // reflection or overflow
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 3
0
        public static int guessResultAndOperationCountParams(int x, int oc)
        {
            SimpleObject obj = new SimpleObject();

            for (int i = 0; i < oc; i++)
            {
                obj.addAbs(x);
            }

            if (obj.getResult() == 10 && obj.getOperationCount() == 5)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 4
0
        public static int fullCoverage(SimpleObject obj, int x1, int x2,
                                       int oc)
        {
            if (obj == null)
            {
                return(-1);
            }

            obj.chainedAddAbs(x1).addAbs(x2);

            if (obj.getResult() == 10 && oc == obj.getOperationCount())
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 5
0
        //@SetteRequiredStatementCoverage(value = 85)
        public static int guessImpossibleOperationCountParams(int oc)
        {
            SimpleObject obj = new SimpleObject();

            for (int i = 0; i < oc; i++)
            {
                obj.addAbs(1);
            }

            if (obj.getOperationCount() < 0)
            {
                // only with overflow
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 6
0
        public static int guessOperationCount(SimpleObject obj, int oc)
        {
            if (obj == null)
            {
                return(-1);
            }

            for (int i = 0; i < oc; i++)
            {
                obj.addAbs(1);
            }

            if (obj.getOperationCount() == 5)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 7
0
        //@SetteRequiredStatementCoverage(value = 80)
        public static int guessImpossibleResultAndOperationCount(
            SimpleObject obj, int x, int oc)
        {
            if (obj == null)
            {
                return(-1);
            }

            for (int i = 0; i < oc; i++)
            {
                obj.addAbs(x);
            }

            if (obj.getResult() == 10 && obj.getOperationCount() == 4)
            {
                // impossible
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 8
0
        //@SetteRequiredStatementCoverage(value = 87)
        public static int guessImpossibleOperationCount(SimpleObject obj,
                                                        int oc)
        {
            if (obj == null)
            {
                return(-1);
            }

            for (int i = 0; i < oc; i++)
            {
                obj.addAbs(1);
            }

            if (obj.getOperationCount() < 0)
            {
                // impossible
                throw new Exception();
            }
            else
            {
                return(0);
            }
        }