Skip to content

JS. First execution branch in Recursion.factorial(n) is not covered #1958

@alisevych

Description

@alisevych

Description

Generated tests for samples\commonRecursion.js doesn't cover line 4 (n < 0 branch).

To Reproduce

  1. Install the latest IU plugin built from unit-test-bot/rc3102023 branch in IntelliJ Idea Ultimate 2022.3.2
    take utbot-intellij-IU-2023.3.* artefact
  2. Create/open a JavaScript project
  3. Copy samples folder from utbot-js module and paste it into this project
  4. Generate tests for Recursion.factorial(n) function in samples/commonRecursion.js
  5. Check the generated tests

Expected behavior

There should be a test for every execution branch.
Or at least UnitTestBot should try to cover all lines during timeout.

Actual behavior

4-th line with condition (n < 0) is not covered with tests.
There are only 2 tests generated stably: for (n==0) and (n > 0).
Test generation finishes before timeout is reached.

Visual proofs (screenshots, logs, images)

const fileUnderTest = require("./../samples/commonRecursion.js")
const assert = require("assert")

///region Test suites for executable Recursion.factorial


it("testFactorial1", function ()
 {
    let recursion = new fileUnderTest.Recursion()
    
    let actual = recursion.factorial(0.0)
    
    assert.deepEqual(1, actual)
}
)

it("testFactorial2", function ()
 {
    let recursion = new fileUnderTest.Recursion()
    
    let actual = recursion.factorial(1.1125370618783376E-308)
    
    assert.deepEqual(-1.1125370618783376E-308, actual)
}
)

///endregion

Environment

Windows 10 Po
IntelliJ IDEA Ultimate 2022.3.2
Node.js 18.14.2

Additional context

Tried with the same result:

  • Base / Fast mode
  • Timeout 10/60 sec

Metadata

Metadata

Assignees

Labels

ctg-bugIssue is a buglang-javascriptIssue is related to JavaScript support

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions