Sha256: df4a4496dfcaeacc5c0dc3df1a9f9cb5b5dfe0e433f2ac94b1f3b7d4fe9a4ac9
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
# encoding: utf-8 require 'test_helper' class ParsiDigitsTest < Test::Unit::TestCase def test_string_with_parsi_digits assert_equal "۹۸۷۶۵۴۳۲۱۰", "9876543210".with_parsi_digits end def test_string_with_western_digits assert_equal "9876543210", "۹۸۷۶۵۴۳۲۱۰".with_western_digits end def test_parsi_string_to_i assert_equal 9876543210, "۹۸۷۶۵۴۳۲۱۰".to_i assert_equal 9876543210, "9876543210".to_i end def test_parsi_string_to_f assert_equal 0.987654321, "۰/۹۸۷۶۵۴۳۲۱".to_f assert_equal 0.987654321, "0.987654321".to_f end def test_string_remove_delimiters assert_equal "۹۸۷۶۵۴۳۲۱۰", "۹٫۸۷۶٫۵۴۳٫۲۱۰".remove_delimiters assert_equal "۹۸۷۶۵۴۳۲۱۰", "۹٫۸۷۶٫۵۴۳٫۲۱۰".remove_delimiters(locale: :fa) assert_equal "9876543210", "9,876,543,210".remove_delimiters(locale: :en) assert_equal "9876543210", "9_876_543_210".remove_delimiters(delimiter: '_') assert_equal "9876543210", "9,876,543,210".remove_delimiters(delimiter: ',') end def test_integer_with_parsi_digits assert_equal "۹۸۷۶۵۴۳۲۱۰", 9876543210.with_parsi_digits end def test_float_with_parsi_digits assert_equal "۹/۰۸۷۶۵۴۳۲۱", 9.087654321.with_parsi_digits end def test_has_parsi_digits assert "۱۹۴".has_parsi_digits? assert "test۹۸".has_parsi_digits? assert !"123".has_parsi_digits? assert !"test".has_parsi_digits? end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
parsi-digits-0.3 | test/parsi_digits_test.rb |
parsi-digits-0.2 | test/parsi_digits_test.rb |