From fb3e11408c4c94d3584cb68b8dcbc5a6c16db88f Mon Sep 17 00:00:00 2001 From: frsyuki Date: Tue, 1 Jun 2010 15:56:29 +0900 Subject: [PATCH] add test/cases.json --- test/README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++ test/cases.json | 1 + test/cases_gen.rb | 5 +++++ 3 files changed, 57 insertions(+) create mode 100644 test/README.md create mode 100644 test/cases.json diff --git a/test/README.md b/test/README.md new file mode 100644 index 00000000..9139e611 --- /dev/null +++ b/test/README.md @@ -0,0 +1,51 @@ +MessagePack cross-language test cases +===================================== + +## cases + +Valid serialized data are stored in "cases.mpac" and "cases_compact.mpac". +These files describe same objects. And "cases.json" describes an array of the described objects. + +Thus you can verify your implementations as comparing the objects. + + +## crosslang + +The *crosslang* tool reads serialized data from stdin and writes re-serialize data to stdout. + +There are C++ and Ruby implementation of crosslang tool. You can verify your implementation +as comparing that implementations. + +### C++ version + + $ cd ../cpp && ./configure && make && make install + or + $ port install msgpack # MacPorts + + $ g++ -Wall -lmsgpack crosslang.cc + + Usage: ./crosslang [in-file] [out-file] + + This tool is for testing of MessagePack implementation. + This does following behavior: + + 1. Reads objects serialized by MessagePack from (default: stdin) + 2. Re-serializes the objects using C++ implementation of MessagePack (Note that C++ implementation is considered valid) + 3. Writes the re-serialized objects into (default: stdout) + +### Ruby version + + $ gem install msgpack + or + $ port install rb_msgpack # MacPorts + + $ ruby crosslang.rb + Usage: crosslang.rb [in-file] [out-file] + + This tool is for testing of MessagePack implementation. + This does following behavior: + + 1. Reads objects serialized by MessagePack from (default: stdin) + 2. Re-serializes the objects using Ruby implementation of MessagePack (Note that Ruby implementation is considered valid) + 3. Writes the re-serialized objects into (default: stdout) + diff --git a/test/cases.json b/test/cases.json new file mode 100644 index 00000000..fd390d48 --- /dev/null +++ b/test/cases.json @@ -0,0 +1 @@ +[false,true,null,0,0,0,0,0,0,0,0,0,-1,-1,-1,-1,-1,127,127,255,65535,4294967295,-32,-32,-128,-32768,-2147483648,0.0,-0.0,1.0,-1.0,"a","a","a","","","",[0],[0],[0],[],[],[],{},{},{},{"a":97},{"a":97},{"a":97},[[]],[["a"]]] \ No newline at end of file diff --git a/test/cases_gen.rb b/test/cases_gen.rb index 7efbfe7e..b349f4e2 100644 --- a/test/cases_gen.rb +++ b/test/cases_gen.rb @@ -3,6 +3,7 @@ # require 'rubygems' rescue nil require 'msgpack' +require 'json' source = <