Sha256: 1788f260b31a4997b84d3438327e90c20596c0aafdf1d2cd5633e613a12f51e2

Contents?: true

Size: 592 Bytes

Versions: 13

Compression:

Stored size: 592 Bytes

Contents

require 'test_helper'

class Superstore::Types::FloatTypeTest < Superstore::Types::TestCase
  if Superstore::Base.adapter.class.name == 'Superstore::Adapters::CassandraAdapter'
    test 'encode' do
      assert_equal '5.01', type.encode(5.01)

      assert_raise ArgumentError do
        type.encode('x')
      end
    end
  end

  test 'decode' do
    assert_equal 0.0, type.decode('xyz')
    assert_equal 3.14, type.decode('3.14')
    assert_equal 5, type.decode('5')
  end

  test 'typecast' do
    assert_equal 1.1, type.typecast('1.1')
    assert_equal 42.0, type.typecast(42)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
superstore-2.4.4 test/unit/types/float_type_test.rb
superstore-2.4.3 test/unit/types/float_type_test.rb
superstore-2.4.2 test/unit/types/float_type_test.rb
superstore-2.4.1 test/unit/types/float_type_test.rb
superstore-2.4.0 test/unit/types/float_type_test.rb
superstore-2.3.0 test/unit/types/float_type_test.rb
superstore-2.2.0 test/unit/types/float_type_test.rb
superstore-2.1.3 test/unit/types/float_type_test.rb
superstore-2.1.2 test/unit/types/float_type_test.rb
superstore-2.1.1 test/unit/types/float_type_test.rb
superstore-2.1.0 test/unit/types/float_type_test.rb
superstore-2.0.1 test/unit/types/float_type_test.rb
superstore-2.0.0 test/unit/types/float_type_test.rb