@@ -51,4 +51,49 @@ class SummaryConditionsTest : SummaryTestCaseGeneratorTest(
51
51
52
52
summaryCheck(method, mockStrategy, coverage, summaryKeys, methodNames, displayNames)
53
53
}
54
+
55
+ @Test
56
+ fun testReturnCastFromTernaryOperator () {
57
+ val summary1 = " @utbot.classUnderTest {@link Conditions}\n " +
58
+ " @utbot.methodUnderTest {@link org.utbot.examples.controlflow.Conditions#returnCastFromTernaryOperator(long,int)}\n " +
59
+ " @utbot.returnsFrom {@code return (int) (a < 0 ? a + b : a);}\n "
60
+ val summary2 = " @utbot.classUnderTest {@link Conditions}\n " +
61
+ " @utbot.methodUnderTest {@link org.utbot.examples.controlflow.Conditions#returnCastFromTernaryOperator(long,int)}\n " +
62
+ " @utbot.returnsFrom {@code return (int) (a < 0 ? a + b : a);}\n "
63
+ val summary3 = " @utbot.classUnderTest {@link Conditions}\n " +
64
+ " @utbot.methodUnderTest {@link org.utbot.examples.controlflow.Conditions#returnCastFromTernaryOperator(long,int)}\n " +
65
+ " @utbot.throwsException {@link java.lang.ArithmeticException} in: a = a % b;\n "
66
+
67
+ val methodName1 = " testReturnCastFromTernaryOperator_A0aba"
68
+ val methodName2 = " testReturnCastFromTernaryOperator_A0aba_1"
69
+ val methodName3 = " testReturnCastFromTernaryOperator_ThrowArithmeticException"
70
+
71
+ val displayName1 = " return (int) (a < 0 ? a + b : a) : False -> return (int) (a < 0 ? a + b : a)"
72
+ val displayName2 = " return (int) (a < 0 ? a + b : a) : True -> return (int) (a < 0 ? a + b : a)"
73
+ val displayName3 = " a = a % b -> ThrowArithmeticException"
74
+
75
+ val summaryKeys = listOf (
76
+ summary1,
77
+ summary2,
78
+ summary3
79
+ )
80
+
81
+ val displayNames = listOf (
82
+ displayName1,
83
+ displayName2,
84
+ displayName3
85
+ )
86
+
87
+ val methodNames = listOf (
88
+ methodName1,
89
+ methodName2,
90
+ methodName3
91
+ )
92
+
93
+ val method = Conditions ::returnCastFromTernaryOperator
94
+ val mockStrategy = MockStrategyApi .NO_MOCKS
95
+ val coverage = DoNotCalculate
96
+
97
+ summaryCheck(method, mockStrategy, coverage, summaryKeys, methodNames, displayNames)
98
+ }
54
99
}
0 commit comments