Sha256: b90691a18c2481d45942267800a0d2490c5b9f2f928d6f6e6fdf1c661a7a1e7d

Contents?: true

Size: 729 Bytes

Versions: 34

Compression:

Stored size: 729 Bytes

Contents

#!/usr/bin/env ruby -wW1

$: << '../lib'
$: << '../ext'

if __FILE__ == $0
  if (i = ARGV.index('-I'))
    x,path = ARGV.slice!(i, 2)
    $: << path
  end
end

require 'ox'

def bug2()
  s = File.read('long.pdf')
  puts "size before: #{s.size}"
  
  # s = "Hello\x00\x00\x00there."
  xml = Ox.dump(s, mode: :object)
  #puts "xml size: #{xml.size}"
  s2 = Ox.load(xml, mode: :object)
  puts "size after: #{s2.size}"
  #puts s2
  b1 = s.bytes
  b2 = s2.bytes
  (0..s2.bytesize).each do |i|
    puts "#{s.getbyte(i)}  #{s2.getbyte(i)}"
    if s.getbyte(i) != s2.getbyte(i)
      puts "stopped at #{i}"
      break
    end
  end
  puts "byte sizes #{s.bytesize}  #{s2.bytesize}"
  puts "char sizes #{s.size}  #{s2.size}"
end

bug2()

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
ox-1.5.4 test/bug2.rb
ox-1.5.3 test/bug2.rb
ox-1.5.2 test/bug2.rb
ox-1.5.1 test/bug2.rb
ox-1.5.0 test/bug2.rb
ox-1.4.6 test/bug2.rb
ox-1.4.5 test/bug2.rb
ox-1.4.4 test/bug2.rb
ox-1.4.3 test/bug2.rb
ox-1.4.2 test/bug2.rb
ox-1.4.1 test/bug2.rb
ox-1.4.0 test/bug2.rb
ox-1.3.5 test/bug2.rb
ox-1.3.4 test/bug2.rb
ox-1.3.3 test/bug2.rb
ox-1.3.2 test/bug2.rb
ox-1.3.1 test/bug2.rb
ox-1.3.0 test/bug2.rb
ox-1.2.15 test/bug2.rb
ox-1.2.14 test/bug2.rb