File Manager

Current Path : /usr/share/doc/crm114/examples/tests/
Upload File :
Current File : //usr/share/doc/crm114/examples/tests/randomiotest.crm

#! /usr/bin/crm
#
#	reandomiotest.crm - random I/O test

# Copyright 2009 William S. Yerazunis.
# This file is under GPLv3, as described in COPYING.
#

#    Random I/O test - test lseeking I/O
window

#       first test simple input and output test
syscall /rm -f randtst.txt/
isolate (:z:)
output [randtst.txt] /The quick brown fox jumped over the lazy dog's back/
input [randtst.txt] (:z:)
output /Original:    :*:z:\n/

#     Redo it with append, to be sure append works with no prior file.
syscall /rm -f randtst.txt/
isolate (:z:)
output <append>[randtst.txt] / alpha bravo charlie /
input [randtst.txt] (:z:)
output /delete file then append:    :*:z:\n/

#     and again, no append, to see if that does a delete of old contents
isolate (:z:)
output [randtst.txt] /The quick brown fox jumped over the lazy dog's back/
input [randtst.txt] (:z:)
output /prior file, no append:    :*:z:\n/

#     and yet again, with append, to see that append does work.
isolate (:z:)
output <append>[randtst.txt] / alpha bravo charlie /
input [randtst.txt] (:z:)
output /prior file, and append:    :*:z:\n/

#      Now, grab a few words out of the middle, say,
#           starting at 10, for 15 chars
isolate (:x:)
input [randtst.txt 10 15] (:x:)
output /Grab chars 10 thru 25: :*:x:\n/

#     And overlap, but with some math thrown in
input [randtst.txt :@:10+7: :@:7+5:] (:x:)
output /Grab chars 17 and length 12:  :*:x:\n/

#     And overlap a write in the middle, and then a read,
output [randtst.txt 16 3] /cat/
input [randtst.txt 5 30] (:x:)
output /Now, change the fox to cat: :*:x:\n/

#     And show it really got written:
input [ randtst.txt ] (:z:)
output /Final check- did it really get written? :*:z:\n/
syscall /rm -f randtst.txt/

File Manager Version 1.0, Coded By Lucas
Email: hehe@yahoo.com