Sha256: 7e8927dc51d3c2db130aa991cdefe1dab3b22adcd2f9e7ed9ebdf87eb2a1956d
Contents?: true
Size: 1.85 KB
Versions: 2
Compression:
Stored size: 1.85 KB
Contents
require 'ronin/formatting/binary' require 'spec_helper' describe Integer do before(:all) do @integer = 0x1337 @i386_packed_int = "7\023\000\000" @i386_packed_short = "7\023" @i386_packed_long = "7\023\000\000" @i386_packed_quad = "7\023\000\000\000\000\000\000" @ppc_packed_int = "\000\000\0237" @ppc_packed_short = "\0237" @ppc_packed_long = "\000\000\0237" @ppc_packed_quad = "\000\000\000\000\000\000\0237" end it "should provide Integer#pack" do @integer.respond_to?('pack').should == true end it "Integer#pack should pack itself for a little-endian architecture" do @integer.pack(Arch.i386).should == @i386_packed_int end it "Integer#pack should pack itself as a short for a little-endian architecture" do @integer.pack(Arch.i386,2).should == @i386_packed_short end it "Integer#pack should pack itself as a long for a little-endian architecture" do @integer.pack(Arch.i386,4).should == @i386_packed_long end it "Integer#pack should pack itself as a quad for a little-endian architecture" do @integer.pack(Arch.i386,8).should == @i386_packed_quad end it "Integer#pack should pack itself for a big-endian architecture" do @integer.pack(Arch.ppc).should == @ppc_packed_int end it "Integer#pack should pack itself as a short for a big-endian architecture" do @integer.pack(Arch.ppc,2).should == @ppc_packed_short end it "Integer#pack should pack itself as a long for a big-endian architecture" do @integer.pack(Arch.ppc,4).should == @ppc_packed_long end it "Integer#pack should pack itself as a quad for a big-endian architecture" do @integer.pack(Arch.ppc,8).should == @ppc_packed_quad end end describe "String" do before(:all) do @packed_integer = "" end it "should provide String#depack" do @packed_integer.respond_to?('depack').should == true end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ronin-0.1.0 | spec/formatting/binary_spec.rb |
ronin-0.1.1 | spec/formatting/binary_spec.rb |