Sha256: b7fed314297d3e4f39918ed2db0b433073bb7aa5d7e9f38ae29963f1a8de571f

Contents?: true

Size: 1.33 KB

Versions: 42

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'
require PROTOS_PATH.join('google_unittest.pb')

RSpec.describe ::Protobuf do
  it "correctly encodes extreme values" do
    message = Protobuf_unittest::TestExtremeDefaultValues.new(
      :escaped_bytes => "\0\001\a\b\f\n\r\t\v\\\'\"\xfe",
      :large_uint32 => 4294967295,
      :large_uint64 => 18446744073709551615,
      :small_int32 => -2147483647,
      :small_int64 => -9223372036854775807,
      :utf8_string => "\u1234",
      :zero_float => 0,
      :one_float => 1,
      :small_float => 1.5,
      :negative_one_float => -1,
      :negative_float => -1.5,
      :large_float => 2e+08,
      :small_negative_float => -8e-28,
      :inf_double => Float::INFINITY,
      :neg_inf_double => -Float::INFINITY,
      :nan_double => Float::NAN,
      :inf_float => Float::INFINITY,
      :neg_inf_float => -Float::INFINITY,
      :nan_float => Float::NAN,
      :cpp_trigraph => "? ? ?? ?? ??? ??/ ??-",
      :really_small_int32 => -2147483648,
      :really_small_int64 => -9223372036854775808,
      :string_with_zero => "hello",
      :bytes_with_zero => "world",
      :string_piece_with_zero => "abc",
      :cord_with_zero => "123",
    )

    data_file_path = PROTOS_PATH.join('extreme_values.data.bin')
    data = File.open(data_file_path, 'rb', &:read)
    expect(data).to eq(message.serialize_to_string)
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
protobuf-3.10.9 spec/encoding/extreme_values_spec.rb
protobuf-3.10.8 spec/encoding/extreme_values_spec.rb
protobuf-3.10.7 spec/encoding/extreme_values_spec.rb
protobuf-3.10.6 spec/encoding/extreme_values_spec.rb
protobuf-3.10.5 spec/encoding/extreme_values_spec.rb
protobuf-3.10.4 spec/encoding/extreme_values_spec.rb
protobuf-3.10.3 spec/encoding/extreme_values_spec.rb
protobuf-3.10.2 spec/encoding/extreme_values_spec.rb
protobuf-3.10.1 spec/encoding/extreme_values_spec.rb
protobuf-3.10.0 spec/encoding/extreme_values_spec.rb
protobuf-3.10.0.pre0 spec/encoding/extreme_values_spec.rb
protobuf-3.9.0 spec/encoding/extreme_values_spec.rb
protobuf-3.9.0.pre2 spec/encoding/extreme_values_spec.rb
protobuf-3.9.0.pre spec/encoding/extreme_values_spec.rb
protobuf-3.8.5 spec/encoding/extreme_values_spec.rb
protobuf-3.8.5.pre0 spec/encoding/extreme_values_spec.rb
protobuf-3.8.4 spec/encoding/extreme_values_spec.rb
protobuf-3.8.3 spec/encoding/extreme_values_spec.rb
protobuf-3.8.2 spec/encoding/extreme_values_spec.rb
protobuf-3.8.1 spec/encoding/extreme_values_spec.rb