Sha256: e35057eae81af4d03c912a00dfc14fc9e89dc5ab24185681849e03620e725a9e
Contents?: true
Size: 1.83 KB
Versions: 5
Compression:
Stored size: 1.83 KB
Contents
require File.join(File.dirname(__FILE__),'test_helper.rb') class TestCurrency < Test::Unit::TestCase #:nodoc:[all] # Teste do modulo currency # Testa se é numero Ex. 1321 ou 13.32 def test_should_return_true_is_numeric assert_equal true, "1234".numeric? assert_equal true, "123.4".numeric? assert_equal true, "123,4".numeric? assert_equal true, "1234.03".numeric? assert_equal true, "1234,03".numeric? assert_equal true, "-1234".numeric? assert_equal true, "-123.4".numeric? assert_equal true, "-123,4".numeric? assert_equal true, "-1234.03".numeric? assert_equal true, "-1234,03".numeric? assert_equal true, "+1234".numeric? assert_equal true, "+123.4".numeric? assert_equal true, "+123,4".numeric? assert_equal true, "+1234.03".numeric? assert_equal true, "+1234,03".numeric? assert_equal false, "1234,".numeric? assert_equal false, "1234.".numeric? assert_equal false, "1,234.03".numeric? assert_equal false, "1.234.03".numeric? assert_equal false, "1,234,03".numeric? assert_equal false, "12.340,03".numeric? assert_equal false, "1234ab".numeric? assert_equal false, "ab1213".numeric? assert_equal false, "ffab".numeric? end def test_should_return_correct_number assert_equal 1234, "1234".to_number assert_equal 123.4, "123.4".to_number assert_equal 123.4, "123,4".to_number assert_equal nil, "1234,".to_number assert_equal nil, "1234.".to_number assert_equal 1234.03, "1234.03".to_number assert_equal 1234.03, "1234,03".to_number assert_equal nil, "1,234.03".to_number assert_equal nil, "1.234.03".to_number assert_equal nil, "1,234,03".to_number assert_equal nil, "12.340,03".to_number assert_equal nil, "1234ab".to_number assert_equal nil, "ab1213".to_number assert_equal nil, "ffab".to_number end end
Version data entries
5 entries across 5 versions & 2 rubygems