Skip to content

Tests for autogenerated Kotlin getters/setters shouldn't be generated in cli and contest estimator #1338

Description

@volivan239

Description

We don't generate tests for autogenerated Kotlin getters/setters in plugin, we shouldn't do this in cli/contest estimator as well.

To Reproduce

Launch UtBot from cli for the following class:

classCheckedAddition(varx:Int) {
funaddWithCheck(y:Int): Int? {
val res = x.toLong() + y.toLong()
if (res >=Int.MIN_VALUE&& res <=Int.MAX_VALUE) {
this.x = res.toInt()
return res.toInt()
}
returnnull
}
}

Expected behavior

Correct tests are generated

Actual behavior

UtBot tries to generate tests for setX() and getX() and produce incorrect tests:

Visual proofs (screenshots, logs, images)

@Test
funtestGetX1() {
val checkedAddition =CheckedAddition(1409199696)
val actual = checkedAddition.getX()
assertEquals(1409199696, actual)
}

Additional context

I think this should be changed in a way similar to #1192

Metadata

Metadata

Assignees

Labels

comp-cliIssue related to CLIctg-bugIssue is a buglang-kotlinIssue is related to Kotlin language support

Type

No type

Projects

Status
Done

Relationships

None yet

Development

No branches or pull requests

Issue actions