Open
Description
Description
Tests generated by Symbolic Execution for OverflowExamples with Treat overflows as errors
option on - are supposed to fail with ArithmeticException, but they are passing.
To Reproduce
- Install one of the latest plugin build from main in IDEA
- Run the 'UTBotJava' project in IntelliJ Idea
- Set
Overflow detection
toTreat overflows as errors
:
- Use plugin to generate tests for the sample org.utbot.examples.math.OverflowExamples with Mocks off:
- Find
///region SYMBOLIC EXECUTION: OVERFLOWS for method intOverflow(int, int)
in the generated test
Expected behavior
Test is supposed to fail with ArithmeticException
Actual behavior
The test has comment that it produces AithmeticException, but it actually pass.
Visual proofs (screenshots, logs, images)
///region SYMBOLIC EXECUTION: OVERFLOWS for method intSubOverflow(int, int)
/**
* @utbot.classUnderTest {@link OverflowExamples}
* @utbot.methodUnderTest {@link OverflowExamples#intSubOverflow(int, int)}
* @utbot.throwsException {@link ArithmeticException} in: return x - y;
*/
@Test
@DisplayName("intSubOverflow: return x - y : True -> ThrowArithmeticException")
public void testIntSubOverflow_ThrowArithmeticException() {
OverflowExamples overflowExamples = new OverflowExamples();
/* This test fails because method [org.utbot.examples.math.OverflowExamples.intSubOverflow] produces [java.lang.ArithmeticException: int - overflow] */
overflowExamples.intSubOverflow(1426620925, -1610612736);
}
///endregion
Environment
Windows 10 Pro
IntelliJ IDEA 2022.2.3
Additional context
There are 15 tests generated for OverflowExamples with the same behavior.
Metadata
Metadata
Assignees
Type
Projects
Status