indexing
	namespace: "candidate"
	cluster: "utility"
	description: "Base facility class for unit testing classes"
	original_author: "Justin Finnerty"
	original_date: "August 2005"
	current_date: "$Date: 2005/09/03 11:09:43 $"
	current_author: "$Author: finnerty $"
	revision: "$Revision: 2.1 $"
   -- $Log: unit_test.ge,v $
   -- Revision 2.1  2005/09/03 11:09:43  finnerty
   -- Renamed *.e to *.ge for gepp
   --
   -- Revision 2.0  2005/08/26 23:32:02  finnerty
   -- == alpha version ==
   --
   -- Revision 1.1  2005/08/08 12:06:13  finnerty
   -- Unit test facility class.
   --
class UNIT_TEST
	-- Base facility class for unit testing classes

#ifdef SE
   insert
#else
   inherit
#endif
      KL_SHARED_STANDARD_FILES
		
feature {ANY}
	-- Query methods (with output to stdout)
	
	test_bool(a_title: STRING; a_expect, a_result: BOOLEAN) is
			-- Output formatted title and comparison of `a_expect' to `a_result'. 
		do
			std.output.put_string("----------------------------------------%N")
			std.output.put_string("Name of test: ")
			std.output.put_string(a_title)
			std.output.put_string("%NExpected result: ")
			std.output.put_boolean(a_expect)
			std.output.put_string("%NActual result  : ")
			std.output.put_boolean(a_result)
			if a_expect = a_result then
				std.output.put_string("%N              + Test past + %N")
			else
				std.output.put_string("%N           *** Test failed **** %N")
			end
		end
	
	test_integer(a_title: STRING; a_expect, a_result: INTEGER) is
			-- Output formatted title and comparison of `a_expect' to `a_result'.
		do
			std.output.put_string("----------------------------------------%N")
			std.output.put_string("Name of test: ")
			std.output.put_string(a_title)
			std.output.put_string("%NExpected result: ")
			std.output.put_integer(a_expect)
			std.output.put_string("%NActual result  : ")
			std.output.put_integer(a_result)
			if a_expect = a_result then
				std.output.put_string("%N              + Test past + %N")
			else
				std.output.put_string("%N           *** Test failed **** %N")
			end
		end
	
	test_string(a_title, a_expect, a_result: STRING) is
			-- Output formatted title and comparison of `a_expect' to `a_result'.
		do
			std.output.put_string("----------------------------------------%N")
			std.output.put_string("Name of test: ")
			std.output.put_string(a_title)
			std.output.put_string("%NExpected result: ")
			std.output.put_string(a_expect)
			std.output.put_string("%NActual result  : ")
			std.output.put_string(a_result)
			if a_expect.is_equal(a_result) then
				std.output.put_string("%N              + Test past + %N")
			else
				std.output.put_string("%N           *** Test failed **** %N")
			end
		end			
end -- class UNIT_TEST
