Skip to content

Commit 1fff77c

Browse files
committed
Remove duplicate summary tests from engine checks
1 parent 5052979 commit 1fff77c

File tree

6 files changed

+8
-327
lines changed

6 files changed

+8
-327
lines changed

utbot-framework-test/src/test/kotlin/org/utbot/examples/controlflow/ConditionsTest.kt

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,18 @@
11
package org.utbot.examples.controlflow
22

3-
import org.utbot.framework.plugin.api.DocCodeStmt
4-
import org.utbot.framework.plugin.api.DocPreTagStatement
5-
import org.utbot.framework.plugin.api.DocRegularStmt
6-
import org.utbot.framework.plugin.api.DocStatement
73
import org.junit.jupiter.api.Test
84
import org.utbot.testcheckers.eq
95
import org.utbot.testing.UtValueTestCaseChecker
106
import org.utbot.testing.ignoreExecutionsNumber
11-
import org.utbot.testing.keyContain
12-
import org.utbot.testing.keyMatch
137

148
internal class ConditionsTest : UtValueTestCaseChecker(testClass = Conditions::class) {
159
@Test
1610
fun testSimpleCondition() {
17-
val conditionSummary = listOf<DocStatement>(
18-
DocPreTagStatement(
19-
listOf(
20-
DocRegularStmt("Test "),
21-
DocRegularStmt("executes conditions:\n"),
22-
DocRegularStmt(" "),
23-
DocCodeStmt("(condition): True"),
24-
DocRegularStmt("\n"),
25-
DocRegularStmt("returns from: "),
26-
DocCodeStmt("return 1;"),
27-
DocRegularStmt("\n"),
28-
)
29-
)
30-
)
3111
check(
3212
Conditions::simpleCondition,
3313
eq(2),
3414
{ condition, r -> !condition && r == 0 },
35-
{ condition, r -> condition && r == 1 },
36-
summaryTextChecks = listOf(
37-
keyContain(DocCodeStmt("(condition): True")),
38-
keyContain(DocCodeStmt("(condition): False")),
39-
keyMatch(conditionSummary)
40-
),
41-
summaryNameChecks = listOf(
42-
keyMatch("testSimpleCondition_Condition"),
43-
keyMatch("testSimpleCondition_NotCondition"),
44-
),
45-
summaryDisplayNameChecks = listOf(
46-
keyContain("condition : True"),
47-
keyContain("condition : False"),
48-
)
15+
{ condition, r -> condition && r == 1 }
4916
)
5017
}
5118

utbot-framework-test/src/test/kotlin/org/utbot/examples/controlflow/CycleDependedConditionTest.kt

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,30 @@
11
package org.utbot.examples.controlflow
22

3-
import org.utbot.framework.plugin.api.DocCodeStmt
4-
import org.utbot.framework.plugin.api.DocPreTagStatement
5-
import org.utbot.framework.plugin.api.DocRegularStmt
6-
import org.utbot.framework.plugin.api.DocStatement
73
import org.junit.jupiter.api.Test
84
import org.utbot.testcheckers.eq
95
import org.utbot.testing.UtValueTestCaseChecker
10-
import org.utbot.testing.keyContain
11-
import org.utbot.testing.keyMatch
126

137
internal class CycleDependedConditionTest : UtValueTestCaseChecker(testClass = CycleDependedCondition::class) {
148
@Test
159
fun testCycleDependedOneCondition() {
16-
val conditionSummary = listOf<DocStatement>(
17-
DocPreTagStatement(
18-
listOf(
19-
DocRegularStmt("Test "),
20-
DocRegularStmt("does not iterate "),
21-
DocCodeStmt("for(int i = 0; i < x; i++)"),
22-
DocRegularStmt(", "),
23-
DocRegularStmt("returns from: "),
24-
DocCodeStmt("return 0;"),
25-
DocRegularStmt("\n"),
26-
)
27-
)
28-
)
2910
check(
3011
CycleDependedCondition::oneCondition,
3112
eq(3),
3213
{ x, r -> x <= 0 && r == 0 },
3314
{ x, r -> x in 1..2 && r == 0 },
34-
{ x, r -> x > 2 && r == 1 },
35-
summaryTextChecks = listOf(
36-
keyContain(DocCodeStmt("(i == 2): True")),
37-
keyContain(DocCodeStmt("(i == 2): False")),
38-
keyMatch(conditionSummary)
39-
),
40-
summaryNameChecks = listOf(
41-
keyMatch("testOneCondition_IEquals2"),
42-
keyMatch("testOneCondition_INotEquals2"),
43-
keyMatch("testOneCondition_ReturnZero"),
44-
),
45-
summaryDisplayNameChecks = listOf(
46-
keyContain("i == 2 : True"),
47-
keyContain("i == 2 : False"),
48-
keyContain("return 0"),
49-
)
15+
{ x, r -> x > 2 && r == 1 }
5016
)
5117
}
5218

5319
@Test
5420
fun testCycleDependedTwoCondition() {
55-
val conditionSummary = listOf<DocStatement>(
56-
DocPreTagStatement(
57-
listOf(
58-
DocRegularStmt("Test "),
59-
DocRegularStmt("does not iterate "),
60-
DocCodeStmt("for(int i = 0; i < x; i++)"),
61-
DocRegularStmt(", "),
62-
DocRegularStmt("returns from: "),
63-
DocCodeStmt("return 0;"),
64-
DocRegularStmt("\n"),
65-
)
66-
)
67-
)
6821
check(
6922
CycleDependedCondition::twoCondition,
7023
eq(4),
7124
{ x, r -> x <= 0 && r == 0 },
7225
{ x, r -> x in 1..3 && r == 0 },
7326
{ x, r -> x == 4 && r == 1 },
74-
{ x, r -> x >= 5 && r == 0 },
75-
summaryTextChecks = listOf(
76-
keyContain(DocCodeStmt("(x == 4): False")),
77-
keyContain(DocCodeStmt("(i > 2): True")),
78-
keyContain(DocCodeStmt("(i > 2): False")),
79-
keyMatch(conditionSummary)
80-
),
81-
summaryNameChecks = listOf(
82-
keyMatch("testTwoCondition_XNotEquals4"),
83-
keyMatch("testTwoCondition_XEquals4"),
84-
keyMatch("testTwoCondition_ILessOrEqual2"),
85-
keyMatch("testTwoCondition_ReturnZero"),
86-
),
87-
summaryDisplayNameChecks = listOf(
88-
keyContain("x == 4 : False"),
89-
keyContain("x == 4 : True"),
90-
keyContain("i > 2 : False"),
91-
keyContain("return 0"),
92-
)
27+
{ x, r -> x >= 5 && r == 0 }
9328
)
9429
}
9530

utbot-framework-test/src/test/kotlin/org/utbot/examples/controlflow/CyclesTest.kt

Lines changed: 3 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
package org.utbot.examples.controlflow
22

3-
import org.utbot.framework.plugin.api.DocCodeStmt
4-
import org.utbot.framework.plugin.api.DocPreTagStatement
5-
import org.utbot.framework.plugin.api.DocRegularStmt
6-
import org.utbot.framework.plugin.api.DocStatement
73
import org.junit.jupiter.api.Test
84
import org.utbot.testcheckers.eq
95
import org.utbot.testing.UtValueTestCaseChecker
106
import org.utbot.testing.atLeast
117
import org.utbot.testing.between
128
import org.utbot.testing.ignoreExecutionsNumber
139
import org.utbot.testing.isException
14-
import org.utbot.testing.keyContain
15-
import org.utbot.testing.keyMatch
1610

1711
internal class CyclesTest : UtValueTestCaseChecker(testClass = Cycles::class) {
1812
@Test
@@ -28,40 +22,12 @@ internal class CyclesTest : UtValueTestCaseChecker(testClass = Cycles::class) {
2822

2923
@Test
3024
fun testForCycleFour() {
31-
val cycleSummary = listOf<DocStatement>(
32-
DocPreTagStatement(
33-
listOf(
34-
DocRegularStmt("Test "),
35-
DocRegularStmt("does not iterate "),
36-
DocCodeStmt("for(int i = 0; i < x; i++)"),
37-
DocRegularStmt(", "),
38-
DocRegularStmt("returns from: "),
39-
DocCodeStmt("return -1;"),
40-
DocRegularStmt("\n"),
41-
)
42-
)
43-
)
4425
check(
4526
Cycles::forCycleFour,
4627
eq(3),
4728
{ x, r -> x <= 0 && r == -1 },
4829
{ x, r -> x in 1..4 && r == -1 },
49-
{ x, r -> x > 4 && r == 1 },
50-
summaryTextChecks = listOf(
51-
keyContain(DocCodeStmt("(i > 4): True")),
52-
keyContain(DocCodeStmt("(i > 4): False")),
53-
keyMatch(cycleSummary)
54-
),
55-
summaryNameChecks = listOf(
56-
keyMatch("testForCycleFour_IGreaterThan4"),
57-
keyMatch("testForCycleFour_ILessOrEqual4"),
58-
keyMatch("testForCycleFour_ReturnNegative1")
59-
),
60-
summaryDisplayNameChecks = listOf(
61-
keyContain("i > 4 : True"),
62-
keyContain("i > 4 : False"),
63-
keyContain("return -1")
64-
)
30+
{ x, r -> x > 4 && r == 1 }
6531
)
6632
}
6733

@@ -100,101 +66,18 @@ internal class CyclesTest : UtValueTestCaseChecker(testClass = Cycles::class) {
10066
check(
10167
Cycles::callInnerWhile,
10268
between(1..2),
103-
{ x, r -> x >= 42 && r == Cycles().callInnerWhile(x) },
104-
summaryTextChecks = listOf(
105-
keyContain(DocCodeStmt("return innerWhile(value, 42);")),
106-
),
107-
summaryNameChecks = listOf(
108-
keyMatch("testCallInnerWhile_IterateWhileLoop")
109-
)
69+
{ x, r -> x >= 42 && r == Cycles().callInnerWhile(x) }
11070
)
11171
}
11272

11373
@Test
11474
fun testInnerLoop() {
115-
val innerLoopSummary1 = arrayOf(
116-
DocRegularStmt("Test "),
117-
DocRegularStmt("calls "),
118-
DocRegularStmt("CycleDependedCondition::twoCondition"),
119-
DocRegularStmt(",\n there it "),
120-
DocRegularStmt("iterates the loop "),
121-
DocRegularStmt(""),
122-
DocCodeStmt("for(int i = 0; i < x; i++)"),
123-
DocRegularStmt(" "),
124-
DocRegularStmt("once"),
125-
DocRegularStmt(""),
126-
DocRegularStmt(". "),
127-
DocRegularStmt("\n Test "),
128-
// DocRegularStmt("afterwards "),
129-
DocRegularStmt("returns from: "),
130-
DocCodeStmt("return 0;"),
131-
DocRegularStmt("\n "),
132-
DocRegularStmt("\nTest "),
133-
// DocRegularStmt("afterwards "),
134-
DocRegularStmt("returns from: "),
135-
DocCodeStmt("return cycleDependedCondition.twoCondition(value);"),
136-
DocRegularStmt("\n"),
137-
)
138-
val innerLoopSummary2 = arrayOf(
139-
DocRegularStmt("Test "),
140-
DocRegularStmt("calls "),
141-
DocRegularStmt("CycleDependedCondition::twoCondition"),
142-
DocRegularStmt(",\n there it "),
143-
DocRegularStmt("iterates the loop "),
144-
DocRegularStmt(""),
145-
DocCodeStmt("for(int i = 0; i < x; i++)"),
146-
DocRegularStmt(" "),
147-
DocRegularStmt("4 times"),
148-
DocRegularStmt(""),
149-
DocRegularStmt(",\n "),
150-
DocRegularStmt(" "),
151-
DocRegularStmt("inside this loop, the test "),
152-
DocRegularStmt("executes conditions:\n "),
153-
DocRegularStmt(""),
154-
DocCodeStmt("(i > 2): True"),
155-
DocRegularStmt(",\n "),
156-
DocCodeStmt("(x == 4): True"),
157-
DocRegularStmt("\n returns from: "),
158-
DocCodeStmt("return 1;"),
159-
DocRegularStmt("\nTest "),
160-
// DocRegularStmt("afterwards "),
161-
DocRegularStmt("returns from: "),
162-
DocCodeStmt("return cycleDependedCondition.twoCondition(value);"),
163-
DocRegularStmt("\n"),
164-
)
165-
val innerLoopSummary3 = arrayOf(
166-
DocRegularStmt("Test "),
167-
DocRegularStmt("calls "),
168-
DocRegularStmt("CycleDependedCondition::twoCondition"),
169-
DocRegularStmt(",\n there it "),
170-
DocRegularStmt("iterates the loop "),
171-
DocCodeStmt("for(int i = 0; i < x; i++)"),
172-
DocRegularStmt("5 times"),
173-
DocRegularStmt("inside this loop, the test "),
174-
DocRegularStmt("executes conditions:\n "),
175-
DocCodeStmt("(x == 4): False"),
176-
DocRegularStmt("\n Test "),
177-
DocRegularStmt("returns from: "),
178-
DocCodeStmt("return 0;"),
179-
DocCodeStmt("return cycleDependedCondition.twoCondition(value);"),
180-
)
18175
check(
18276
Cycles::innerLoop,
18377
ignoreExecutionsNumber,
18478
{ x, r -> x in 1..3 && r == 0 },
18579
{ x, r -> x == 4 && r == 1 },
186-
{ x, r -> x >= 5 && r == 0 },
187-
// TODO JIRA:1442
188-
/* summaryTextChecks = listOf(
189-
keyContain(*innerLoopSummary1),
190-
keyContain(*innerLoopSummary2),
191-
keyContain(*innerLoopSummary3)
192-
),
193-
summaryNameChecks = listOf(
194-
keyMatch("testInnerLoop_ReturnZero"),
195-
keyMatch("testInnerLoop_XEquals4"),
196-
keyMatch("testInnerLoop_XNotEquals4")
197-
)*/
80+
{ x, r -> x >= 5 && r == 0 }
19881
)
19982
}
20083

utbot-framework-test/src/test/kotlin/org/utbot/examples/controlflow/SwitchTest.kt

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package org.utbot.examples.controlflow
22

3-
import org.utbot.framework.plugin.api.DocCodeStmt
4-
import org.utbot.framework.plugin.api.DocPreTagStatement
5-
import org.utbot.framework.plugin.api.DocRegularStmt
6-
import org.utbot.framework.plugin.api.DocStatement
73
import java.math.RoundingMode.CEILING
84
import java.math.RoundingMode.DOWN
95
import java.math.RoundingMode.HALF_DOWN
@@ -14,49 +10,17 @@ import org.utbot.testcheckers.eq
1410
import org.utbot.testcheckers.ge
1511
import org.utbot.testcheckers.withoutMinimization
1612
import org.utbot.testing.UtValueTestCaseChecker
17-
import org.utbot.testing.keyContain
18-
import org.utbot.testing.keyMatch
1913

2014
internal class SwitchTest : UtValueTestCaseChecker(testClass = Switch::class) {
2115
@Test
2216
fun testSimpleSwitch() {
23-
val switchCaseSummary = listOf<DocStatement>(
24-
DocPreTagStatement(
25-
listOf(
26-
DocRegularStmt("Test "),
27-
DocRegularStmt("activates switch case: "),
28-
DocCodeStmt("default"),
29-
DocRegularStmt(", "),
30-
DocRegularStmt("returns from: "),
31-
DocCodeStmt("return -1;"),
32-
DocRegularStmt("\n"),
33-
)
34-
)
35-
)
3617
check(
3718
Switch::simpleSwitch,
3819
ge(4),
3920
{ x, r -> x == 10 && r == 10 },
4021
{ x, r -> (x == 11 || x == 12) && r == 12 }, // fall-through has it's own branch
4122
{ x, r -> x == 13 && r == 13 },
4223
{ x, r -> x !in 10..13 && r == -1 }, // one for default is enough
43-
summaryTextChecks = listOf(
44-
keyContain(DocCodeStmt("return 10;")),
45-
keyContain(DocCodeStmt("return 12;")),
46-
keyContain(DocCodeStmt("return 12;")),
47-
keyContain(DocCodeStmt("return 13;")),
48-
keyMatch(switchCaseSummary)
49-
),
50-
summaryNameChecks = listOf(
51-
keyMatch("testSimpleSwitch_Return10"),
52-
keyMatch("testSimpleSwitch_Return13"),
53-
keyMatch("testSimpleSwitch_ReturnNegative1"),
54-
),
55-
summaryDisplayNameChecks = listOf(
56-
keyMatch("switch(x) case: 10 -> return 10"),
57-
keyMatch("switch(x) case: 13 -> return 13"),
58-
keyMatch("switch(x) case: Default -> return -1"),
59-
)
6024
)
6125
}
6226

0 commit comments

Comments
 (0)