forked from msgpack/msgpack-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcases_spec.rb
More file actions
39 lines (31 loc) · 718 Bytes
/
cases_spec.rb
File metadata and controls
39 lines (31 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'spec_helper'
require 'json'
describe MessagePack do
here = File.dirname(__FILE__)
CASES = File.read("#{here}/cases.msg")
CASES_JSON = File.read("#{here}/cases.json")
CASES_COMPACT = File.read("#{here}/cases_compact.msg")
it 'compare with json' do
ms = []
MessagePack::Unpacker.new.feed_each(CASES) {|m|
ms << m
}
js = JSON.load(CASES_JSON)
ms.zip(js) {|m,j|
m.should == j
}
end
it 'compare with compat' do
ms = []
MessagePack::Unpacker.new.feed_each(CASES) {|m|
ms << m
}
cs = []
MessagePack::Unpacker.new.feed_each(CASES_COMPACT) {|c|
cs << c
}
ms.zip(cs) {|m,c|
m.should == c
}
end
end