package bricklesPackage;




import java.io.*;

public class PuckTest extends AbstractTest {

  public PuckTest(FileWriter stream) {
      super(stream);
      className = "Puck";
      fileName = "Puck.java";
  }

  public void functionalSuite(){
      testScript1();
	testScript2();
	testScript3();
	testScript4();

  }

  public void structuralSuite(){}
  public void interactionSuite(){}
  public void baselineSuite(){}
  public void regressionSuite(){}

  public boolean classInvariant(){
      return true;
  }

  protected boolean testScript1(){
      OUT = new Puck(/*new BricklesPlayingField(new BricklesGame(new BricklesView()))*/);
      boolean result = testCase1();
      logTestResult("Script1",result);
      return result;
  }

  protected boolean testCase1(){
  	if(((Puck)OUT)._currentVelocity.getDirection() == 135){
		return true;
	}
	return false;
  }

 protected boolean testScript2(){
      OUT = new Puck(/*new BricklesPlayingField(new BricklesGame(new BricklesView()))*/);
      boolean result = testCase2();
      logTestResult("Script2",result);
      return result;
  }

  protected boolean testCase2(){
	((Puck)OUT).reverseX();
	((Puck)OUT).newLeadingPoint();
  	if(((Puck)OUT)._leadingPoint.x == 166){
		return true;
	}
	return false;
  }

 protected boolean testScript3(){
      OUT = new Puck(/*new BricklesPlayingField(new BricklesGame(new BricklesView()))*/);
      boolean result = testCase3();
      logTestResult("Script3",result);
      return result;
  }

  protected boolean testCase3(){
  	((Puck)OUT).reverseY();
	((Puck)OUT).newLeadingPoint();
  	if(((Puck)OUT)._leadingPoint.y == 106){
		return true;
	}
	return false;
  }

 protected boolean testScript4(){
      OUT = new Puck(/*new BricklesPlayingField(new BricklesGame(new BricklesView()))*/);
      boolean result = testCase4();
      logTestResult("Script4",result);
      return result;
  }

  protected boolean testCase4(){
  	((Puck)OUT).reverseX();
	((Puck)OUT).reverseY();
	((Puck)OUT).newLeadingPoint();
  	if(((Puck)OUT)._leadingPoint.x == 166 && ((Puck)OUT)._leadingPoint.y == 106){
		return true;
	}
	return false;
  }

 

  protected void testDispatch(int which){
      super.testDispatch(which);
      if(which == 1){
         functionalSuite();
      }
  }



   public void finalize(){
      try{
          log.close();
      }catch(IOException e){
          e.printStackTrace();
      }
  }

  public static void main(String[] args){
      try{
          f = new FileWriter("test.rpt");
      }catch(IOException e){
          e.printStackTrace();
      }
      PuckTest tester = new PuckTest(f);
      tester.testProcess();

      try{
          f.close();
      }catch(IOException e){
          e.printStackTrace();
      }

  }
  private static FileWriter f;

}