package function;

import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.IOException;

import org.junit.Test;

import config.Example;
import edu.udel.cis.vsl.tass.config.VerifyConfiguration;
import edu.udel.cis.vsl.tass.front.minimp.ModelExtractor;
import edu.udel.cis.vsl.tass.model.IF.ModelIF;
import edu.udel.cis.vsl.tass.util.SyntaxException;
import edu.udel.cis.vsl.tass.verify.Verification;

public class FunctionTest {

	@Test
	public void invokeFunction() throws IOException, SyntaxException {
		ModelIF model;
		File rootDirectory = new File(Example.exampleDirectory, "function");
		VerifyConfiguration verifyConfiguration = new VerifyConfiguration(
				new File(rootDirectory, "TASSREP"));

		verifyConfiguration
				.setSourceFile(new File(rootDirectory, "function.c"));
		verifyConfiguration.setModelName("function");
		verifyConfiguration.setNumProcs(1);
		model = ModelExtractor.extractModel(verifyConfiguration);
		assertTrue(Verification.verify(model, verifyConfiguration, true));
	}

	@Test
	public void invokeShadow() throws IOException, SyntaxException {
		ModelIF model;
		File rootDirectory = new File(Example.exampleDirectory, "function");
		VerifyConfiguration verifyConfiguration = new VerifyConfiguration(
				new File(rootDirectory, "TASSREP"));

		verifyConfiguration.setSourceFile(new File(rootDirectory, "shadow.c"));
		verifyConfiguration.setModelName("shadow");
		verifyConfiguration.setNumProcs(1);
		model = ModelExtractor.extractModel(verifyConfiguration);
		assertTrue(Verification.verify(model, verifyConfiguration, true));
	}
}
