Add dependent files

This commit is contained in:
Victor Shcherb 2012-10-02 23:05:23 +02:00
parent 4c212a4190
commit aa7c9ed7c4
17 changed files with 30 additions and 8 deletions

View file

@ -9,4 +9,4 @@ local.properties
*.stillfailing
*.failed
*.log
j2objc
j2objc/

View file

@ -1,6 +1,3 @@
package net.osmand.osm;
import java.util.ArrayList;
import java.util.Collection;
@ -19,7 +16,7 @@ import java.util.List;
*
*
*/
public class MapUtils_2 {
public class MapUtils {
private static final String BASE_SHORT_OSM_URL = "http://osm.org/go/";

View file

@ -4,6 +4,7 @@ import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.CompilationUnit;
import com.google.common.io.Files;
@ -27,6 +28,17 @@ public abstract class CppGenerationTest extends GenerationTest {
System.out.println(getTranslatedFile(type+".m"));
}
protected void assertNoCompilationErrors(CompilationUnit unit) {
for (IProblem problem : unit.getProblems()) {
if(problem.isError()){
System.err.println(problem.getMessage());
}
}
for (IProblem problem : unit.getProblems()) {
assertFalse(problem.getMessage(), problem.isError());
}
}
protected void cppTranslateSourceFile(String source, String typeName) throws IOException {
CompilationUnit unit = translateType(typeName, source);
assertNoCompilationErrors(unit);

View file

@ -67,7 +67,8 @@ public abstract class GenerationTest extends TestCase {
@Override
protected void tearDown() throws Exception {
deleteTempDir(tempDir);
System.out.println(tempDir.getAbsolutePath());
// deleteTempDir(tempDir);
// J2ObjC.reset();
}

View file

@ -12,9 +12,21 @@ public class TranslatorTest extends CppGenerationTest {
// printHeaderAndSource("MapUtils_1");
// }
public void addDependency(String pack, String fileName) throws IOException {
String s = getResourceAstring(pack+"/"+fileName);
s = s.replace("package "+pack.replace('_', '.')+";","");
addSourceFile(s, fileName);
}
public void testMapUtils() throws IOException{
cppTranslateSourceFile(getResourceAstring("MapUtils_2.java"), "MapUtils_2");
printHeaderAndSource("MapUtils_2");
addDependency("net_osmand_osm", "Way.java");
addDependency("net_osmand_osm", "LatLon.java");
addDependency("net_osmand_osm", "Way.java");
addDependency("net_osmand_osm", "Node.java");
addDependency("net_osmand_osm", "Entity.java");
addDependency("net_osmand_osm", "Relation.java");
cppTranslateSourceFile(getResourceAstring("MapUtils_2.java"), "MapUtils");
printHeaderAndSource("MapUtils");
}