package pp.s1184725.boppi.test;

import java.nio.file.*;
import java.util.logging.Level;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

/**
 * Test suite for all Boppi compiler stages and language features
 */
@RunWith(Suite.class)
@SuiteClasses({ CheckerTest.class, GeneratorTest.class, ParserTest.class })
public class AllTests {
	/**
	 * The location of test programs
	 */
	public static final Path directory = Paths
			.get("src/" + AllTests.class.getPackage().getName().replaceAll("\\.", "/") + "/programs/");

	/**
	 * The level of error reporting to use for the tests. Can be changed to
	 * include finer tests.
	 */
	public static Level logLevel = Level.SEVERE;

	/**
	 * Runs a test with warnings enabled.
	 * 
	 * @param test
	 *            the test to run
	 */
	public static void withWarnings(Runnable test) {
		logLevel = Level.WARNING;
		test.run();
		logLevel = Level.SEVERE;
	}
}
