



import java.io.*;

public class VelocityTest extends AbstractTest {

  public VelocityTest(FileWriter stream) {
      super(stream);
      className = "Velocity";
      fileName = "Velocity.java";
  }

  public void functionalSuite(){
      testScript1();
	testScript2();
	testScript3();
	testScript4();
	testScript5();
	testScript6();
	testScript7();
	testScript8();

  }

  public void structuralSuite(){}
  public void interactionSuite(){}
  public void baselineSuite(){}
  public void regressionSuite(){}

  public boolean classInvariant(){
      return ((Velocity)OUT).direction <=360 && ((Velocity)OUT).direction >=0;
  }

  protected boolean testScript1(){
      OUT = new Velocity();
      boolean result = testCase1();
      logTestResult("Script1",result && classInvariant());
      return result;
  }

  protected boolean testCase1(){
      if (((Velocity)OUT).direction == 0 && ((Velocity)OUT).speed == 0){
          return true;
      }
      else return false;
  }

  protected boolean testScript2(){
      OUT = new Velocity(100,180);
      boolean result = testCase2();
      logTestResult("Script2",result && classInvariant());
	logTestResult("xspeed = "+((Velocity)OUT).xSpeed,true);
      return result;
  }


  protected boolean testCase2(){
      if (((Velocity)OUT).direction == 180 && ((Velocity)OUT).xSpeed <= -99 && ((Velocity)OUT).xSpeed >= -101){
          return true;
      }
      else return false;
  }


	protected boolean testScript3(){
      OUT = new Velocity(100,90);
      boolean result = testCase3();
      logTestResult("Script3",result && classInvariant());
	logTestResult("xspeed = "+((Velocity)OUT).xSpeed,true);
	logTestResult("yspeed = "+((Velocity)OUT).ySpeed,true);
      return result;
  }


  protected boolean testCase3(){
      if (((Velocity)OUT).direction == 90 && ((Velocity)OUT).xSpeed <= 1 && ((Velocity)OUT).xSpeed >= -1 && ((Velocity)OUT).ySpeed >= 99){
          return true;
      }
      else return false;
  }
protected boolean testScript4(){
      OUT = new Velocity(100,270);
      boolean result = testCase4();
      logTestResult("Script4",result && classInvariant());
	logTestResult("direction = "+((Velocity)OUT).direction,true);
	logTestResult("xspeed = "+((Velocity)OUT).xSpeed,true);
	logTestResult("yspeed = "+((Velocity)OUT).ySpeed,true);
      return result;
  }


  protected boolean testCase4(){
      if (((Velocity)OUT).direction == 180 && ((Velocity)OUT).xSpeed <= 1 && ((Velocity)OUT).ySpeed >= -101 && ((Velocity)OUT).ySpeed <= -99){
          return true;
      }
      else return false;
  }


	protected boolean testScript5(){
      OUT = new Velocity(100,45);
      boolean result = testCase5();
      logTestResult("Script5",result && classInvariant());
	logTestResult("direction = "+((Velocity)OUT).direction,true);
	logTestResult("xspeed = "+((Velocity)OUT).xSpeed,true);
	logTestResult("yspeed = "+((Velocity)OUT).ySpeed,true);
      return result;
  }


  protected boolean testCase5(){
      if (((Velocity)OUT).direction == 45 && ((Velocity)OUT).xSpeed <= 71 && ((Velocity)OUT).ySpeed >= 69 && ((Velocity)OUT).ySpeed <= 71){
          return true;
      }
      else return false;
  }

protected boolean testScript6(){
      OUT = new Velocity(100,45);
      boolean result = testCase6();
      logTestResult("Script6",result && classInvariant());
	logTestResult("direction = "+((Velocity)OUT).direction,true);
	logTestResult("xspeed = "+((Velocity)OUT).xSpeed,true);
	logTestResult("yspeed = "+((Velocity)OUT).ySpeed,true);
      return result;
  }


  protected boolean testCase6(){
	((Velocity)OUT).reverseX();
      if (((Velocity)OUT).direction == 45 && ((Velocity)OUT).xSpeed <= 71 && ((Velocity)OUT).ySpeed >= 69 && ((Velocity)OUT).ySpeed <= 71){
          return true;
      }
      else return false;
  }

protected boolean testScript7(){
      OUT = new Velocity(100,45);
      boolean result = testCase7();
      logTestResult("Script7",result && classInvariant());
	logTestResult("direction = "+((Velocity)OUT).direction,true);
	logTestResult("xspeed = "+((Velocity)OUT).xSpeed,true);
	logTestResult("yspeed = "+((Velocity)OUT).ySpeed,true);
      return result;
  }


  protected boolean testCase7(){
	((Velocity)OUT).reverseY();
      if (((Velocity)OUT).direction == 45 && ((Velocity)OUT).xSpeed <= 71 && ((Velocity)OUT).ySpeed >= 69 && ((Velocity)OUT).ySpeed <= 71){
          return true;
      }
      else return false;
  }

protected boolean testScript8(){
      OUT = new Velocity(100,45);
      boolean result = testCase8();
      logTestResult("Script8",result && classInvariant());
	logTestResult("direction = "+((Velocity)OUT).direction,true);
	logTestResult("xspeed = "+((Velocity)OUT).xSpeed,true);
	logTestResult("yspeed = "+((Velocity)OUT).ySpeed,true);
      return result;
  }


  protected boolean testCase8(){
	((Velocity)OUT).setSpeed(200);
      if (((Velocity)OUT).direction == 45 && ((Velocity)OUT).xSpeed <= 71 && ((Velocity)OUT).ySpeed >= 69 && ((Velocity)OUT).ySpeed <= 71){
          return true;
      }
      else return false;
  }

 // protected void showTestMenu(){
 //     super.showTestMenu();
 // }

  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();
      }
      VelocityTest tester = new VelocityTest(f);
      tester.testProcess();

      try{
          f.close();
      }catch(IOException e){
          e.printStackTrace();
      }

  }
  private static FileWriter f;

}