msgpack 0.3.2-mswin32 → 0.3.3-mswin32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,225 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/test_helper.rb'
3
+ require 'test/unit'
4
+
5
+ class MessagePackTestFormat < Test::Unit::TestCase
6
+ def self.it(name, &block)
7
+ define_method("test_#{name}", &block)
8
+ end
9
+
10
+ it "nil" do
11
+ check 1, nil
12
+ end
13
+
14
+ it "true" do
15
+ check 1, true
16
+ end
17
+
18
+ it "false" do
19
+ check 1, false
20
+ end
21
+
22
+ it "zero" do
23
+ check 1, 0
24
+ end
25
+
26
+ it "positive fixnum" do
27
+ check 1, 1
28
+ check 1, (1<<6)
29
+ check 1, (1<<7)-1
30
+ end
31
+
32
+ it "positive int 8" do
33
+ check 1, -1
34
+ check 2, (1<<7)
35
+ check 2, (1<<8)-1
36
+ end
37
+
38
+ it "positive int 16" do
39
+ check 3, (1<<8)
40
+ check 3, (1<<16)-1
41
+ end
42
+
43
+ it "positive int 32" do
44
+ check 5, (1<<16)
45
+ check 5, (1<<32)-1
46
+ end
47
+
48
+ it "positive int 64" do
49
+ check 9, (1<<32)
50
+ check 9, (1<<64)-1
51
+ end
52
+
53
+ it "negative fixnum" do
54
+ check 1, -1
55
+ check 1, -((1<<5)-1)
56
+ check 1, -(1<<5)
57
+ end
58
+
59
+ it "negative int 8" do
60
+ check 2, -((1<<5)+1)
61
+ check 2, -(1<<7)
62
+ end
63
+
64
+ it "negative int 16" do
65
+ check 3, -((1<<7)+1)
66
+ check 3, -(1<<15)
67
+ end
68
+
69
+ it "negative int 32" do
70
+ check 5, -((1<<15)+1)
71
+ check 5, -(1<<31)
72
+ end
73
+
74
+ it "negative int 64" do
75
+ check 9, -((1<<31)+1)
76
+ check 9, -(1<<63)
77
+ end
78
+
79
+ it "double" do
80
+ check 9, 1.0
81
+ check 9, 0.1
82
+ check 9, -0.1
83
+ check 9, -1.0
84
+ end
85
+
86
+ it "fixraw" do
87
+ check_raw 1, 0
88
+ check_raw 1, (1<<5)-1
89
+ end
90
+
91
+ it "raw 16" do
92
+ check_raw 3, (1<<5)
93
+ check_raw 3, (1<<16)-1
94
+ end
95
+
96
+ it "raw 32" do
97
+ check_raw 5, (1<<16)
98
+ #check_raw 5, (1<<32)-1 # memory error
99
+ end
100
+
101
+ it "fixarray" do
102
+ check_array 1, 0
103
+ check_array 1, (1<<4)-1
104
+ end
105
+
106
+ it "array 16" do
107
+ check_array 3, (1<<4)
108
+ check_array 3, (1<<16)-1
109
+ end
110
+
111
+ it "array 32" do
112
+ check_array 5, (1<<16)
113
+ #check_array 5, (1<<32)-1 # memory error
114
+ end
115
+
116
+ it "nil" do
117
+ match nil, "\xc0"
118
+ end
119
+
120
+ it "false" do
121
+ match false, "\xc2"
122
+ end
123
+
124
+ it "true" do
125
+ match true, "\xc3"
126
+ end
127
+
128
+ it "0" do
129
+ match 0, "\x00"
130
+ end
131
+
132
+ it "127" do
133
+ match 127, "\x7f"
134
+ end
135
+
136
+ it "128" do
137
+ match 128, "\xcc\x80"
138
+ end
139
+
140
+ it "256" do
141
+ match 256, "\xcd\x01\x00"
142
+ end
143
+
144
+ it "-1" do
145
+ match -1, "\xff"
146
+ end
147
+
148
+ it "-33" do
149
+ match -33, "\xd0\xdf"
150
+ end
151
+
152
+ it "-129" do
153
+ match -129, "\xd1\xff\x7f"
154
+ end
155
+
156
+ it "{1=>1}" do
157
+ match ({1=>1}), "\x81\x01\x01"
158
+ end
159
+
160
+ it "1.0" do
161
+ match 1.0, "\xcb\x3f\xf0\x00\x00\x00\x00\x00\x00"
162
+ end
163
+
164
+ it "[]" do
165
+ match [], "\x90"
166
+ end
167
+
168
+ it "[0, 1, ..., 14]" do
169
+ match (0..14).to_a, "\x9f\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e"
170
+ end
171
+
172
+ it "[0, 1, ..., 15]" do
173
+ match (0..15).to_a, "\xdc\x00\x10\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
174
+ end
175
+
176
+ it "{}" do
177
+ match ({}), "\x80"
178
+ end
179
+
180
+ it "{0=>0, 1=>1, ..., 14=>14}" do
181
+ a = (0..14).to_a;
182
+ match Hash[*a.zip(a).flatten], "\x8f\x05\x05\x0b\x0b\x00\x00\x06\x06\x0c\x0c\x01\x01\x07\x07\x0d\x0d\x02\x02\x08\x08\x0e\x0e\x03\x03\x09\x09\x04\x04\x0a\x0a"
183
+ end
184
+
185
+ it "{0=>0, 1=>1, ..., 15=>15}" do
186
+ a = (0..15).to_a;
187
+ match Hash[*a.zip(a).flatten], "\xde\x00\x10\x05\x05\x0b\x0b\x00\x00\x06\x06\x0c\x0c\x01\x01\x07\x07\x0d\x0d\x02\x02\x08\x08\x0e\x0e\x03\x03\x09\x09\x0f\x0f\x04\x04\x0a\x0a"
188
+ end
189
+
190
+ # it "fixmap" do
191
+ # check_map 1, 0
192
+ # check_map 1, (1<<4)-1
193
+ # end
194
+ #
195
+ # it "map 16" do
196
+ # check_map 3, (1<<4)
197
+ # check_map 3, (1<<16)-1
198
+ # end
199
+ #
200
+ # it "map 32" do
201
+ # check_map 5, (1<<16)
202
+ # #check_map 5, (1<<32)-1 # memory error
203
+ # end
204
+
205
+ private
206
+ def check(len, obj)
207
+ v = obj.to_msgpack
208
+ assert_equal(v.length, len)
209
+ assert_equal(MessagePack.unpack(v), obj)
210
+ end
211
+
212
+ def check_raw(overhead, num)
213
+ check num+overhead, " "*num
214
+ end
215
+
216
+ def check_array(overhead, num)
217
+ check num+overhead, Array.new(num)
218
+ end
219
+
220
+ def match(obj, buf)
221
+ assert_equal(obj.to_msgpack, buf)
222
+ assert_equal(MessagePack::unpack(buf), obj)
223
+ end
224
+ end
225
+
@@ -0,0 +1,3 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../ext/msgpack'
3
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: mswin32
6
6
  authors:
7
7
  - FURUHASHI Sadayuki
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-11 00:00:00 +09:00
12
+ date: 2010-03-02 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -17,22 +17,29 @@ description:
17
17
  email: frsyuki@users.sourceforge.jp
18
18
  executables: []
19
19
 
20
- extensions: []
21
-
22
- extra_rdoc_files: []
23
-
20
+ extensions:
21
+ - ext/extconf.rb
22
+ extra_rdoc_files:
23
+ - README
24
+ - ChangeLog
25
+ - AUTHORS
24
26
  files:
25
27
  - ext/extconf.rb
26
- - ext/Makefile
27
- - ext/msgpack.so
28
28
  - ext/pack.c
29
29
  - ext/pack.h
30
- - ext/pack.o
31
30
  - ext/rbinit.c
32
- - ext/rbinit.o
33
31
  - ext/unpack.c
34
32
  - ext/unpack.h
35
- - ext/unpack.o
33
+ - msgpack/pack_define.h
34
+ - msgpack/pack_template.h
35
+ - msgpack/sysdep.h
36
+ - msgpack/unpack_define.h
37
+ - msgpack/unpack_template.h
38
+ - test/msgpack_test.rb
39
+ - test/test_helper.rb
40
+ - README
41
+ - ChangeLog
42
+ - AUTHORS
36
43
  has_rdoc: false
37
44
  homepage: http://msgpack.sourceforge.jp/
38
45
  post_install_message:
@@ -59,6 +66,6 @@ rubyforge_project: msgpack
59
66
  rubygems_version: 1.3.1
60
67
  signing_key:
61
68
  specification_version: 2
62
- summary: MessagePack
63
- test_files: []
64
-
69
+ summary: MessagePack, a binary-based efficient data interchange format.
70
+ test_files:
71
+ - test/test_helper.rb
@@ -1,156 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- #### Start of system configuration section. ####
5
-
6
- srcdir = .
7
- topdir = c:/MinGW/lib/ruby/1.8/i386-mingw32
8
- hdrdir = $(topdir)
9
- VPATH = $(srcdir);$(topdir);$(hdrdir)
10
-
11
- DESTDIR = c:
12
- exec_prefix = $(prefix)
13
- prefix = $(DESTDIR)/MinGW
14
- sharedstatedir = $(prefix)/com
15
- mandir = $(datarootdir)/man
16
- psdir = $(docdir)
17
- oldincludedir = $(DESTDIR)/usr/include
18
- localedir = $(datarootdir)/locale
19
- bindir = $(exec_prefix)/bin
20
- libexecdir = $(exec_prefix)/libexec
21
- sitedir = $(libdir)/ruby/site_ruby
22
- htmldir = $(docdir)
23
- vendorarchdir = $(vendorlibdir)/$(sitearch)
24
- includedir = $(prefix)/include
25
- infodir = $(datarootdir)/info
26
- vendorlibdir = $(vendordir)/$(ruby_version)
27
- sysconfdir = $(prefix)/etc
28
- libdir = $(exec_prefix)/lib
29
- sbindir = $(exec_prefix)/sbin
30
- rubylibdir = $(libdir)/ruby/$(ruby_version)
31
- docdir = $(datarootdir)/doc/$(PACKAGE)
32
- dvidir = $(docdir)
33
- vendordir = $(libdir)/ruby/vendor_ruby
34
- datarootdir = $(prefix)/share
35
- pdfdir = $(docdir)
36
- archdir = $(rubylibdir)/$(arch)
37
- sitearchdir = $(sitelibdir)/$(sitearch)
38
- datadir = $(datarootdir)
39
- localstatedir = $(prefix)/var
40
- sitelibdir = $(sitedir)/$(ruby_version)
41
-
42
- CC = gcc
43
- LIBRUBY = lib$(LIBRUBY_SO).a
44
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
45
- LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
46
- LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
47
-
48
- RUBY_EXTCONF_H =
49
- CFLAGS = -g -O2 $(cflags) -I.. -Wall -O4
50
- INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
51
- DEFS =
52
- CPPFLAGS = $(DEFS) $(cppflags)
53
- CXXFLAGS = $(CFLAGS)
54
- ldflags = -L.
55
- dldflags = -Wl,--enable-auto-image-base,--enable-auto-import,--export-all
56
- archflag =
57
- DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
58
- LDSHARED = gcc -shared -s
59
- AR = ar
60
- EXEEXT = .exe
61
-
62
- RUBY_INSTALL_NAME = ruby
63
- RUBY_SO_NAME = msvcrt-ruby18
64
- arch = i386-mingw32
65
- sitearch = i386-msvcrt
66
- ruby_version = 1.8
67
- ruby = c:/MinGW/bin/ruby
68
- RUBY = $(ruby)
69
- RM = rm -f
70
- MAKEDIRS = mkdir -p
71
- INSTALL = /bin/install -c
72
- INSTALL_PROG = $(INSTALL) -m 0755
73
- INSTALL_DATA = $(INSTALL) -m 644
74
- COPY = cp
75
-
76
- #### End of system configuration section. ####
77
-
78
- preload =
79
-
80
- libpath = . $(libdir)
81
- LIBPATH = -L. -L$(libdir)
82
- DEFFILE =
83
-
84
- CLEANFILES = mkmf.log
85
- DISTCLEANFILES =
86
-
87
- extout =
88
- extout_prefix =
89
- target_prefix =
90
- LOCAL_LIBS =
91
- LIBS = $(LIBRUBYARG_SHARED) -lshell32 -lwsock32
92
- SRCS = pack.c rbinit.c unpack.c
93
- OBJS = pack.o rbinit.o unpack.o
94
- TARGET = msgpack
95
- DLLIB = $(TARGET).so
96
- EXTSTATIC =
97
- STATIC_LIB =
98
-
99
- BINDIR = $(bindir)
100
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
101
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
102
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
103
-
104
- TARGET_SO = $(DLLIB)
105
- CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
106
- CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
107
-
108
- all: $(DLLIB)
109
- static: $(STATIC_LIB)
110
-
111
- clean:
112
- @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
113
-
114
- distclean: clean
115
- @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
116
- @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
117
-
118
- realclean: distclean
119
- install: install-so install-rb
120
-
121
- install-so: $(RUBYARCHDIR)
122
- install-so: $(RUBYARCHDIR)/$(DLLIB)
123
- $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
124
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
125
- install-rb: pre-install-rb install-rb-default
126
- install-rb-default: pre-install-rb-default
127
- pre-install-rb: Makefile
128
- pre-install-rb-default: Makefile
129
- $(RUBYARCHDIR):
130
- $(MAKEDIRS) $@
131
-
132
- site-install: site-install-so site-install-rb
133
- site-install-so: install-so
134
- site-install-rb: install-rb
135
-
136
- .SUFFIXES: .c .m .cc .cxx .cpp .o
137
-
138
- .cc.o:
139
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
140
-
141
- .cxx.o:
142
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
143
-
144
- .cpp.o:
145
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
146
-
147
- .c.o:
148
- $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
149
-
150
- $(DLLIB): $(OBJS)
151
- @-$(RM) $@
152
- $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
153
-
154
-
155
-
156
- $(OBJS): ruby.h defines.h