322 323 private static Path[] paths(String testDir, String[] files, boolean platformDependent) { 324 boolean isWindows = System.getProperty("os.name").startsWith("Windows"); 325 return Arrays.stream(files) 326 .map(f -> Paths.get(testDir, "compare", isWindows && platformDependent ? "windows" : "", f)) 327 .toArray(Path[]::new); 328 } 329 330 @Factory(dataProvider = "cases") 331 public static Object[] run(String nativeSrc, String pkgName, String[] javaSrcFiles, boolean platformDependent) { 332 String testDir = System.getProperty("test.src", "."); 333 System.out.println("Use test case files in " + testDir); 334 return new Object[] { 335 new Runner(Paths.get(testDir, nativeSrc), pkgName, paths(testDir, javaSrcFiles, platformDependent)) 336 }; 337 } 338 339 @DataProvider(name = "cases") 340 public static Object[][] cases() { 341 return new Object[][] { 342 { "simple.h", "com.acme", new String[] { "simple.java" }, true}, 343 { "recursive.h", "com.acme", new String[] { "recursive.java" }, false}, 344 { "TypedefAnonStruct.h", "com.acme", new String[] { "TypedefAnonStruct.java" }, false}, 345 { "pad.h", "com.acme", new String[] { "pad.java" }, false}, 346 { "bitfields.h", "com.acme", new String[] { "bitfields.java" }, true}, 347 { "globalFuncPointer.h", "com.acme", new String[] { "globalFuncPointer.java" }, false} 348 }; 349 } 350 } | 322 323 private static Path[] paths(String testDir, String[] files, boolean platformDependent) { 324 boolean isWindows = System.getProperty("os.name").startsWith("Windows"); 325 return Arrays.stream(files) 326 .map(f -> Paths.get(testDir, "compare", isWindows && platformDependent ? "windows" : "", f)) 327 .toArray(Path[]::new); 328 } 329 330 @Factory(dataProvider = "cases") 331 public static Object[] run(String nativeSrc, String pkgName, String[] javaSrcFiles, boolean platformDependent) { 332 String testDir = System.getProperty("test.src", "."); 333 System.out.println("Use test case files in " + testDir); 334 return new Object[] { 335 new Runner(Paths.get(testDir, nativeSrc), pkgName, paths(testDir, javaSrcFiles, platformDependent)) 336 }; 337 } 338 339 @DataProvider(name = "cases") 340 public static Object[][] cases() { 341 return new Object[][] { 342 { "simple.h", "com.acme", new String[] { "simple_h.java" }, true}, 343 { "recursive.h", "com.acme", new String[] { "recursive_h.java" }, false}, 344 { "TypedefAnonStruct.h", "com.acme", new String[] { "TypedefAnonStruct_h.java" }, false}, 345 { "pad.h", "com.acme", new String[] { "pad_h.java" }, false}, 346 { "bitfields.h", "com.acme", new String[] { "bitfields_h.java" }, true}, 347 { "globalFuncPointer.h", "com.acme", new String[] { "globalFuncPointer_h.java" }, false} 348 }; 349 } 350 } |