import java.io.IOException;

import org.junit.Test;
import org.polymodel.x10p.Program;
import org.polymodel.x10p.X10pParser;
import org.polymodel.x10p.analysis.HappensBefore;
import org.polymodel.x10p.util.X10pUnparser;


public class ParserTest {
	
	private static final String ROOT = "./x10src/";

	@Test
	public void testMatrixProduct() {
		test(ROOT+"matrix_product.x10p");
	}
	
	@Test
	public void ex9() {
		test(ROOT+"ex9.x10p");
	}

	@Test
	public void ex60() {
		test(ROOT+"ex60.x10p");
	}
	

	private void test(String file) {
		System.out.println(file +":\n");
		try {
			Program prog = X10pParser.loadModel(file);
			System.out.println(X10pUnparser.unparseWithTimeStamps(prog));
			System.out.println(prog.getAssignments());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
