blob: c43ba58c13a724bcf64a3e56e15fbadf32baf435 [file] [log] [blame]
Bryan Duxburyd815c212009-03-19 18:57:43 +00001require "spec/spec_helper"
2require "lib/thrift/serializer"
3
4path, factory_class = ARGV
5
6factory = eval(factory_class).new
7
8deser = Thrift::Deserializer.new(factory)
9
10cpts = CompactProtoTestStruct.new
11CompactProtoTestStruct.constants.each do |const|
12 cpts.instance_variable_set("@#{const}", nil)
13end
14
15data = File.read(path)
16
17deser.deserialize(cpts, data)
18
19if cpts == Fixtures::COMPACT_PROTOCOL_TEST_STRUCT
20 puts "Object verified successfully!"
21else
22 puts "Object failed verification! Expected #{Fixtures::COMPACT_PROTOCOL_TEST_STRUCT.inspect} but got #{cpts.inspect}"
23
24 puts cpts.differences(Fixtures::COMPACT_PROTOCOL_TEST_STRUCT)
25end