package select;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;

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 SelectTest {
	private File rootDirectory = new File(Example.exampleDirectory, "select");
	private File repository = new File(rootDirectory, "TASSREP");

	@Test
	public void select1() throws IOException, SyntaxException {
		VerifyConfiguration config1 = new VerifyConfiguration(repository);
		ModelIF model1;

		config1.setSourceFile(new File(rootDirectory, "select1.c"));
		config1.setModelName("select1");
		config1.setNumProcs(1);
		config1.setVerbose(false);
		model1 = ModelExtractor.extractModel(config1);
		assertTrue(Verification.verify(model1, config1, true));
	}

	@Test
	public void select2() throws IOException, SyntaxException {
		VerifyConfiguration config1 = new VerifyConfiguration(repository);
		ModelIF model1;

		config1.setSourceFile(new File(rootDirectory, "select2.c"));
		config1.setModelName("select2");
		config1.setNumProcs(1);
		config1.setVerbose(false);
		model1 = ModelExtractor.extractModel(config1);
		assertFalse(Verification.verify(model1, config1, true));
	}

	@Test
	public void select3() throws IOException, SyntaxException {
		VerifyConfiguration config1 = new VerifyConfiguration(repository);
		ModelIF model1;

		config1.setSourceFile(new File(rootDirectory, "select3.c"));
		config1.setModelName("select3");
		config1.setNumProcs(1);
		config1.setVerbose(false);
		model1 = ModelExtractor.extractModel(config1);
		assertFalse(Verification.verify(model1, config1, true));
	}

}
