Prolog "text"

         
/**
* Warranty & Liability
* To the extent permitted by applicable law and unless explicitly
* otherwise agreed upon, XLOG Technologies AG makes no warranties
* regarding the provided information. XLOG Technologies AG assumes
* no liability that any problems might be solved with the information
* provided by XLOG Technologies AG.
*
* Rights & License
* All industrial property rights regarding the information - copyright
* and patent rights in particular - are the sole property of XLOG
* Technologies AG. If the company was not the originator of some
* excerpts, XLOG Technologies AG has at least obtained the right to
* reproduce, change and translate the information.
*
* Reproduction is restricted to the whole unaltered document. Reproduction
* of the information is only allowed for non-commercial uses. Selling,
* giving away or letting of the execution of the library is prohibited.
* The library can be distributed as part of your applications and libraries
* for execution provided this comment remains unchanged.
*
* Restrictions
* Only to be distributed with programs that add significant and primary
* functionality to the library. Not to be distributed with additional
* software intended to replace any components of the library.
*
* Trademarks
* Jekejeke is a registered trademark of XLOG Technologies AG.
*/
/**
* Source of test cases is the following standard:
* - Prolog General Core ISO/IEC 13211-1
*/
runner_file(stream, text, 'ISO 8.12 texts').
/****************************************************************/
/* Character Input / Output */
/****************************************************************/
/* nl */
runner_pred(nl,0, stream, text, 'ISO 8.12.3.4').
runner_case(nl,0, stream, text, 'ISO 8.12.3.4, ISO 5') :-
open_output_atom_stream(S),
nl(S),
close_output_atom_stream(S, X),
X == '\n'.
/* put_code(C) */
runner_pred(put_code,1, stream, text, 'ISO 8.12.3.4').
runner_case(put_code,1, stream, text, 'ISO 8.12.3.4, ISO 3') :-
open_output_atom_stream(S),
put_code(S, 116),
close_output_atom_stream(S, X),
X == 't'.
runner_case(put_code,1, stream, text, 'ISO 8.12.3.4, ISO 10') :-
catch((current_output(S), put_code(S, _)), error(E,_), true),
E == instantiation_error.
runner_case(put_code,1, stream, text, 'ISO 8.12.3.4, ISO 11') :-
catch((current_output(S), put_code(S, ty)), error(E,_), true),
E == type_error(integer, ty).
/* peek_code(C) */
runner_pred(peek_code,1, stream, text, 'ISO 8.12.2.4').
runner_case(peek_code,1, stream, text, 'ISO 8.12.2.4, ISO 2') :-
open_input_atom_stream('qwerty ', S),
peek_code(S, X),
X == 113.
runner_case(peek_code,1, stream, text, 'ISO 8.12.2.4, XLOG 2') :-
open_input_atom_stream('qwerty ', S),
peek_code(S, _), get_code(S, X),
X == 113.
runner_case(peek_code,1, stream, text, 'ISO 8.12.2.4, ISO 6') :-
open_input_atom_stream('\'qwerty\' ', S),
peek_code(S, X),
X == 39.
runner_case(peek_code,1, stream, text, 'ISO 8.12.2.4, ISO 9') :-
open_input_atom_stream('qwerty ', S),
\+ peek_code(S, 112).
runner_case(peek_code,1, stream, text, 'ISO 8.12.2.4, ISO 11') :-
open_input_atom_stream('', S),
peek_code(S, X),
X == -1.
/* get_code(C) */
runner_pred(get_code,1, stream, text, 'ISO 8.12.1.4').
runner_case(get_code,1, stream, text, 'ISO 8.12.1.4, ISO 2') :-
open_input_atom_stream('qwerty ', S),
get_code(S, X),
X == 113.
runner_case(get_code,1, stream, text, 'ISO 8.12.1.4, XLOG 2') :-
open_input_atom_stream('qwerty ', S),
get_code(S, _), get_code(S, X),
X == 119.
runner_case(get_code,1, stream, text, 'ISO 8.12.1.4, ISO 6') :-
open_input_atom_stream('\'qwerty\' ', S),
get_code(S, X),
X == 39.
runner_case(get_code,1, stream, text, 'ISO 8.12.1.4, ISO 8') :-
open_input_atom_stream('qwerty ', S),
\+ get_code(S, 112).
runner_case(get_code,1, stream, text, 'ISO 8.12.1.4, ISO 10') :-
open_input_atom_stream('', S),
get_code(S,X),
X == -1.