package tests;

import java.util.Collection;

/**
 * Test class used to generate tests for the test tool
 *
 * @author Allen Wong
 * @version 1.0
 *
 */
public abstract class Test {
   Date opens;
   Date closes;
   Time limit;
   String name;
   Password password;
   Difficulty diff;
   classID id;
   int section;
   Collection<Question> questions;
   /**
    * Method generateTest creates a test based on the variables set in a test
    */
   /*@
     requires
       // 
       // The name field is not empty.
       //
       (test.name != null)
       
           &&
       //
       // The time opens does not start when the time closes
       //
       (test.opens.time.hour != test.closes.time.hour && test.opens.time.minute != test.closes.time.minute && test.opens.time.amORpm != test.closes.time.amORpm)
       
           &&
       //
       // Make sure a password is set when yes button is marked
       //
       (test.password.contains == true && test.password.code.length() >= 1);
       
      ensures
       //
       // If all preconds met, a collection of questions items are made
       // and put into the a test for the test database
       // and ready to be taken by students
       //
       (test.questions != null);
   
   @*/
   abstract void generateTest(Test test);

   /**
    * Method removeTest removes selected test from the test database
    */
   /*@
     requires
     //
     // A test in a database
     // 
     (test != null);
     
     //@ ensures
     //
     // If precond is met, the selected test will be removed form the database
     //
     \old(test) == null;
   @*/
   abstract void removeTest(Test test);

   /**
    * Method viewTest allows questions from the test to be looked at
    */

   /*@
     requires
     //
     // A test in the database
     //
     (test != null);

     ensures
     //
     // If precond is met, questions from selected test can be viewed
     // 
     (test.questions != null);
   @*/
   abstract void viewTest(Test test);
}