Last change
on this file since 353 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:
723 bytes
|
Line | |
---|
1 | package tudelft.utilities.j2p;
|
---|
2 |
|
---|
3 | import static org.junit.Assert.assertEquals;
|
---|
4 |
|
---|
5 | import java.io.IOException;
|
---|
6 | import java.util.Arrays;
|
---|
7 | import java.util.List;
|
---|
8 |
|
---|
9 | import org.junit.Test;
|
---|
10 |
|
---|
11 | public class PersonTest extends PyTest {
|
---|
12 |
|
---|
13 | private static final String TESTDIR = "src/test/java/";
|
---|
14 | private static final String FULLNAME = "testcode/Person.java";
|
---|
15 |
|
---|
16 | @Test
|
---|
17 | public void test() throws IOException, ClassNotFoundException {
|
---|
18 | System.out.println("TRANSLATION:");
|
---|
19 | System.out.println(translate(TESTDIR + FULLNAME));
|
---|
20 | }
|
---|
21 |
|
---|
22 | @Test
|
---|
23 | public void runInPython() throws Exception {
|
---|
24 |
|
---|
25 | List<String> res = runPython(translate(TESTDIR + FULLNAME),
|
---|
26 | FULLNAME.replace(".java", ".py"));
|
---|
27 | assertEquals(Arrays.asList("Person[Kees]"), res);
|
---|
28 | }
|
---|
29 |
|
---|
30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.