Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete covered control graphs #23

Open
anfuchs opened this issue Nov 9, 2015 · 1 comment
Open

Incomplete covered control graphs #23

anfuchs opened this issue Nov 9, 2015 · 1 comment

Comments

@anfuchs
Copy link
Contributor

anfuchs commented Nov 9, 2015

Only one condition is tested in a simple if-else construct.

Tried with different Coverage options, resulting all in same generated test case (see below).

Code to test:

public class Foobar {
    public boolean fooTheBar(int x) {
        if(x > 1000) {
            return true;
        } else {
            return false;
        }
    }
}

Generated Test Case:

public class TestClass12 {
    // Fields for test parameters and expected return values.
    private de.wwu.pi.dbtest.sampleapp.Foobar testedClass;
    private boolean booleanfalse;
    private int intm50;

    /**
     * Set up the unit test by initializing the fields to the desired values.
     */
    @Before public void setUp() {
        this.testedClass = new de.wwu.pi.dbtest.sampleapp.Foobar();
        this.booleanfalse = false;
        this.intm50 = -50;
    }

    /**
     * Run the tests on de.wwu.pi.dbtest.sampleapp.Foobar.fooTheBar(int x).
     */
    @Test public void testIt() {
        assertEquals(this.booleanfalse, this.testedClass.fooTheBar(this.intm50));
    }

    /**
     * Invoke JUnit to run the unit tests.
     * @param args Command line arguments, which are ignored here. Just supply null.
     */
    public static void main(String args[]) {
        org.junit.runner.JUnitCore.main("test.unitTests.TestClass12");
    }
}
@anfuchs anfuchs added the bug label Nov 9, 2015
@Dagefoerde
Copy link
Member

Is it possible that this happens only when using JaCoP as a solver? Because currently, JaCoP is limited to integer values in the interval of [-50,50]. You can change this interval by putting smaller(!) values into de.wwu.muggl.solvers.jacop.JaCoPTransformer#DOMAIN_DEPRECIATION, as this constant is used for reducing the domain of IntVars.

Background: If we assume a range of [-50,50], then there is actually no x that can fulfill the criterion x > 1000. This is wrong, of course, but with JaCoP there is currently no other solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants