Sha256: dfa7af0771b6ff43429e7253db87eafa49a3e99f49a4b964894245f656261d16

Contents?: true

Size: 1.32 KB

Versions: 27

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe ::Protobuf do
  it "correctly encodes extreme values" do
    message = GoogleUnittest::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 = File.expand_path('../../support/test/extreme_values.data.bin', __FILE__)
    data = File.open(data_file_path, 'rb') do |file|
      file.read
    end

    data.should eq message.serialize_to_string
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
protobuffy-3.6.0 spec/encoding/extreme_values_spec.rb
protobuffy-3.5.1 spec/encoding/extreme_values_spec.rb
protobuffy-3.4.0 spec/encoding/extreme_values_spec.rb
protobuffy-3.3.0 spec/encoding/extreme_values_spec.rb
protobuffy-3.2.0 spec/encoding/extreme_values_spec.rb
protobuffy-3.1.0 spec/encoding/extreme_values_spec.rb
protobuf-3.0.4 spec/encoding/extreme_values_spec.rb
protobuf-2.8.13 spec/encoding/extreme_values_spec.rb
protobuf-3.0.3 spec/encoding/extreme_values_spec.rb
protobuf-3.0.2 spec/encoding/extreme_values_spec.rb
protobuf-3.0.1 spec/encoding/extreme_values_spec.rb
protobuf-3.0.0 spec/encoding/extreme_values_spec.rb
protobuf-3.0.0.rc2 spec/encoding/extreme_values_spec.rb
protobuf-3.0.0.rc1 spec/encoding/extreme_values_spec.rb
protobuf-2.8.12 spec/encoding/extreme_values_spec.rb
protobuf-2.8.11 spec/encoding/extreme_values_spec.rb
protobuf-2.8.10 spec/encoding/extreme_values_spec.rb
protobuf-2.8.9 spec/encoding/extreme_values_spec.rb
protobuf-2.8.8 spec/encoding/extreme_values_spec.rb
protobuf-2.8.7 spec/encoding/extreme_values_spec.rb