String#pack with 'Q', 'q' patterns should treat 64bit numbers as big-endian
---------------------------------------------------------------------------

                 Key: JRUBY-2173
                 URL: http://jira.codehaus.org/browse/JRUBY-2173
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1RC2
         Environment: Latest JRuby 1.1RC2
            Reporter: Vladimir Sizikov
            Assignee: Vladimir Sizikov


JRuby, being executed on 'java' platform, is effectively big-endian, as Java 
itself.

unpack with 'Q' and 'q' patterns, treats numbers as 64 bit in "native" platform 
endiannes, and in JRuby case it means the numbers should be big-endian.

New rubyspecs were recently added, and they fail with JRuby, since JRuby uses 
little-endian numbers for Q, q.

String#unpack with 'Q' and 'q' directives returns an array in big-endian 
(native format) order by decoding self according to the format string FAILED
Expected [17344245288696546035] to equal [17510558585478951920]:
/opt/work/rubinius/./mspec/expectations.rb:10:in `fail_with'
/opt/work/rubinius/./mspec/matchers/base.rb:16:in `=='
/opt/work/rubinius/./spec/ruby/1.8/core/string/unpack_spec.rb:119
/opt/work/rubinius/./mspec/runner/mspec.rb:102:in `call'
/opt/work/rubinius/./mspec/runner/mspec.rb:102:in `protect'
/opt/work/rubinius/./mspec/runner/state.rb:46:in `each'
/opt/work/rubinius/./mspec/runner/state.rb:46:in `protect'
/opt/work/rubinius/./mspec/runner/state.rb:59:in `process'
/opt/work/rubinius/./mspec/runner/state.rb:55:in `each'
/opt/work/rubinius/./mspec/runner/state.rb:55:in `process'
/opt/work/rubinius/./mspec/runner/mspec.rb:10:in `describe'
/opt/work/rubinius/./mspec/runner/object.rb:11:in `describe'
/opt/work/rubinius/./spec/ruby/1.8/core/string/unpack_spec.rb:98
/opt/work/rubinius/./mspec/runner/mspec.rb:27:in `load'
/opt/work/rubinius/./mspec/runner/mspec.rb:27:in `files'
/opt/work/rubinius/./mspec/runner/mspec.rb:102:in `call'
/opt/work/rubinius/./mspec/runner/mspec.rb:102:in `protect'
/opt/work/rubinius/./mspec/runner/mspec.rb:27:in `files'
/opt/work/rubinius/./mspec/runner/mspec.rb:24:in `each'
/opt/work/rubinius/./mspec/runner/mspec.rb:24:in `files'
/opt/work/rubinius/./mspec/runner/mspec.rb:17:in `process'
mspec/bin/mspec-run:36


"\xF3\x02\x00\x42\x32\x23\xB3\xF0".unpack('Q') ==> [17344245288696546035]

But should:  [17510558585478951920].

Fix is coming.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to