added read_bytes_from_stream, write_byte_to_stream, and write_bytes_to_stream to...
[antimony.git] / src / test / test_stream.voo
blob122cf5f14a7e078678ea633f5558ed949eff4883
1 # Tests for streams.
3 section data
4 msg: string "OK\x0a"
6 section functions
7 import sbJ_allocate_bytes sbJ_sb_init sbJ_standard_error sbJ_standard_input \
8     sbJ_standard_output \
9     sbJ_flush_stream sbJ_read_bytes_from_stream sbJ_write_byte_to_stream \
10     sbJ_write_bytes_to_stream sbJ_write_newline_and_flush_stream \
11     sbJ_write_newline_to_stream
12 export main
14 align
15 main:
16 function argc argv
17     call sbJ_sb_init
18     let bytes call sbJ_allocate_bytes 5
19     call sbJ_read_bytes_from_stream sbJ_standard_input bytes 5
20     call sbJ_write_bytes_to_stream sbJ_standard_output bytes 5
21     call sbJ_flush_stream sbJ_standard_output
22     call sbJ_write_bytes_to_stream sbJ_standard_error msg 3
23     call sbJ_flush_stream sbJ_standard_error
24     call sbJ_write_byte_to_stream sbJ_standard_output 65
25     call sbJ_write_newline_to_stream sbJ_standard_output
26     call sbJ_write_newline_and_flush_stream sbJ_standard_output
27     return 0
28 end function