(****
 *
 * Module Tests defines the objects and operations related to taking in class, take home, and practice
 * tests along with viewing graded tests inside the StudentInterface.
 *
 *)

module Tests;

 object TakeTest is
	components: InClass and TakeHome and Practice;
	operations: ...;
	description: (*
		TakeTest is the menu where a student selects what type of test they need to take. The
		InClassTest is the option for tests to be taken in class, the TakeHomeTest is the
		option for tests to be taken out of class, and the PracticeTest is the option for
		tests to be taken just as practice for the real test. InClassTest, TakeHomeTest, and
		PracticeTest are all options of TakeTest, but only one type of test may be taken at a
		time in the StudentInterface.
	*);
 end TakeTest;

 object TestLocationScreen is
	components: Location;
	description: (*
		The TestLocationScreen is the interface where a student types in the location of the
		test he needs to take. The location can be an IP Address or a unique network address.
		When a student is done entering the location of the test, the StudentInterface retrieves
		the test from the specified location and displays it in the StudentInterface.
	*);
 end TestLocationScreen;

 operation InClassTest is
	inputs: LocationAddress;
	outputs: Test;
	description: (*
		InClassTest will retrieve a test file at the specified LocationAddress and display
		it in the StudentInterface. If the LocationAddress cannot be found or does not exist,
		a prompt appears stating the specified location could not be found. The LocationAddress
		must also be thirty characters or less and must be a single string.
	*);

 precondition: 
	(*
	 * The LocationAddress must exist and must be accessible to the student from the 
	 * StudentInterface. The test must also exist and be accessible to the student when attempting
	 * to retrieve the test.
	 *)
	(exists (la:LocationAddress) (Location = la));

 postcondition:
	(*
	 * The test is found in the Location at the LocationAddress, retrieved from the LocationAddress,
	 * and then displayed in the StudentInterface.
	 *)
	(Test in StudentInterface);

 end InClassTest;

 operation TakeHomeTest is
	inputs: tf:TestFile and fod:FileOpenDialog;
	outputs: t:Test;
	description: (*
		TakeHomeTest will open a test from an accessible directory a student retrieved from
		blackboard or a professor's website. Instead of retrieving a test at a specific 
		location, the student downloads the test file and opens the file using the 
		TakeHomeTest operation. The operation uses the FileOpenDialog interface to open 
		the test file into the StudentInterface. The Save and Save as File operations 
		are also enabled.
	*);

 precondition:
	(*
	 * The test file must exist and be accessible to the student in a directory on his home computer or
	 * an individual computer terminal. It must also be downloaded first from a website or other
	 * distributor.
	 *)
	(exists (tf in fod) (tf = t));

 postcondition:
	(*
	 * The test is opened and displayed inside the StudentInterface from the student's home directory.
	 *)
	(t in StudentInterface);

 end TakeHomeTest;

 operation PracticeTest is
	inputs: tf:TestFile and fod:FileOpenDialog;
	outputs: t:Test;
	description: (*
		PracticeTest will open a test from an accessible directory a student retrieved from
		blackboard or a professor's website. Instead of retrieving a test at a specific 
		location, the student downloads the test file and opens the file using the 
		PracticeTest operation. The operation uses the FileOpenDialog interface to open 
		the test file into the StudentInterface. The Save and Save as File operations 
		are also enabled. What makes the PracticeTest operation different is the test it
		opens in the StudentInterface cannot be submitted for grading once completed.
	*);

 precondition:
	(*
	 * The test file must exist and be accessible to the student in a directory on his home computer or
	 * an individual computer terminal. It must also be downloaded first from a website or other
	 * distributor.
	 *)
	(exists (tf in fod) (tf = t));

 postcondition:
	(*
	 * The test is opened and displayed inside the StudentInterface from the student's home directory.
	 *)
	(t in StudentInterface);

 end PracticeTest;

 operation CheckGradedTest is
	inputs: LocationAddress;
	outputs: grdt:Test;
	description: (*
		CheckGradedTest will retrieve a graded test file at the specified LocationAddress and
		display it in the StudentInterface. If the LocationAddress cannot be found or does not
		exist, a prompt appears stating the specified location could not be found. The 
		LocationAddress must also be thirty characters or less and must be a single string.
	*);

 precondition: 
	(*
	 * The LocationAddress must exist and must be accessible to the student from the 
	 * StudentInterface. The test must also exist and be accessible to the student when attempting
	 * to retrieve the test.
	 *)
	(exists (la:Location) (Location = la));

 postcondition:
	(*
	 * The graded test is found in the Location at the LocationAddress, retrieved from the 
	 * LocationAddress, and then displayed in the StudentInterface.
	 *)
	(grdt in StudentInterface);

 end CheckGradedTest;

end Tests;