diff --git a/test/cases.mpac b/test/cases.mpac new file mode 100644 index 00000000..5ec08c6a Binary files /dev/null and b/test/cases.mpac differ diff --git a/test/cases_compact.mpac b/test/cases_compact.mpac new file mode 100644 index 00000000..8812442d Binary files /dev/null and b/test/cases_compact.mpac differ diff --git a/test/cases_gen.rb b/test/cases_gen.rb new file mode 100644 index 00000000..2fb7273a --- /dev/null +++ b/test/cases_gen.rb @@ -0,0 +1,76 @@ +# +# MessagePack format test case +# +require 'rubygems' rescue nil +require 'msgpack' + +source = <97} FixMap +de 00 01 a1 61 61 # {"a"=>97} map 16 +df 00 00 00 01 a1 61 61 # {"a"=>97} map 32 +91 90 # [[]] +91 91 a1 61 # [["a"]] +EOF + +source.gsub!(/\#.+$/,'') +bytes = source.strip.split(/\s+/).map {|x| x.to_i(16) }.pack('C*') + +compact_bytes = "" +pac = MessagePack::Unpacker.new +pac.feed(bytes) +pac.each {|obj| + p obj + compact_bytes << obj.to_msgpack +} + +File.open("cases.mpac","w") {|f| f.write(bytes) } +File.open("cases_compact.mpac","w") {|f| f.write(compact_bytes) } + diff --git a/crosslang.cc b/test/crosslang.cc similarity index 94% rename from crosslang.cc rename to test/crosslang.cc index 9ec7c0f6..be521b36 100644 --- a/crosslang.cc +++ b/test/crosslang.cc @@ -1,5 +1,10 @@ // -// How to compile: +// MessagePack cross-language test tool +// +// $ cd ../cpp && ./configure && make && make install +// or +// $ port install msgpack # MacPorts +// // $ g++ -Wall -lmsgpack crosslang.cc // #include diff --git a/crosslang.rb b/test/crosslang.rb similarity index 91% rename from crosslang.rb rename to test/crosslang.rb index af36dd11..7aa44820 100644 --- a/crosslang.rb +++ b/test/crosslang.rb @@ -1,3 +1,10 @@ +# +# MessagePack cross-language test tool +# +# $ gem install msgpack +# or +# $ port install rb_msgpack # MacPorts +# begin require 'rubygems' rescue LoadError