Skip to content

Commit 53411ad

Browse files
committed
Removed redundant withoutConcrete
1 parent 5b47b3b commit 53411ad

File tree

9 files changed

+238
-301
lines changed

9 files changed

+238
-301
lines changed

utbot-framework-test/src/test/kotlin/org/utbot/examples/codegen/CodegenExampleTest.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@ import org.utbot.examples.mock.MockRandomExamples
55
import kotlin.reflect.full.functions
66
import org.junit.jupiter.api.Disabled
77
import org.junit.jupiter.api.Test
8-
import org.utbot.testcheckers.withConcrete
98

109
internal class CodegenExampleTest : UtValueTestCaseChecker(testClass = CodegenExample::class) {
1110
@Test
1211
fun firstExampleTest() {
13-
withConcrete(useConcreteExecution = false) {
14-
checkAllCombinations(
15-
CodegenExample::firstExample,
16-
)
17-
}
12+
checkAllCombinations(
13+
CodegenExample::firstExample,
14+
)
1815
}
1916

2017
@Test

utbot-framework-test/src/test/kotlin/org/utbot/examples/collections/MapsPart1Test.kt

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -86,41 +86,35 @@ internal class MapsPart1Test : UtValueTestCaseChecker(
8686

8787
@Test
8888
fun testMapPutAndGet() {
89-
withConcrete(useConcreteExecution = false) {
90-
check(
91-
Maps::mapPutAndGet,
92-
eq(1),
93-
{ r -> r == 3 }
94-
)
95-
}
89+
check(
90+
Maps::mapPutAndGet,
91+
eq(1),
92+
{ r -> r == 3 }
93+
)
9694
}
9795

9896
@Test
9997
fun testPutInMapFromParameters() {
100-
withConcrete(useConcreteExecution = false) {
101-
check(
102-
Maps::putInMapFromParameters,
103-
ignoreExecutionsNumber,
104-
{ values, _ -> values == null },
105-
{ values, r -> 1 in values.keys && r == 3 },
106-
{ values, r -> 1 !in values.keys && r == 3 },
107-
)
108-
}
98+
check(
99+
Maps::putInMapFromParameters,
100+
ignoreExecutionsNumber,
101+
{ values, _ -> values == null },
102+
{ values, r -> 1 in values.keys && r == 3 },
103+
{ values, r -> 1 !in values.keys && r == 3 },
104+
)
109105
}
110106

111107
// This test doesn't check anything specific, but the code from MUT
112108
// caused errors with NPE as results while debugging `testPutInMapFromParameters`.
113109
@Test
114110
fun testContainsKeyAndPuts() {
115-
withConcrete(useConcreteExecution = false) {
116-
check(
117-
Maps::containsKeyAndPuts,
118-
ignoreExecutionsNumber,
119-
{ values, _ -> values == null },
120-
{ values, r -> 1 !in values.keys && r == 3 },
121-
coverage = FullWithAssumptions(assumeCallsNumber = 2)
122-
)
123-
}
111+
check(
112+
Maps::containsKeyAndPuts,
113+
ignoreExecutionsNumber,
114+
{ values, _ -> values == null },
115+
{ values, r -> 1 !in values.keys && r == 3 },
116+
coverage = FullWithAssumptions(assumeCallsNumber = 2)
117+
)
124118
}
125119

126120
@Test
@@ -354,22 +348,18 @@ internal class MapsPart1Test : UtValueTestCaseChecker(
354348

355349
@Test
356350
fun testCreateMapWithString() {
357-
withConcrete(useConcreteExecution = false) {
358-
check(
359-
Maps::createMapWithString,
360-
eq(1),
361-
{ r -> r!!.isEmpty() }
362-
)
363-
}
351+
check(
352+
Maps::createMapWithString,
353+
eq(1),
354+
{ r -> r!!.isEmpty() }
355+
)
364356
}
365357
@Test
366358
fun testCreateMapWithEnum() {
367-
withConcrete(useConcreteExecution = false) {
368-
check(
369-
Maps::createMapWithEnum,
370-
eq(1),
371-
{ r -> r != null && r.size == 2 && r[Maps.WorkDays.Monday] == 112 && r[Maps.WorkDays.Friday] == 567 }
372-
)
373-
}
359+
check(
360+
Maps::createMapWithEnum,
361+
eq(1),
362+
{ r -> r != null && r.size == 2 && r[Maps.WorkDays.Monday] == 112 && r[Maps.WorkDays.Friday] == 567 }
363+
)
374364
}
375365
}

utbot-framework-test/src/test/kotlin/org/utbot/examples/enums/ClassWithEnumTest.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ import org.utbot.tests.infrastructure.ignoreExecutionsNumber
1818
class ClassWithEnumTest : UtValueTestCaseChecker(testClass = ClassWithEnum::class) {
1919
@Test
2020
fun testOrdinal() {
21-
withConcrete(useConcreteExecution = false) {
22-
checkAllCombinations(ClassWithEnum::useOrdinal)
23-
}
21+
checkAllCombinations(ClassWithEnum::useOrdinal)
2422
}
2523

2624
@Test

utbot-framework-test/src/test/kotlin/org/utbot/examples/exceptions/ExceptionExamplesTest.kt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import org.utbot.tests.infrastructure.isException
77
import org.utbot.framework.plugin.api.CodegenLanguage
88
import org.junit.jupiter.api.Test
99
import org.utbot.testcheckers.eq
10-
import org.utbot.testcheckers.withConcrete
1110
import org.utbot.tests.infrastructure.CodeGeneration
1211

1312
internal class ExceptionExamplesTest : UtValueTestCaseChecker(
@@ -112,16 +111,14 @@ internal class ExceptionExamplesTest : UtValueTestCaseChecker(
112111
*/
113112
@Test
114113
fun testCatchExceptionAfterOtherPossibleException() {
115-
withConcrete(useConcreteExecution = false) {
116-
checkWithException(
117-
ExceptionExamples::catchExceptionAfterOtherPossibleException,
118-
eq(3),
119-
{ i, r -> i == -1 && r.isException<ArithmeticException>() },
120-
{ i, r -> i == 0 && r.getOrThrow() == 2 },
121-
{ i, r -> r.getOrThrow() == 1 },
122-
coverage = atLeast(100)
123-
)
124-
}
114+
checkWithException(
115+
ExceptionExamples::catchExceptionAfterOtherPossibleException,
116+
eq(3),
117+
{ i, r -> i == -1 && r.isException<ArithmeticException>() },
118+
{ i, r -> i == 0 && r.getOrThrow() == 2 },
119+
{ i, r -> r.getOrThrow() == 1 },
120+
coverage = atLeast(100)
121+
)
125122
}
126123

127124
/**

utbot-framework-test/src/test/kotlin/org/utbot/examples/stream/BaseStreamExampleTest.kt

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import org.utbot.tests.infrastructure.ignoreExecutionsNumber
1212
import org.utbot.tests.infrastructure.isException
1313
import org.utbot.framework.plugin.api.CodegenLanguage
1414
import org.utbot.testcheckers.eq
15-
import org.utbot.testcheckers.withConcrete
1615
import org.utbot.tests.infrastructure.AtLeast
1716
import org.utbot.tests.infrastructure.CodeGeneration
1817
import java.util.Optional
@@ -31,28 +30,24 @@ class BaseStreamExampleTest : UtValueTestCaseChecker(
3130
) {
3231
@Test
3332
fun testReturningStreamExample() {
34-
withConcrete(useConcreteExecution = false) {
35-
check(
36-
BaseStreamExample::returningStreamExample,
37-
eq(2),
38-
// NOTE: the order of the matchers is important because Stream could be used only once
39-
{ c, r -> c.isNotEmpty() && c == r!!.toList() },
40-
{ c, r -> c.isEmpty() && c == r!!.toList() },
41-
coverage = FullWithAssumptions(assumeCallsNumber = 1)
42-
)
43-
}
33+
check(
34+
BaseStreamExample::returningStreamExample,
35+
eq(2),
36+
// NOTE: the order of the matchers is important because Stream could be used only once
37+
{ c, r -> c.isNotEmpty() && c == r!!.toList() },
38+
{ c, r -> c.isEmpty() && c == r!!.toList() },
39+
coverage = FullWithAssumptions(assumeCallsNumber = 1)
40+
)
4441
}
4542

4643
@Test
4744
fun testReturningStreamAsParameterExample() {
48-
withConcrete(useConcreteExecution = false) {
49-
check(
50-
BaseStreamExample::returningStreamAsParameterExample,
51-
eq(1),
52-
{ s, r -> s != null && s.toList() == r!!.toList() },
53-
coverage = FullWithAssumptions(assumeCallsNumber = 1)
54-
)
55-
}
45+
check(
46+
BaseStreamExample::returningStreamAsParameterExample,
47+
eq(1),
48+
{ s, r -> s != null && s.toList() == r!!.toList() },
49+
coverage = FullWithAssumptions(assumeCallsNumber = 1)
50+
)
5651
}
5752

5853
@Test
@@ -389,16 +384,14 @@ class BaseStreamExampleTest : UtValueTestCaseChecker(
389384

390385
@Test
391386
fun testStreamOfExample() {
392-
withConcrete(useConcreteExecution = false) {
393-
check(
394-
BaseStreamExample::streamOfExample,
395-
ignoreExecutionsNumber,
396-
// NOTE: the order of the matchers is important because Stream could be used only once
397-
{ c, r -> c.isNotEmpty() && c.contentEquals(r!!.toArray()) },
398-
{ c, r -> c.isEmpty() && Stream.empty<Int>().toArray().contentEquals(r!!.toArray()) },
399-
coverage = FullWithAssumptions(assumeCallsNumber = 1)
400-
)
401-
}
387+
check(
388+
BaseStreamExample::streamOfExample,
389+
ignoreExecutionsNumber,
390+
// NOTE: the order of the matchers is important because Stream could be used only once
391+
{ c, r -> c.isNotEmpty() && c.contentEquals(r!!.toArray()) },
392+
{ c, r -> c.isEmpty() && Stream.empty<Int>().toArray().contentEquals(r!!.toArray()) },
393+
coverage = FullWithAssumptions(assumeCallsNumber = 1)
394+
)
402395
}
403396

404397
@Test

utbot-framework-test/src/test/kotlin/org/utbot/examples/stream/DoubleStreamExampleTest.kt

Lines changed: 42 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import org.junit.jupiter.api.Test
55
import org.utbot.framework.plugin.api.CodegenLanguage
66
import org.utbot.testcheckers.eq
77
import org.utbot.testcheckers.withPathSelectorStepsLimit
8-
import org.utbot.testcheckers.withConcrete
98
import org.utbot.tests.infrastructure.*
109
import java.util.OptionalDouble
1110
import java.util.stream.DoubleStream
@@ -35,14 +34,12 @@ class DoubleStreamExampleTest : UtValueTestCaseChecker(
3534

3635
@Test
3736
fun testReturningStreamAsParameterExample() {
38-
withConcrete(useConcreteExecution = false) {
39-
check(
40-
DoubleStreamExample::returningStreamAsParameterExample,
41-
eq(1),
42-
{ s, r -> s != null && s.toList() == r!!.toList() },
43-
coverage = FullWithAssumptions(assumeCallsNumber = 1)
44-
)
45-
}
37+
check(
38+
DoubleStreamExample::returningStreamAsParameterExample,
39+
eq(1),
40+
{ s, r -> s != null && s.toList() == r!!.toList() },
41+
coverage = FullWithAssumptions(assumeCallsNumber = 1)
42+
)
4643
}
4744

4845
@Test
@@ -325,41 +322,39 @@ class DoubleStreamExampleTest : UtValueTestCaseChecker(
325322

326323
@Test
327324
fun testSummaryStatisticsExample() {
328-
withConcrete(useConcreteExecution = false) {
329-
check(
330-
DoubleStreamExample::summaryStatisticsExample,
331-
ignoreExecutionsNumber,
332-
{ c, r ->
333-
val sum = r!!.sum
334-
val count = r.count
335-
val min = r.min
336-
val max = r.max
325+
check(
326+
DoubleStreamExample::summaryStatisticsExample,
327+
ignoreExecutionsNumber,
328+
{ c, r ->
329+
val sum = r!!.sum
330+
val count = r.count
331+
val min = r.min
332+
val max = r.max
337333

338-
val allStatisticsAreCorrect = sum == 0.0 &&
339-
count == 0L &&
340-
min == Double.POSITIVE_INFINITY &&
341-
max == Double.NEGATIVE_INFINITY
334+
val allStatisticsAreCorrect = sum == 0.0 &&
335+
count == 0L &&
336+
min == Double.POSITIVE_INFINITY &&
337+
max == Double.NEGATIVE_INFINITY
342338

343-
c.isEmpty() && allStatisticsAreCorrect
344-
},
345-
{ c, r ->
346-
val sum = r!!.sum
347-
val count = r.count
348-
val min = r.min
349-
val max = r.max
339+
c.isEmpty() && allStatisticsAreCorrect
340+
},
341+
{ c, r ->
342+
val sum = r!!.sum
343+
val count = r.count
344+
val min = r.min
345+
val max = r.max
350346

351-
val doubles = c.doubles()
347+
val doubles = c.doubles()
352348

353-
val allStatisticsAreCorrect = sum == doubles.sum() &&
354-
count == doubles.size.toLong() &&
355-
min == doubles.minOrNull() &&
356-
max == doubles.maxOrNull()
349+
val allStatisticsAreCorrect = sum == doubles.sum() &&
350+
count == doubles.size.toLong() &&
351+
min == doubles.minOrNull() &&
352+
max == doubles.maxOrNull()
357353

358-
c.isNotEmpty() && allStatisticsAreCorrect
359-
},
360-
coverage = FullWithAssumptions(assumeCallsNumber = 1)
361-
)
362-
}
354+
c.isNotEmpty() && allStatisticsAreCorrect
355+
},
356+
coverage = FullWithAssumptions(assumeCallsNumber = 1)
357+
)
363358
}
364359

365360
@Test
@@ -486,16 +481,14 @@ class DoubleStreamExampleTest : UtValueTestCaseChecker(
486481

487482
@Test
488483
fun testStreamOfExample() {
489-
withConcrete(useConcreteExecution = false) {
490-
check(
491-
DoubleStreamExample::streamOfExample,
492-
ignoreExecutionsNumber,
493-
// NOTE: the order of the matchers is important because Stream could be used only once
494-
{ c, r -> c.isNotEmpty() && c.contentEquals(r!!.toArray()) },
495-
{ c, r -> c.isEmpty() && DoubleStream.empty().toArray().contentEquals(r!!.toArray()) },
496-
coverage = FullWithAssumptions(assumeCallsNumber = 1)
497-
)
498-
}
484+
check(
485+
DoubleStreamExample::streamOfExample,
486+
ignoreExecutionsNumber,
487+
// NOTE: the order of the matchers is important because Stream could be used only once
488+
{ c, r -> c.isNotEmpty() && c.contentEquals(r!!.toArray()) },
489+
{ c, r -> c.isEmpty() && DoubleStream.empty().toArray().contentEquals(r!!.toArray()) },
490+
coverage = FullWithAssumptions(assumeCallsNumber = 1)
491+
)
499492
}
500493

501494
@Test

0 commit comments

Comments
 (0)