pretify
This commit is contained in:
parent
27722e94bc
commit
6ca1293ef1
1 changed files with 18 additions and 31 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/local/bin/ruby
|
||||
|
||||
# $Dwarf$
|
||||
# $Dwarf: uu_test.rb,v 1.1 2003/04/20 16:33:02 ward Exp $
|
||||
# $Source$
|
||||
|
||||
require '../uuencode.rb'
|
||||
|
|
@ -8,18 +8,18 @@ require 'ftools'
|
|||
|
||||
def test1
|
||||
print "Test 1: decoding a file\n"
|
||||
file = File.open("testdata.uu", mode = "r")
|
||||
file = File.open("testdata.uu", "r")
|
||||
tmpfile = Tempfile.new("uutmp")
|
||||
tmpfile.sync=true
|
||||
mode, filename, body = UUEncode.uudecode(file, tmpfile)
|
||||
if mode != "644"
|
||||
print "Failed, mode should be 644, but is #{mode}\n"
|
||||
print " Failed, mode should be 644, but is #{mode}\n"
|
||||
elsif filename != "testdata"
|
||||
print "Failed, filename should be \"testdata\", but is \"#{filename}\"\n"
|
||||
print " Failed, filename should be \"testdata\", but is \"#{filename}\"\n"
|
||||
elsif ! File.compare("testdata", tmpfile.path)
|
||||
print "Failed, result doesn't match reference data\n"
|
||||
print " Failed, result doesn't match reference data\n"
|
||||
else
|
||||
print "Succesful\n"
|
||||
print " Succesful\n"
|
||||
end
|
||||
file.close
|
||||
tmpfile.close
|
||||
|
|
@ -27,62 +27,49 @@ end
|
|||
|
||||
def test2
|
||||
print "Test 2: decoding an array\n"
|
||||
file = File.open("testdata.uu", mode = "r")
|
||||
file = File.open("testdata.uu", "r")
|
||||
lines = file.readlines
|
||||
file.close
|
||||
file = File.open("testdata", mode = "r")
|
||||
file = File.open("testdata", "r")
|
||||
reference = file.readlines
|
||||
file.close
|
||||
|
||||
mode, filename, body = UUEncode.uudecode(lines)
|
||||
|
||||
print "#{reference.length}\n"
|
||||
print "#{body.length}\n"
|
||||
if mode != "644"
|
||||
print "Failed, mode should be 644, but is #{mode}\n"
|
||||
print " Failed, mode should be 644, but is #{mode}\n"
|
||||
elsif filename != "testdata"
|
||||
print "Failed, filename should be \"testdata\", but is \"#{filename}\"\n"
|
||||
print " Failed, filename should be \"testdata\", but is \"#{filename}\"\n"
|
||||
elsif reference != body
|
||||
print "Failed, result doesn't match reference data\n"
|
||||
print " Failed, result doesn't match reference data\n"
|
||||
else
|
||||
print "Succesful\n"
|
||||
end
|
||||
print "#{reference}"
|
||||
print "#{body}"
|
||||
file = File.new("blup", "w")
|
||||
file.print body
|
||||
file.close
|
||||
|
||||
i = 0
|
||||
while i < body.length
|
||||
print "I: #{i} data: #{body[i]}"
|
||||
i+=1
|
||||
print " Succesful\n"
|
||||
end
|
||||
end
|
||||
|
||||
def test3
|
||||
print "Test 3: is_uuencoded\n"
|
||||
file = File.open("testdata.uu", mode = "r")
|
||||
file = File.open("testdata.uu", "r")
|
||||
lines = file.readlines
|
||||
file.close
|
||||
if UUEncode.is_uuencoded(lines)
|
||||
print "Succesful\n"
|
||||
print " Succesful\n"
|
||||
else
|
||||
print "Failed\n"
|
||||
print " Failed\n"
|
||||
end
|
||||
end
|
||||
|
||||
def test4
|
||||
print "Test 4: get_filename\n"
|
||||
file = File.open("testdata.uu", mode = "r")
|
||||
file = File.open("testdata.uu", "r")
|
||||
lines = file.readlines
|
||||
file.close
|
||||
|
||||
filename = UUEncode.get_filename(lines)
|
||||
if filename == "testdata"
|
||||
print "Succesful\n"
|
||||
print " Succesful\n"
|
||||
else
|
||||
print "Failed\n"
|
||||
print " Failed\n"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue