source: java2python/src/test/java/tudelft/utilities/j2p/ObjectFunctionsTest.java@ 346

Last change on this file since 346 was 346, checked in by wouter, 2 years ago

version 0.1 of automatic java to python translator. Can translate some simple programs, lot of work remains to be done

File size: 828 bytes
Line 
1package tudelft.utilities.j2p;
2
3import static org.junit.Assert.assertEquals;
4
5import java.io.IOException;
6import java.util.List;
7
8import org.junit.Test;
9
10public class ObjectFunctionsTest extends PyTest {
11
12 private static final String TESTDIR = "src/test/java/";
13 private static final String FULLNAME = "testcode/ObjectFunctions.java";
14
15 @Test
16 public void test() throws IOException, ClassNotFoundException {
17 System.out.println("TRANSLATION:");
18 System.out.println(translate(TESTDIR + FULLNAME));
19 }
20
21 @Test
22 public void runInPython() throws Exception {
23
24 List<String> res = runPython(translate(TESTDIR + FULLNAME),
25 FULLNAME.replace(".java", ".py"));
26 // we convert to lowercase as python bool is True
27 assertEquals(1, res.size());
28 assertEquals("12true12", res.get(0).toLowerCase());
29 System.out.println(res);
30
31 }
32}
Note: See TracBrowser for help on using the repository browser.