UnitTestBot / UTBotJava

Automated unit test generation and precise code analysis for Java
Apache License 2.0
132 stars 39 forks source link

Slow test generation for matrix with constraints #2254

Open tochilinak opened 1 year ago

tochilinak commented 1 year ago

Description

UTBot Java cannot generate for a test that expects specific matrix as input in 3 minutes. However, it was able to do that in 5 minutes.

To Reproduce

Steps to reproduce the behavior:

  1. Create project in IntelliJ Idea with the following code:

    public class Main {
    int[][] func(int[][] x, int target) {
        int n = x.length;
        assert (n >= 5);
        for (int[] ints : x) {
            assert (ints.length == n);
            for (int j = 0; j < n; j++) {
                assert (ints[j] == target);
            }
        }
    
        // simulation of some smart work
        int y = 1;
        for (int i = 0; i < n; i++) {
            y += i;
            x[i][i] += y;
        }
    
        return x;
    }
    }
  2. Use plugin to generate tests. Set timeout to 180 seconds.

Expected behavior

At least one successful test should be generated.

Actual behavior

Only failing tests were generated.

alisevych commented 1 year ago

Actual for Fuzzing platform - and for Symbolic engine both. Fuzzing 100% mode 180 sec - produces only error tests. Symbolic execution 100% mode 180 sec - same.