From 062ed8a4c46be31da26538a4144fd441e453f30c Mon Sep 17 00:00:00 2001 From: frsyuki Date: Tue, 1 Jun 2010 04:47:28 +0900 Subject: [PATCH] add test/cases.mpac and test/cases_compact.mpac --- test/cases.mpac | Bin 0 -> 213 bytes test/cases_compact.mpac | Bin 0 -> 116 bytes test/cases_gen.rb | 76 ++++++++++++++++++++++++++++++ crosslang.cc => test/crosslang.cc | 7 ++- crosslang.rb => test/crosslang.rb | 7 +++ 5 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 test/cases.mpac create mode 100644 test/cases_compact.mpac create mode 100644 test/cases_gen.rb rename crosslang.cc => test/crosslang.cc (94%) rename crosslang.rb => test/crosslang.rb (91%) diff --git a/test/cases.mpac b/test/cases.mpac new file mode 100644 index 0000000000000000000000000000000000000000..5ec08c6a9af42d9568eb429a209a639616e94711 GIT binary patch literal 213 zcmXYp!4<+V3`3R4n8lOSY|v~#CV>aXw2-v7Qc6c)17ihrkbe}**V_dHM&J(DgGLop zU?R;l%8FI9$y_sy>V|HFdDW~{neAn-roN|Wd+OcH160;F91fo!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