Sha256: 95e7e32fcef3fa4fa507f7bccf22330a09a7ca1e6fd1abc672362620ff61f29b

Contents?: true

Size: 1.02 KB

Versions: 12

Compression:

Stored size: 1.02 KB

Contents

# Tests for issues with decoding negative int32 fields

# By Mark Herman <mherman@iseatz.com> based on code from
# Tom Zetty <tzetty@iseatz.com>

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require 'protocol_buffers'

describe "Testing for decode errors for negative int32 fields" do
  # These should fail without the int32 negative handling fix 
  it "should return -1 given -1" do
    (validate_pbr(SignedIntTest, -1, true)).should be_true
  end
  
  it "should return -1111 given -1111" do
    (validate_pbr(SignedIntTest, -1111, true)).should be_true
  end
  
  # These should pass with or without the negative handling fix
  it "should return 1 given 1" do
    (validate_pbr(SignedIntTest, 1, true)).should be_true
  end
  
  it "should return 0 given 0" do
    (validate_pbr(SignedIntTest, 0, true)).should be_true
  end
  
  it "should return 100000 given 100000" do
    (validate_pbr(SignedIntTest, 100000, true)).should be_true    
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ruby-protocol-buffers-1.5.1 spec/negative_int32_spec.rb
ruby-protocol-buffers-1.5.0 spec/negative_int32_spec.rb
ruby-protocol-buffers-1.5.0.beta1 spec/negative_int32_spec.rb
ruby-protocol-buffers-1.4.1 spec/negative_int32_spec.rb
ruby-protocol-buffers-1.4.0 spec/negative_int32_spec.rb
ruby-protocol-buffers-1.3.3 spec/negative_int32_spec.rb
ruby-protocol-buffers-1.3.2 spec/negative_int32_spec.rb
ruby-protocol-buffers-1.3.1 spec/negative_int32_spec.rb
ruby-protocol-buffers-1.3.0 spec/negative_int32_spec.rb
ruby-protocol-buffers-1.2.3.beta2 spec/negative_int32_spec.rb
ruby-protocol-buffers-1.2.3.beta1 spec/negative_int32_spec.rb
ruby-protocol-buffers-1.2.2 spec/negative_int32_spec.rb