Merge pull request #454 from Alanscut/float-compare

comparing double value with DBL_EPSILON
This commit is contained in:
Alan Wang authored and GitHub committed 2020-04-02 20:09:42 +08:00
commit 23e4fbc639
5 files changed
+20 -9

No files matched your search

+3
View File
@@ -64,6 +64,9 @@ static void cjson_compare_should_compare_numbers(void)
TEST_ASSERT_TRUE(compare_from_string("1", "1", false));
TEST_ASSERT_TRUE(compare_from_string("0.0001", "0.0001", true));
TEST_ASSERT_TRUE(compare_from_string("0.0001", "0.0001", false));
TEST_ASSERT_TRUE(compare_from_string("1E100", "10E99", false));
TEST_ASSERT_FALSE(compare_from_string("0.5E-100", "0.5E-101", false));
TEST_ASSERT_FALSE(compare_from_string("1", "2", true));
TEST_ASSERT_FALSE(compare_from_string("1", "2", false));