mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
use BigDecimal on filters to have better precision
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user