package org.spbu.bdd.samples.test;

import java.io.FileInputStream;
import java.util.LinkedList;
import java.util.Set;

import org.junit.Test;
import org.spbu.bdd.samples.assign.AssignBdd;
import org.spbu.bdd.samples.schedule.InstructionDAG;
import org.spbu.bdd.samples.schedule.ScheduleBdd;


public class ScheduleTest {
	static String fileStr = "test/org/spbu/bdd/samples/test/schedule/test";
	
	@Test
	public void testBdd() throws Exception {
		FileInputStream in = new FileInputStream(fileStr+".data");
		InstructionDAG g = new InstructionDAG();
		g.parse(in);
		in.close();
		System.out.println(g.scheduleToString(g.getInitialSchedule()));
		
		long start = System.currentTimeMillis();
		g.doClosure();
		LinkedList<Integer> res = new ScheduleBdd().reschedule(g);
		long time = System.currentTimeMillis() - start;
		System.out.println(time+"\n");
		System.out.println(g.scheduleToString(res));
	}
}
