stdchans.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 

class TEST_STD_CHANS

class TEST_STD_CHANS is -- This is a test program to test the interface to the operating system -- standard channels. Note that it is not portable for simplicity in -- building a local library. -- NOTE Since this class is the one concerned with primitive OS I/O the -- testing is done through the use of exceptions. If an exception -- occurs then the default exception handler is invoked by re-raising -- a string error message. -- Version 1.0 Nov 97. Copyright K Hopper, U of Waikato -- Development History -- ------------------- -- Date Who By Detail -- ---- ------ ------ -- 19 Nov 97 kh Original const Output_Char : CHAR := 'x' ; const Error_Char : CHAR := 'a' ; const New_Line : CHAR := '\n' ; const Output_String : STR := "STDCHANS Test 3 (output channel)\n" ; const Error_String : STR := "STDCHANS Test 4 (error channel)\n" ; main is in_chan : STD_CHANS := STD_CHANS::stdin ; out_chan : STD_CHANS := STD_CHANS::stdout ; err_chan : STD_CHANS := STD_CHANS::stderr ; protect out_chan + New_Line ; -- use put char out_chan + Output_Char ; out_chan + New_Line ; out_chan.flush -- makes sure user sees it! when REFERENCE then raise "Out channel char failure" end ; protect err_chan + Error_Char ; -- use put char err_chan + New_Line ; err_chan.flush -- makes sure user sees it! when REFERENCE then raise "Error channel char failure" end ; protect out_chan + Output_String ; -- uses append loop out_chan.flush -- makes sure user sees it! when REFERENCE then raise "Out channel string failure" end ; protect err_chan + Error_String ; -- uses append loop err_chan.flush -- makes sure user sees it! when REFERENCE then raise "Error channel string failure" end ; out_chan + "STD_CHANS Test 5 (Output/error tests OK!)\n\n" ; out_chan.flush ; -- NOTE Primitive input is contained in the class IN end ; end ; -- TEST_STD_CHANS