aboutsummaryrefslogblamecommitdiffstats
path: root/activemodel/test/cases/type/big_integer_test.rb
blob: 1ab0abe9cecf5ebaa942d39af1965ad119bf27a2 (plain) (tree)
1
2
3
4
5
6
7

                             
                      


                  
                                                  







                                      
                                                                                                        








                                                                                                     
# frozen_string_literal: true

require "cases/helper"

module ActiveModel
  module Type
    class BigIntegerTest < ActiveSupport::TestCase
      def test_type_cast_big_integer
        type = Type::BigInteger.new
        assert_equal 1, type.cast(1)
        assert_equal 1, type.cast("1")
      end

      def test_small_values
        type = Type::BigInteger.new
        assert_equal(-9999999999999999999999999999999, type.serialize(-9999999999999999999999999999999))
      end

      def test_large_values
        type = Type::BigInteger.new
        assert_equal 9999999999999999999999999999999, type.serialize(9999999999999999999999999999999)
      end
    end
  end
end