use BigDecimal on filters to have better precision

This commit is contained in:
Arthur Neves
2013-06-05 16:09:05 -04:00
parent f4fb2f159c
commit ab760649ee
2 changed files with 25 additions and 14 deletions
+4
View File
@@ -164,6 +164,8 @@ class StandardFiltersTest < Test::Unit::TestCase
assert_match(/(6\.3)|(6\.(0{13})1)/, Template.parse("{{ '2.1' | times:3 }}").render)
assert_template_result "6", "{{ '2.1' | times:3 | replace: '.','-' | plus:0}}"
assert_template_result "7.25", "{{ 0.0725 | times:100 }}"
end
def test_divided_by
@@ -175,6 +177,8 @@ class StandardFiltersTest < Test::Unit::TestCase
assert_template_result "5", "{{ 15 | divided_by:3 }}"
assert_template_result "Liquid error: divided by 0", "{{ 5 | divided_by:0 }}"
assert_template_result "0.5", "{{ 2.0 | divided_by:4 }}"
end
def test_modulo