def test_fifteen
puts "test 15"
f = []
f.push('@>>>>>>>>>>>>>> ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
f.push('author, quote')
f.push('~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
f.push('quote')
authors = []
quotes = []
format = Format.new(f)
file_name = "format_testfile15"
File.open(file_name,
File::CREAT | File::WRONLY | File::TRUNC) do |file|
format.io = file
author = "Robert Frost"
authors[0] = author
quote = "Whose woods these are I think I know His house is" +
" by the village, though ... But I have promises to keep " +
"And miles to go before I sleep."
quotes[0] = quote
format.printFormat(binding)
author = "Bill"
authors[1] = author
quote = "Shall I compare thee to a Summer's day and branch if the result is negative?"
quotes[1] = quote
format.printFormat(binding)
end
output = IO.readlines(file_name)
reader = FormatReader.new(format)
loops = 0
reader.readFormat(output) do |vals|
assert(vals["author"] = authors[loops])
assert(vals["quote"] = quotes[loops])
loops += 1
end
assert(compareOutput(file_name,
"./format_test.pl 15", nil))
end