svelTest/svelTest — pull request #9 by emilyhsia (2014-04-06 05:30:38+00:00)
Title: Python methods to create, compile, and run Svel Java file to test/assert against inputs and outputs

files (created by svel compiler) to test the
user's Java methods.

jextractor:
Provides helper functions to get information about a Java file/class

contains test() function (gloabl) creates new Svel Java file with extracted
method to test, compiles the file, and runs it to test the given the input and output.
test() will print "Test passed" if passed, or "Test failed"
----------
jcreator:
This class creates the Java source file (Svel.java) that calls and checks the Java method to test.
Each testcase "input" and "output" will be passed into the Java program as command line inputs.
The first command line args will be the inputs, and the last will be the output
That way, this file can be compiled and run with each testcase.

For example, if we're testing add() in Add.java:
1. We create the file Svel.java that looks something like this
public class Svel {
public static void main(String[] args) {
int _0 = Integer.parseInt(args[0]);
int _1 = Integer.parseInt(args[1]);
int expected = Integer.parseInt(args[2]);

int actual = Add.add(_0, _1);

System.out.println(expected == actual);
}
}

2. Now we can run in jextractor
$ javac Svel.java
$ java Svel 1 1 2

jfileutil:
Provides helper functions to get information from file paths