2020
2121import au .com .integradev .delphi .builders .DelphiTestUnitBuilder ;
2222import au .com .integradev .delphi .checks .verifier .CheckVerifier ;
23- import org .junit .jupiter .api .Test ;
23+ import au .com .integradev .delphi .compiler .CompilerVersion ;
24+ import org .junit .jupiter .params .ParameterizedTest ;
25+ import org .junit .jupiter .params .provider .ValueSource ;
2426
2527class PlatformDependentCastCheckTest {
26- @ Test
27- void testPointerIntegerCastsShouldAddIssue () {
28+ private static final String VERSION_ALEXANDRIA = "VER350" ;
29+ private static final String VERSION_ATHENS = "VER360" ;
30+
31+ @ ParameterizedTest
32+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
33+ void testPointerIntegerCastsShouldAddIssue (String versionSymbol ) {
2834 CheckVerifier .newVerifier ()
2935 .withCheck (new PlatformDependentCastCheck ())
36+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
3037 .onFile (
3138 new DelphiTestUnitBuilder ()
3239 .appendImpl ("procedure Foo;" )
@@ -40,10 +47,12 @@ void testPointerIntegerCastsShouldAddIssue() {
4047 .verifyIssues ();
4148 }
4249
43- @ Test
44- void testObjectIntegerCastsShouldAddIssue () {
50+ @ ParameterizedTest
51+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
52+ void testObjectIntegerCastsShouldAddIssue (String versionSymbol ) {
4553 CheckVerifier .newVerifier ()
4654 .withCheck (new PlatformDependentCastCheck ())
55+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
4756 .onFile (
4857 new DelphiTestUnitBuilder ()
4958 .appendImpl ("procedure Foo;" )
@@ -57,10 +66,12 @@ void testObjectIntegerCastsShouldAddIssue() {
5766 .verifyIssues ();
5867 }
5968
60- @ Test
61- void testInterfaceIntegerCastsShouldAddIssue () {
69+ @ ParameterizedTest
70+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
71+ void testInterfaceIntegerCastsShouldAddIssue (String versionSymbol ) {
6272 CheckVerifier .newVerifier ()
6373 .withCheck (new PlatformDependentCastCheck ())
74+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
6475 .onFile (
6576 new DelphiTestUnitBuilder ()
6677 .appendImpl ("procedure Foo;" )
@@ -74,10 +85,12 @@ void testInterfaceIntegerCastsShouldAddIssue() {
7485 .verifyIssues ();
7586 }
7687
77- @ Test
78- void testNativeIntIntegerCastsShouldAddIssue () {
88+ @ ParameterizedTest
89+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
90+ void testNativeIntIntegerCastsShouldAddIssue (String versionSymbol ) {
7991 CheckVerifier .newVerifier ()
8092 .withCheck (new PlatformDependentCastCheck ())
93+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
8194 .onFile (
8295 new DelphiTestUnitBuilder ()
8396 .appendImpl ("procedure Foo;" )
@@ -91,10 +104,12 @@ void testNativeIntIntegerCastsShouldAddIssue() {
91104 .verifyIssues ();
92105 }
93106
94- @ Test
95- void testNativeIntPointerCastsShouldNotAddIssue () {
107+ @ ParameterizedTest
108+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
109+ void testNativeIntPointerCastsShouldNotAddIssue (String versionSymbol ) {
96110 CheckVerifier .newVerifier ()
97111 .withCheck (new PlatformDependentCastCheck ())
112+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
98113 .onFile (
99114 new DelphiTestUnitBuilder ()
100115 .appendImpl ("procedure Foo;" )
@@ -108,10 +123,12 @@ void testNativeIntPointerCastsShouldNotAddIssue() {
108123 .verifyNoIssues ();
109124 }
110125
111- @ Test
112- void testNativeIntObjectCastsShouldNotAddIssue () {
126+ @ ParameterizedTest
127+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
128+ void testNativeIntObjectCastsShouldNotAddIssue (String versionSymbol ) {
113129 CheckVerifier .newVerifier ()
114130 .withCheck (new PlatformDependentCastCheck ())
131+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
115132 .onFile (
116133 new DelphiTestUnitBuilder ()
117134 .appendImpl ("procedure Foo;" )
@@ -125,10 +142,12 @@ void testNativeIntObjectCastsShouldNotAddIssue() {
125142 .verifyNoIssues ();
126143 }
127144
128- @ Test
129- void testNativeIntInterfaceCastsShouldNotAddIssue () {
145+ @ ParameterizedTest
146+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
147+ void testNativeIntInterfaceCastsShouldNotAddIssue (String versionSymbol ) {
130148 CheckVerifier .newVerifier ()
131149 .withCheck (new PlatformDependentCastCheck ())
150+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
132151 .onFile (
133152 new DelphiTestUnitBuilder ()
134153 .appendImpl ("procedure Foo;" )
@@ -142,10 +161,12 @@ void testNativeIntInterfaceCastsShouldNotAddIssue() {
142161 .verifyNoIssues ();
143162 }
144163
145- @ Test
146- void testIntegerLiteralCastsShouldNotAddIssue () {
164+ @ ParameterizedTest
165+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
166+ void testIntegerLiteralCastsShouldNotAddIssue (String versionSymbol ) {
147167 CheckVerifier .newVerifier ()
148168 .withCheck (new PlatformDependentCastCheck ())
169+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
149170 .onFile (
150171 new DelphiTestUnitBuilder ()
151172 .appendImpl ("procedure Foo;" )
@@ -159,10 +180,12 @@ void testIntegerLiteralCastsShouldNotAddIssue() {
159180 .verifyNoIssues ();
160181 }
161182
162- @ Test
163- void testHexadecimalLiteralCastsShouldNotAddIssue () {
183+ @ ParameterizedTest
184+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
185+ void testHexadecimalLiteralCastsShouldNotAddIssue (String versionSymbol ) {
164186 CheckVerifier .newVerifier ()
165187 .withCheck (new PlatformDependentCastCheck ())
188+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
166189 .onFile (
167190 new DelphiTestUnitBuilder ()
168191 .appendImpl ("procedure Foo;" )
@@ -176,10 +199,12 @@ void testHexadecimalLiteralCastsShouldNotAddIssue() {
176199 .verifyNoIssues ();
177200 }
178201
179- @ Test
180- void testBinaryLiteralCastsShouldNotAddIssue () {
202+ @ ParameterizedTest
203+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
204+ void testBinaryLiteralCastsShouldNotAddIssue (String versionSymbol ) {
181205 CheckVerifier .newVerifier ()
182206 .withCheck (new PlatformDependentCastCheck ())
207+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
183208 .onFile (
184209 new DelphiTestUnitBuilder ()
185210 .appendImpl ("procedure Foo;" )
@@ -193,10 +218,12 @@ void testBinaryLiteralCastsShouldNotAddIssue() {
193218 .verifyNoIssues ();
194219 }
195220
196- @ Test
197- void testTObjectStringCastsShouldNotAddIssue () {
221+ @ ParameterizedTest
222+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
223+ void testTObjectStringCastsShouldNotAddIssue (String versionSymbol ) {
198224 CheckVerifier .newVerifier ()
199225 .withCheck (new PlatformDependentCastCheck ())
226+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
200227 .onFile (
201228 new DelphiTestUnitBuilder ()
202229 .appendImpl ("procedure Foo;" )
@@ -210,10 +237,12 @@ void testTObjectStringCastsShouldNotAddIssue() {
210237 .verifyNoIssues ();
211238 }
212239
213- @ Test
214- void testTObjectRecordCastsShouldNotAddIssue () {
240+ @ ParameterizedTest
241+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
242+ void testTObjectRecordCastsShouldNotAddIssue (String versionSymbol ) {
215243 CheckVerifier .newVerifier ()
216244 .withCheck (new PlatformDependentCastCheck ())
245+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
217246 .onFile (
218247 new DelphiTestUnitBuilder ()
219248 .appendDecl ("type" )
@@ -230,10 +259,12 @@ void testTObjectRecordCastsShouldNotAddIssue() {
230259 .verifyNoIssues ();
231260 }
232261
233- @ Test
234- void testRecordIntegerCastsShouldNotAddIssue () {
262+ @ ParameterizedTest
263+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
264+ void testRecordIntegerCastsShouldNotAddIssue (String versionSymbol ) {
235265 CheckVerifier .newVerifier ()
236266 .withCheck (new PlatformDependentCastCheck ())
267+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
237268 .onFile (
238269 new DelphiTestUnitBuilder ()
239270 .appendDecl ("type" )
@@ -249,10 +280,12 @@ void testRecordIntegerCastsShouldNotAddIssue() {
249280 .verifyNoIssues ();
250281 }
251282
252- @ Test
253- void testIntegerStringCastsShouldAddIssue () {
283+ @ ParameterizedTest
284+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
285+ void testIntegerStringCastsShouldAddIssue (String versionSymbol ) {
254286 CheckVerifier .newVerifier ()
255287 .withCheck (new PlatformDependentCastCheck ())
288+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
256289 .onFile (
257290 new DelphiTestUnitBuilder ()
258291 .appendImpl ("procedure Foo;" )
@@ -266,10 +299,12 @@ void testIntegerStringCastsShouldAddIssue() {
266299 .verifyIssues ();
267300 }
268301
269- @ Test
270- void testNativeIntStringCastsShouldNotAddIssue () {
302+ @ ParameterizedTest
303+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
304+ void testNativeIntStringCastsShouldNotAddIssue (String versionSymbol ) {
271305 CheckVerifier .newVerifier ()
272306 .withCheck (new PlatformDependentCastCheck ())
307+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
273308 .onFile (
274309 new DelphiTestUnitBuilder ()
275310 .appendImpl ("procedure Foo;" )
@@ -283,10 +318,12 @@ void testNativeIntStringCastsShouldNotAddIssue() {
283318 .verifyNoIssues ();
284319 }
285320
286- @ Test
287- void testIntegerArrayCastsShouldAddIssue () {
321+ @ ParameterizedTest
322+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
323+ void testIntegerArrayCastsShouldAddIssue (String versionSymbol ) {
288324 CheckVerifier .newVerifier ()
289325 .withCheck (new PlatformDependentCastCheck ())
326+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
290327 .onFile (
291328 new DelphiTestUnitBuilder ()
292329 .appendImpl ("procedure Foo;" )
@@ -300,10 +337,12 @@ void testIntegerArrayCastsShouldAddIssue() {
300337 .verifyIssues ();
301338 }
302339
303- @ Test
304- void testNativeIntArrayCastsShouldNotAddIssue () {
340+ @ ParameterizedTest
341+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
342+ void testNativeIntArrayCastsShouldNotAddIssue (String versionSymbol ) {
305343 CheckVerifier .newVerifier ()
306344 .withCheck (new PlatformDependentCastCheck ())
345+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
307346 .onFile (
308347 new DelphiTestUnitBuilder ()
309348 .appendImpl ("procedure Foo;" )
@@ -317,10 +356,12 @@ void testNativeIntArrayCastsShouldNotAddIssue() {
317356 .verifyNoIssues ();
318357 }
319358
320- @ Test
321- void testStrongAliasCastsShouldAddIssue () {
359+ @ ParameterizedTest
360+ @ ValueSource (strings = {VERSION_ALEXANDRIA , VERSION_ATHENS })
361+ void testStrongAliasCastsShouldAddIssue (String versionSymbol ) {
322362 CheckVerifier .newVerifier ()
323363 .withCheck (new PlatformDependentCastCheck ())
364+ .withCompilerVersion (CompilerVersion .fromVersionSymbol (versionSymbol ))
324365 .onFile (
325366 new DelphiTestUnitBuilder ()
326367 .appendImpl ("procedure Foo;" )
0 commit comments