From: Jason Woofenden Date: Mon, 29 Mar 2010 19:16:58 +0000 (-0400) Subject: made format_int() fail for 1.0 -> 10 X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=commitdiff_plain;h=86e64d13d96d22ed84ebf9938e2744a33af77005 made format_int() fail for 1.0 -> 10 format_int() and friends strip all not-numeric characters. This leads to unexpected results when the user enters something with a decimal point. ie 1.0 -> 10, 12.5 -> 125, etc --- diff --git a/unit_tests/format.php b/unit_tests/format.php index 261ed65..21a1f74 100644 --- a/unit_tests/format.php +++ b/unit_tests/format.php @@ -122,10 +122,10 @@ function test_format_misc() { $errors += _test_format_misc('decimal', '-1', '-1'); $errors += _test_format_misc('decimal', '+1', '1'); - $errors += _test_format_misc('int', '-1.0', '10'); # FIXME? - $errors += _test_format_misc('int', '+1.0', '10'); # FIXME? - $errors += _test_format_misc('int_0', '-1.0', '10'); # FIXME? - $errors += _test_format_misc('int_0', '+1.0', '10'); # FIXME? + $errors += _test_format_misc('int', '-1.0', '1'); + $errors += _test_format_misc('int', '+1.0', '1'); + $errors += _test_format_misc('int_0', '-1.0', '1'); + $errors += _test_format_misc('int_0', '+1.0', '1'); $errors += _test_format_misc('positive_decimal', '-1.0', '1.0'); $errors += _test_format_misc('positive_decimal', '+1.0', '1.0'); $errors += _test_format_misc('decimal', '-1.0', '-1.0');