vendor/riddle/spec/unit/message_spec.rb in ultrasphinx-1.6.7 vs vendor/riddle/spec/unit/message_spec.rb in ultrasphinx-1.7
- old
+ new
@@ -26,11 +26,11 @@
end
it "should append floats correctly - packed with f" do
message = Riddle::Client::Message.new
message.append_float 1.4
- message.to_s.should == [1.4].pack('f')
+ message.to_s.should == [1.4].pack('f').unpack('L*').pack('N')
end
it "should append a collection of integers correctly" do
message = Riddle::Client::Message.new
message.append_ints 1, 2, 3, 4
@@ -38,11 +38,11 @@
end
it "should append a collection of floats correctly" do
message = Riddle::Client::Message.new
message.append_floats 1.0, 1.1, 1.2, 1.3
- message.to_s.should == [1.0, 1.1, 1.2, 1.3].pack('ffff')
+ message.to_s.should == [1.0, 1.1, 1.2, 1.3].pack('ffff').unpack('L*L*L*L*').pack('NNNN')
end
it "should append an array of strings correctly" do
arr = ["a", "bb", "ccc"]
message = Riddle::Client::Message.new
@@ -56,8 +56,8 @@
message.append_int 4
message.append_string "test"
message.append_array ["one", "two"]
message.append_floats 1.5, 1.7
message.to_s.should == [4, 4].pack('NN') + "test" + [2, 3].pack('NN') +
- "one" + [3].pack('N') + "two" + [1.5, 1.7].pack('ff')
+ "one" + [3].pack('N') + "two" + [1.5, 1.7].pack('ff').unpack('L*L*').pack('NN')
end
end
\ No newline at end of file