135375f98Sopenharmony_ci/* ========================================== 235375f98Sopenharmony_ci Unity Project - A Test Framework for C 335375f98Sopenharmony_ci Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 435375f98Sopenharmony_ci [Released under MIT License. Please refer to license.txt for details] 535375f98Sopenharmony_ci========================================== */ 635375f98Sopenharmony_ci 735375f98Sopenharmony_ci#include "unity.h" 835375f98Sopenharmony_ci#define TEST_INSTANCES 935375f98Sopenharmony_ci#include "self_assessment_utils.h" 1035375f98Sopenharmony_ci 1135375f98Sopenharmony_cistatic int SetToOneToFailInTearDown; 1235375f98Sopenharmony_cistatic int SetToOneMeanWeAlreadyCheckedThisGuy; 1335375f98Sopenharmony_ci 1435375f98Sopenharmony_civoid setUp(void) 1535375f98Sopenharmony_ci{ 1635375f98Sopenharmony_ci SetToOneToFailInTearDown = 0; 1735375f98Sopenharmony_ci SetToOneMeanWeAlreadyCheckedThisGuy = 0; 1835375f98Sopenharmony_ci} 1935375f98Sopenharmony_ci 2035375f98Sopenharmony_civoid tearDown(void) 2135375f98Sopenharmony_ci{ 2235375f98Sopenharmony_ci endPutcharSpy(); /* Stop suppressing test output */ 2335375f98Sopenharmony_ci if (SetToOneToFailInTearDown == 1) 2435375f98Sopenharmony_ci { 2535375f98Sopenharmony_ci /* These will be skipped internally if already failed/ignored */ 2635375f98Sopenharmony_ci TEST_FAIL_MESSAGE("<= Failed in tearDown"); 2735375f98Sopenharmony_ci TEST_IGNORE_MESSAGE("<= Ignored in tearDown"); 2835375f98Sopenharmony_ci } 2935375f98Sopenharmony_ci if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) 3035375f98Sopenharmony_ci { 3135375f98Sopenharmony_ci UnityPrint(": [[[[ Test Should Have Passed But Did Not ]]]]"); 3235375f98Sopenharmony_ci UNITY_OUTPUT_CHAR('\n'); 3335375f98Sopenharmony_ci } 3435375f98Sopenharmony_ci} 3535375f98Sopenharmony_ci 3635375f98Sopenharmony_civoid testDoublesWithinDelta(void) 3735375f98Sopenharmony_ci{ 3835375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 3935375f98Sopenharmony_ci TEST_IGNORE(); 4035375f98Sopenharmony_ci#else 4135375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_WITHIN(0.00003, 187245.03485, 187245.03488); 4235375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_WITHIN(1.0, 187245.0, 187246.0); 4335375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_WITHIN(0.05, 9273.2549, 9273.2049); 4435375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_WITHIN(0.007, -726.93725, -726.94424); 4535375f98Sopenharmony_ci 4635375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 4735375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_NOT_WITHIN(0.05, 9273.2549, 9273.2049); 4835375f98Sopenharmony_ci VERIFY_FAILS_END 4935375f98Sopenharmony_ci#endif 5035375f98Sopenharmony_ci} 5135375f98Sopenharmony_ci 5235375f98Sopenharmony_civoid testDoublesNotWithinDelta(void) 5335375f98Sopenharmony_ci{ 5435375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 5535375f98Sopenharmony_ci TEST_IGNORE(); 5635375f98Sopenharmony_ci#else 5735375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_NOT_WITHIN(0.05, 9273.2649, 9273.2049); 5835375f98Sopenharmony_ci 5935375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 6035375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_WITHIN(0.05, 9273.2649, 9273.2049); 6135375f98Sopenharmony_ci VERIFY_FAILS_END 6235375f98Sopenharmony_ci#endif 6335375f98Sopenharmony_ci} 6435375f98Sopenharmony_ci 6535375f98Sopenharmony_ci 6635375f98Sopenharmony_civoid testDoublesEqual(void) 6735375f98Sopenharmony_ci{ 6835375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 6935375f98Sopenharmony_ci TEST_IGNORE(); 7035375f98Sopenharmony_ci#else 7135375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(187245123456.0, 187245123456.0); 7235375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(187241234567.5, 187241234567.6); 7335375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(9273.2512345649, 9273.25123455699); 7435375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(-726.12345693724, -726.1234569374); 7535375f98Sopenharmony_ci 7635375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 7735375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(-726.12345693724, -726.1234569374); 7835375f98Sopenharmony_ci VERIFY_FAILS_END 7935375f98Sopenharmony_ci#endif 8035375f98Sopenharmony_ci} 8135375f98Sopenharmony_ci 8235375f98Sopenharmony_civoid testDoublesNotEqual(void) 8335375f98Sopenharmony_ci{ 8435375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 8535375f98Sopenharmony_ci TEST_IGNORE(); 8635375f98Sopenharmony_ci#else 8735375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(9273.9649, 9273.0049); 8835375f98Sopenharmony_ci 8935375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 9035375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(9273.9649, 9273.0049); 9135375f98Sopenharmony_ci VERIFY_FAILS_END 9235375f98Sopenharmony_ci#endif 9335375f98Sopenharmony_ci} 9435375f98Sopenharmony_ci 9535375f98Sopenharmony_civoid testDoublesNotEqualNegative1(void) 9635375f98Sopenharmony_ci{ 9735375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 9835375f98Sopenharmony_ci TEST_IGNORE(); 9935375f98Sopenharmony_ci#else 10035375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(-9273.9649, -9273.0049); 10135375f98Sopenharmony_ci 10235375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 10335375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(-9273.9649, -9273.0049); 10435375f98Sopenharmony_ci VERIFY_FAILS_END 10535375f98Sopenharmony_ci#endif 10635375f98Sopenharmony_ci} 10735375f98Sopenharmony_ci 10835375f98Sopenharmony_civoid testDoublesNotEqualNegative2(void) 10935375f98Sopenharmony_ci{ 11035375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 11135375f98Sopenharmony_ci TEST_IGNORE(); 11235375f98Sopenharmony_ci#else 11335375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(-9273.0049, -9273.9649); 11435375f98Sopenharmony_ci 11535375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 11635375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(-9273.0049, -9273.9649); 11735375f98Sopenharmony_ci VERIFY_FAILS_END 11835375f98Sopenharmony_ci#endif 11935375f98Sopenharmony_ci} 12035375f98Sopenharmony_ci 12135375f98Sopenharmony_civoid testDoublesNotEqualActualNaN(void) 12235375f98Sopenharmony_ci{ 12335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 12435375f98Sopenharmony_ci TEST_IGNORE(); 12535375f98Sopenharmony_ci#else 12635375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(85.963, 0.0 / d_zero); 12735375f98Sopenharmony_ci 12835375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 12935375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(85.963, 0.0 / d_zero); 13035375f98Sopenharmony_ci VERIFY_FAILS_END 13135375f98Sopenharmony_ci#endif 13235375f98Sopenharmony_ci} 13335375f98Sopenharmony_ci 13435375f98Sopenharmony_civoid testDoublesNotEqualExpectedNaN(void) 13535375f98Sopenharmony_ci{ 13635375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 13735375f98Sopenharmony_ci TEST_IGNORE(); 13835375f98Sopenharmony_ci#else 13935375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(0.0 / d_zero, 85.963); 14035375f98Sopenharmony_ci 14135375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 14235375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 85.963); 14335375f98Sopenharmony_ci VERIFY_FAILS_END 14435375f98Sopenharmony_ci#endif 14535375f98Sopenharmony_ci} 14635375f98Sopenharmony_ci 14735375f98Sopenharmony_civoid testDoublesEqualBothNaN(void) 14835375f98Sopenharmony_ci{ 14935375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 15035375f98Sopenharmony_ci TEST_IGNORE(); 15135375f98Sopenharmony_ci#else 15235375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 0.0 / d_zero); 15335375f98Sopenharmony_ci 15435375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 15535375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(0.0 / d_zero, 0.0 / d_zero); 15635375f98Sopenharmony_ci VERIFY_FAILS_END 15735375f98Sopenharmony_ci#endif 15835375f98Sopenharmony_ci} 15935375f98Sopenharmony_ci 16035375f98Sopenharmony_civoid testDoublesNotEqualInfNaN(void) 16135375f98Sopenharmony_ci{ 16235375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 16335375f98Sopenharmony_ci TEST_IGNORE(); 16435375f98Sopenharmony_ci#else 16535375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(1.0 / d_zero, 0.0 / d_zero); 16635375f98Sopenharmony_ci 16735375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 16835375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 0.0 / d_zero); 16935375f98Sopenharmony_ci VERIFY_FAILS_END 17035375f98Sopenharmony_ci#endif 17135375f98Sopenharmony_ci} 17235375f98Sopenharmony_ci 17335375f98Sopenharmony_civoid testDoublesNotEqualNaNInf(void) 17435375f98Sopenharmony_ci{ 17535375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 17635375f98Sopenharmony_ci TEST_IGNORE(); 17735375f98Sopenharmony_ci#else 17835375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(0.0 / d_zero, 1.0 / d_zero); 17935375f98Sopenharmony_ci 18035375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 18135375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 1.0 / d_zero); 18235375f98Sopenharmony_ci VERIFY_FAILS_END 18335375f98Sopenharmony_ci#endif 18435375f98Sopenharmony_ci} 18535375f98Sopenharmony_ci 18635375f98Sopenharmony_civoid testDoublesNotEqualActualInf(void) 18735375f98Sopenharmony_ci{ 18835375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 18935375f98Sopenharmony_ci TEST_IGNORE(); 19035375f98Sopenharmony_ci#else 19135375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(321.642, 1.0 / d_zero); 19235375f98Sopenharmony_ci 19335375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 19435375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(321.642, 1.0 / d_zero); 19535375f98Sopenharmony_ci VERIFY_FAILS_END 19635375f98Sopenharmony_ci#endif 19735375f98Sopenharmony_ci} 19835375f98Sopenharmony_ci 19935375f98Sopenharmony_civoid testDoublesNotEqualExpectedInf(void) 20035375f98Sopenharmony_ci{ 20135375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 20235375f98Sopenharmony_ci TEST_IGNORE(); 20335375f98Sopenharmony_ci#else 20435375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(1.0 / d_zero, 321.642); 20535375f98Sopenharmony_ci 20635375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 20735375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 321.642); 20835375f98Sopenharmony_ci VERIFY_FAILS_END 20935375f98Sopenharmony_ci#endif 21035375f98Sopenharmony_ci} 21135375f98Sopenharmony_ci 21235375f98Sopenharmony_civoid testDoublesEqualBothInf(void) 21335375f98Sopenharmony_ci{ 21435375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 21535375f98Sopenharmony_ci TEST_IGNORE(); 21635375f98Sopenharmony_ci#else 21735375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero); 21835375f98Sopenharmony_ci 21935375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 22035375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero); 22135375f98Sopenharmony_ci VERIFY_FAILS_END 22235375f98Sopenharmony_ci#endif 22335375f98Sopenharmony_ci} 22435375f98Sopenharmony_ci 22535375f98Sopenharmony_civoid testDoublesNotEqualPlusMinusInf(void) 22635375f98Sopenharmony_ci{ 22735375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 22835375f98Sopenharmony_ci TEST_IGNORE(); 22935375f98Sopenharmony_ci#else 23035375f98Sopenharmony_ci TEST_ASSERT_NOT_EQUAL_DOUBLE(1.0 / d_zero, -1.0 / d_zero); 23135375f98Sopenharmony_ci 23235375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 23335375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, -1.0 / d_zero); 23435375f98Sopenharmony_ci VERIFY_FAILS_END 23535375f98Sopenharmony_ci#endif 23635375f98Sopenharmony_ci} 23735375f98Sopenharmony_ci 23835375f98Sopenharmony_civoid testDoublesGreaterThan(void) 23935375f98Sopenharmony_ci{ 24035375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 24135375f98Sopenharmony_ci TEST_IGNORE(); 24235375f98Sopenharmony_ci#else 24335375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(1.0, 2.0); 24435375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(-1.0, 1.0); 24535375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(-2.0, -1.0); 24635375f98Sopenharmony_ci#endif 24735375f98Sopenharmony_ci} 24835375f98Sopenharmony_ci 24935375f98Sopenharmony_civoid testDoublesGreaterThanInf(void) 25035375f98Sopenharmony_ci{ 25135375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 25235375f98Sopenharmony_ci TEST_IGNORE(); 25335375f98Sopenharmony_ci#else 25435375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(1.0, 1.0 / d_zero); 25535375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(-1.0 / d_zero, 1.0 / d_zero); 25635375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(-1.0 / d_zero, 1.0); 25735375f98Sopenharmony_ci#endif 25835375f98Sopenharmony_ci} 25935375f98Sopenharmony_ci 26035375f98Sopenharmony_civoid testDoublesNotGreaterThan(void) 26135375f98Sopenharmony_ci{ 26235375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 26335375f98Sopenharmony_ci TEST_IGNORE(); 26435375f98Sopenharmony_ci#else 26535375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 26635375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(2.0, 1.0); 26735375f98Sopenharmony_ci VERIFY_FAILS_END 26835375f98Sopenharmony_ci#endif 26935375f98Sopenharmony_ci} 27035375f98Sopenharmony_ci 27135375f98Sopenharmony_civoid testDoublesNotGreaterThanNanActual(void) 27235375f98Sopenharmony_ci{ 27335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 27435375f98Sopenharmony_ci TEST_IGNORE(); 27535375f98Sopenharmony_ci#else 27635375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 27735375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(1.0, 0.0 / d_zero); 27835375f98Sopenharmony_ci VERIFY_FAILS_END 27935375f98Sopenharmony_ci#endif 28035375f98Sopenharmony_ci} 28135375f98Sopenharmony_ci 28235375f98Sopenharmony_civoid testDoublesNotGreaterThanNanThreshold(void) 28335375f98Sopenharmony_ci{ 28435375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 28535375f98Sopenharmony_ci TEST_IGNORE(); 28635375f98Sopenharmony_ci#else 28735375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 28835375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(0.0 / d_zero, 1.0); 28935375f98Sopenharmony_ci VERIFY_FAILS_END 29035375f98Sopenharmony_ci#endif 29135375f98Sopenharmony_ci} 29235375f98Sopenharmony_ci 29335375f98Sopenharmony_civoid testDoublesNotGreaterThanNanBoth(void) 29435375f98Sopenharmony_ci{ 29535375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 29635375f98Sopenharmony_ci TEST_IGNORE(); 29735375f98Sopenharmony_ci#else 29835375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 29935375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(0.0 / d_zero, 0.0 / d_zero); 30035375f98Sopenharmony_ci VERIFY_FAILS_END 30135375f98Sopenharmony_ci#endif 30235375f98Sopenharmony_ci} 30335375f98Sopenharmony_ci 30435375f98Sopenharmony_civoid testDoublesNotGreaterThanInfActual(void) 30535375f98Sopenharmony_ci{ 30635375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 30735375f98Sopenharmony_ci TEST_IGNORE(); 30835375f98Sopenharmony_ci#else 30935375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 31035375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(1.0 / d_zero, 1.0); 31135375f98Sopenharmony_ci VERIFY_FAILS_END 31235375f98Sopenharmony_ci#endif 31335375f98Sopenharmony_ci} 31435375f98Sopenharmony_ci 31535375f98Sopenharmony_civoid testDoublesNotGreaterThanNegInf(void) 31635375f98Sopenharmony_ci{ 31735375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 31835375f98Sopenharmony_ci TEST_IGNORE(); 31935375f98Sopenharmony_ci#else 32035375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 32135375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(1.0, -1.0 / d_zero); 32235375f98Sopenharmony_ci VERIFY_FAILS_END 32335375f98Sopenharmony_ci#endif 32435375f98Sopenharmony_ci} 32535375f98Sopenharmony_ci 32635375f98Sopenharmony_civoid testDoublesNotGreaterThanBothInf(void) 32735375f98Sopenharmony_ci{ 32835375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 32935375f98Sopenharmony_ci TEST_IGNORE(); 33035375f98Sopenharmony_ci#else 33135375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 33235375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(1.0 / d_zero, 1.0 / d_zero); 33335375f98Sopenharmony_ci VERIFY_FAILS_END 33435375f98Sopenharmony_ci#endif 33535375f98Sopenharmony_ci} 33635375f98Sopenharmony_ci 33735375f98Sopenharmony_civoid testDoublesNotGreaterThanBothNegInf(void) 33835375f98Sopenharmony_ci{ 33935375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 34035375f98Sopenharmony_ci TEST_IGNORE(); 34135375f98Sopenharmony_ci#else 34235375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 34335375f98Sopenharmony_ci TEST_ASSERT_GREATER_THAN_DOUBLE(-1.0 / d_zero, -1.0 / d_zero); 34435375f98Sopenharmony_ci VERIFY_FAILS_END 34535375f98Sopenharmony_ci#endif 34635375f98Sopenharmony_ci} 34735375f98Sopenharmony_ci 34835375f98Sopenharmony_civoid testDoublesGreaterOrEqual(void) 34935375f98Sopenharmony_ci{ 35035375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 35135375f98Sopenharmony_ci TEST_IGNORE(); 35235375f98Sopenharmony_ci#else 35335375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0, 2.0); 35435375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(2.0, 2.0); 35535375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-1.0, 1.0); 35635375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-2.0, -1.0); 35735375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-2.0, -2.0); 35835375f98Sopenharmony_ci#endif 35935375f98Sopenharmony_ci} 36035375f98Sopenharmony_ci 36135375f98Sopenharmony_civoid testDoublesGreaterOrEqualInf(void) 36235375f98Sopenharmony_ci{ 36335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 36435375f98Sopenharmony_ci TEST_IGNORE(); 36535375f98Sopenharmony_ci#else 36635375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0, 1.0 / d_zero); 36735375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-1.0 / d_zero, 1.0 / d_zero); 36835375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-1.0 / d_zero, 1.0); 36935375f98Sopenharmony_ci#endif 37035375f98Sopenharmony_ci} 37135375f98Sopenharmony_ci 37235375f98Sopenharmony_civoid testDoublesNotGreaterOrEqual(void) 37335375f98Sopenharmony_ci{ 37435375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 37535375f98Sopenharmony_ci TEST_IGNORE(); 37635375f98Sopenharmony_ci#else 37735375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 37835375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(2.0, 1.0); 37935375f98Sopenharmony_ci VERIFY_FAILS_END 38035375f98Sopenharmony_ci#endif 38135375f98Sopenharmony_ci} 38235375f98Sopenharmony_ci 38335375f98Sopenharmony_civoid testDoublesNotGreaterOrEqualNanActual(void) 38435375f98Sopenharmony_ci{ 38535375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 38635375f98Sopenharmony_ci TEST_IGNORE(); 38735375f98Sopenharmony_ci#else 38835375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 38935375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0, 0.0 / d_zero); 39035375f98Sopenharmony_ci VERIFY_FAILS_END 39135375f98Sopenharmony_ci#endif 39235375f98Sopenharmony_ci} 39335375f98Sopenharmony_ci 39435375f98Sopenharmony_civoid testDoublesNotGreaterOrEqualNanThreshold(void) 39535375f98Sopenharmony_ci{ 39635375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 39735375f98Sopenharmony_ci TEST_IGNORE(); 39835375f98Sopenharmony_ci#else 39935375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 40035375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(0.0 / d_zero, 1.0); 40135375f98Sopenharmony_ci VERIFY_FAILS_END 40235375f98Sopenharmony_ci#endif 40335375f98Sopenharmony_ci} 40435375f98Sopenharmony_ci 40535375f98Sopenharmony_civoid testDoublesGreaterOrEqualNanBoth(void) 40635375f98Sopenharmony_ci{ 40735375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 40835375f98Sopenharmony_ci TEST_IGNORE(); 40935375f98Sopenharmony_ci#else 41035375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(0.0 / d_zero, 0.0 / d_zero); 41135375f98Sopenharmony_ci#endif 41235375f98Sopenharmony_ci} 41335375f98Sopenharmony_ci 41435375f98Sopenharmony_civoid testDoublesNotGreaterOrEqualInfActual(void) 41535375f98Sopenharmony_ci{ 41635375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 41735375f98Sopenharmony_ci TEST_IGNORE(); 41835375f98Sopenharmony_ci#else 41935375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 42035375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0 / d_zero, 1.0); 42135375f98Sopenharmony_ci VERIFY_FAILS_END 42235375f98Sopenharmony_ci#endif 42335375f98Sopenharmony_ci} 42435375f98Sopenharmony_ci 42535375f98Sopenharmony_civoid testDoublesNotGreaterOrEqualNegInf(void) 42635375f98Sopenharmony_ci{ 42735375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 42835375f98Sopenharmony_ci TEST_IGNORE(); 42935375f98Sopenharmony_ci#else 43035375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 43135375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0, -1.0 / d_zero); 43235375f98Sopenharmony_ci VERIFY_FAILS_END 43335375f98Sopenharmony_ci#endif 43435375f98Sopenharmony_ci} 43535375f98Sopenharmony_ci 43635375f98Sopenharmony_civoid testDoublesGreaterOrEqualBothInf(void) 43735375f98Sopenharmony_ci{ 43835375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 43935375f98Sopenharmony_ci TEST_IGNORE(); 44035375f98Sopenharmony_ci#else 44135375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero); 44235375f98Sopenharmony_ci#endif 44335375f98Sopenharmony_ci} 44435375f98Sopenharmony_ci 44535375f98Sopenharmony_civoid testDoublesGreaterOrEqualBothNegInf(void) 44635375f98Sopenharmony_ci{ 44735375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 44835375f98Sopenharmony_ci TEST_IGNORE(); 44935375f98Sopenharmony_ci#else 45035375f98Sopenharmony_ci TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-1.0 / d_zero, -1.0 / d_zero); 45135375f98Sopenharmony_ci#endif 45235375f98Sopenharmony_ci} 45335375f98Sopenharmony_ci 45435375f98Sopenharmony_civoid testDoublesLessThan(void) 45535375f98Sopenharmony_ci{ 45635375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 45735375f98Sopenharmony_ci TEST_IGNORE(); 45835375f98Sopenharmony_ci#else 45935375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(2.0, 1.0); 46035375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(1.0, -1.0); 46135375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(-1.0, -2.0); 46235375f98Sopenharmony_ci#endif 46335375f98Sopenharmony_ci} 46435375f98Sopenharmony_ci 46535375f98Sopenharmony_civoid testDoublesLessThanInf(void) 46635375f98Sopenharmony_ci{ 46735375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 46835375f98Sopenharmony_ci TEST_IGNORE(); 46935375f98Sopenharmony_ci#else 47035375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(1.0 / d_zero, 1.0); 47135375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(1.0 / d_zero, -1.0 / d_zero); 47235375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(1.0, -1.0 / d_zero); 47335375f98Sopenharmony_ci#endif 47435375f98Sopenharmony_ci} 47535375f98Sopenharmony_ci 47635375f98Sopenharmony_civoid testDoublesNotLessThan(void) 47735375f98Sopenharmony_ci{ 47835375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 47935375f98Sopenharmony_ci TEST_IGNORE(); 48035375f98Sopenharmony_ci#else 48135375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 48235375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(1.0, 2.0); 48335375f98Sopenharmony_ci VERIFY_FAILS_END 48435375f98Sopenharmony_ci#endif 48535375f98Sopenharmony_ci} 48635375f98Sopenharmony_ci 48735375f98Sopenharmony_civoid testDoublesNotLessThanNanActual(void) 48835375f98Sopenharmony_ci{ 48935375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 49035375f98Sopenharmony_ci TEST_IGNORE(); 49135375f98Sopenharmony_ci#else 49235375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 49335375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(1.0, 0.0 / d_zero); 49435375f98Sopenharmony_ci VERIFY_FAILS_END 49535375f98Sopenharmony_ci#endif 49635375f98Sopenharmony_ci} 49735375f98Sopenharmony_ci 49835375f98Sopenharmony_civoid testDoublesNotLessThanNanThreshold(void) 49935375f98Sopenharmony_ci{ 50035375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 50135375f98Sopenharmony_ci TEST_IGNORE(); 50235375f98Sopenharmony_ci#else 50335375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 50435375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(0.0 / d_zero, 1.0); 50535375f98Sopenharmony_ci VERIFY_FAILS_END 50635375f98Sopenharmony_ci#endif 50735375f98Sopenharmony_ci} 50835375f98Sopenharmony_ci 50935375f98Sopenharmony_civoid testDoublesNotLessThanNanBoth(void) 51035375f98Sopenharmony_ci{ 51135375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 51235375f98Sopenharmony_ci TEST_IGNORE(); 51335375f98Sopenharmony_ci#else 51435375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 51535375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(0.0 / d_zero, 0.0 / d_zero); 51635375f98Sopenharmony_ci VERIFY_FAILS_END 51735375f98Sopenharmony_ci#endif 51835375f98Sopenharmony_ci} 51935375f98Sopenharmony_ci 52035375f98Sopenharmony_civoid testDoublesNotLessThanInf(void) 52135375f98Sopenharmony_ci{ 52235375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 52335375f98Sopenharmony_ci TEST_IGNORE(); 52435375f98Sopenharmony_ci#else 52535375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 52635375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(1.0, 1.0 / d_zero); 52735375f98Sopenharmony_ci VERIFY_FAILS_END 52835375f98Sopenharmony_ci#endif 52935375f98Sopenharmony_ci} 53035375f98Sopenharmony_ci 53135375f98Sopenharmony_civoid testDoublesNotLessThanNegInf(void) 53235375f98Sopenharmony_ci{ 53335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 53435375f98Sopenharmony_ci TEST_IGNORE(); 53535375f98Sopenharmony_ci#else 53635375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 53735375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(-1.0 / d_zero, 1.0); 53835375f98Sopenharmony_ci VERIFY_FAILS_END 53935375f98Sopenharmony_ci#endif 54035375f98Sopenharmony_ci} 54135375f98Sopenharmony_ci 54235375f98Sopenharmony_civoid testDoublesNotLessThanBothInf(void) 54335375f98Sopenharmony_ci{ 54435375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 54535375f98Sopenharmony_ci TEST_IGNORE(); 54635375f98Sopenharmony_ci#else 54735375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 54835375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(1.0 / d_zero, 1.0 / d_zero); 54935375f98Sopenharmony_ci VERIFY_FAILS_END 55035375f98Sopenharmony_ci#endif 55135375f98Sopenharmony_ci} 55235375f98Sopenharmony_ci 55335375f98Sopenharmony_civoid testDoublesNotLessThanBothNegInf(void) 55435375f98Sopenharmony_ci{ 55535375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 55635375f98Sopenharmony_ci TEST_IGNORE(); 55735375f98Sopenharmony_ci#else 55835375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 55935375f98Sopenharmony_ci TEST_ASSERT_LESS_THAN_DOUBLE(-1.0 / d_zero, -1.0 / d_zero); 56035375f98Sopenharmony_ci VERIFY_FAILS_END 56135375f98Sopenharmony_ci#endif 56235375f98Sopenharmony_ci} 56335375f98Sopenharmony_ci 56435375f98Sopenharmony_civoid testDoublesLessOrEqual(void) 56535375f98Sopenharmony_ci{ 56635375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 56735375f98Sopenharmony_ci TEST_IGNORE(); 56835375f98Sopenharmony_ci#else 56935375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(2.0, 1.0); 57035375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(2.0, 2.0); 57135375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0, -1.0); 57235375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(-1.0, -2.0); 57335375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(-2.0, -2.0); 57435375f98Sopenharmony_ci#endif 57535375f98Sopenharmony_ci} 57635375f98Sopenharmony_ci 57735375f98Sopenharmony_civoid testDoublesLessOrEqualInf(void) 57835375f98Sopenharmony_ci{ 57935375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 58035375f98Sopenharmony_ci TEST_IGNORE(); 58135375f98Sopenharmony_ci#else 58235375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0 / d_zero, 1.0); 58335375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0 / d_zero, -1.0 / d_zero); 58435375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0, -1.0 / d_zero); 58535375f98Sopenharmony_ci#endif 58635375f98Sopenharmony_ci} 58735375f98Sopenharmony_ci 58835375f98Sopenharmony_civoid testDoublesNotLessOrEqual(void) 58935375f98Sopenharmony_ci{ 59035375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 59135375f98Sopenharmony_ci TEST_IGNORE(); 59235375f98Sopenharmony_ci#else 59335375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 59435375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0, 2.0); 59535375f98Sopenharmony_ci VERIFY_FAILS_END 59635375f98Sopenharmony_ci#endif 59735375f98Sopenharmony_ci} 59835375f98Sopenharmony_ci 59935375f98Sopenharmony_civoid testDoublesNotLessOrEqualNanActual(void) 60035375f98Sopenharmony_ci{ 60135375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 60235375f98Sopenharmony_ci TEST_IGNORE(); 60335375f98Sopenharmony_ci#else 60435375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 60535375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0, 0.0 / d_zero); 60635375f98Sopenharmony_ci VERIFY_FAILS_END 60735375f98Sopenharmony_ci#endif 60835375f98Sopenharmony_ci} 60935375f98Sopenharmony_ci 61035375f98Sopenharmony_civoid testDoublesNotLessOrEqualNanThreshold(void) 61135375f98Sopenharmony_ci{ 61235375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 61335375f98Sopenharmony_ci TEST_IGNORE(); 61435375f98Sopenharmony_ci#else 61535375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 61635375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(0.0 / d_zero, 1.0); 61735375f98Sopenharmony_ci VERIFY_FAILS_END 61835375f98Sopenharmony_ci#endif 61935375f98Sopenharmony_ci} 62035375f98Sopenharmony_ci 62135375f98Sopenharmony_civoid testDoublesLessOrEqualNanBoth(void) 62235375f98Sopenharmony_ci{ 62335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 62435375f98Sopenharmony_ci TEST_IGNORE(); 62535375f98Sopenharmony_ci#else 62635375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(0.0 / d_zero, 0.0 / d_zero); 62735375f98Sopenharmony_ci#endif 62835375f98Sopenharmony_ci} 62935375f98Sopenharmony_ci 63035375f98Sopenharmony_civoid testDoublesNotLessOrEqualInf(void) 63135375f98Sopenharmony_ci{ 63235375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 63335375f98Sopenharmony_ci TEST_IGNORE(); 63435375f98Sopenharmony_ci#else 63535375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 63635375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0, 1.0 / d_zero); 63735375f98Sopenharmony_ci VERIFY_FAILS_END 63835375f98Sopenharmony_ci#endif 63935375f98Sopenharmony_ci} 64035375f98Sopenharmony_ci 64135375f98Sopenharmony_civoid testDoublesNotLessOrEqualNegInf(void) 64235375f98Sopenharmony_ci{ 64335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 64435375f98Sopenharmony_ci TEST_IGNORE(); 64535375f98Sopenharmony_ci#else 64635375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 64735375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(-1.0 / d_zero, 1.0); 64835375f98Sopenharmony_ci VERIFY_FAILS_END 64935375f98Sopenharmony_ci#endif 65035375f98Sopenharmony_ci} 65135375f98Sopenharmony_ci 65235375f98Sopenharmony_civoid testDoublesLessOrEqualBothInf(void) 65335375f98Sopenharmony_ci{ 65435375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 65535375f98Sopenharmony_ci TEST_IGNORE(); 65635375f98Sopenharmony_ci#else 65735375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero); 65835375f98Sopenharmony_ci#endif 65935375f98Sopenharmony_ci} 66035375f98Sopenharmony_ci 66135375f98Sopenharmony_civoid testDoublesLessOrEqualBothNegInf(void) 66235375f98Sopenharmony_ci{ 66335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 66435375f98Sopenharmony_ci TEST_IGNORE(); 66535375f98Sopenharmony_ci#else 66635375f98Sopenharmony_ci TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(-1.0 / d_zero, -1.0 / d_zero); 66735375f98Sopenharmony_ci#endif 66835375f98Sopenharmony_ci} 66935375f98Sopenharmony_ci 67035375f98Sopenharmony_civoid testDoubleIsPosInf1(void) 67135375f98Sopenharmony_ci{ 67235375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 67335375f98Sopenharmony_ci TEST_IGNORE(); 67435375f98Sopenharmony_ci#else 67535375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_INF(2.0 / d_zero); 67635375f98Sopenharmony_ci#endif 67735375f98Sopenharmony_ci} 67835375f98Sopenharmony_ci 67935375f98Sopenharmony_civoid testDoubleIsPosInf2(void) 68035375f98Sopenharmony_ci{ 68135375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 68235375f98Sopenharmony_ci TEST_IGNORE(); 68335375f98Sopenharmony_ci#else 68435375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 68535375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NOT_INF(2.0 / d_zero); 68635375f98Sopenharmony_ci VERIFY_FAILS_END 68735375f98Sopenharmony_ci#endif 68835375f98Sopenharmony_ci} 68935375f98Sopenharmony_ci 69035375f98Sopenharmony_civoid testDoubleIsNegInf1(void) 69135375f98Sopenharmony_ci{ 69235375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 69335375f98Sopenharmony_ci TEST_IGNORE(); 69435375f98Sopenharmony_ci#else 69535375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NEG_INF(-3.0 / d_zero); 69635375f98Sopenharmony_ci#endif 69735375f98Sopenharmony_ci} 69835375f98Sopenharmony_ci 69935375f98Sopenharmony_civoid testDoubleIsNegInf2(void) 70035375f98Sopenharmony_ci{ 70135375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 70235375f98Sopenharmony_ci TEST_IGNORE(); 70335375f98Sopenharmony_ci#else 70435375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 70535375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(-3.0 / d_zero); 70635375f98Sopenharmony_ci VERIFY_FAILS_END 70735375f98Sopenharmony_ci#endif 70835375f98Sopenharmony_ci} 70935375f98Sopenharmony_ci 71035375f98Sopenharmony_civoid testDoubleIsNotPosInf1(void) 71135375f98Sopenharmony_ci{ 71235375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 71335375f98Sopenharmony_ci TEST_IGNORE(); 71435375f98Sopenharmony_ci#else 71535375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 71635375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_INF(2.0); 71735375f98Sopenharmony_ci VERIFY_FAILS_END 71835375f98Sopenharmony_ci#endif 71935375f98Sopenharmony_ci} 72035375f98Sopenharmony_ci 72135375f98Sopenharmony_civoid testDoubleIsNotPosInf2(void) 72235375f98Sopenharmony_ci{ 72335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 72435375f98Sopenharmony_ci TEST_IGNORE(); 72535375f98Sopenharmony_ci#else 72635375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NOT_INF(2.0); 72735375f98Sopenharmony_ci#endif 72835375f98Sopenharmony_ci} 72935375f98Sopenharmony_ci 73035375f98Sopenharmony_civoid testDoubleIsNotNegInf(void) 73135375f98Sopenharmony_ci{ 73235375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 73335375f98Sopenharmony_ci TEST_IGNORE(); 73435375f98Sopenharmony_ci#else 73535375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 73635375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NEG_INF(-999.876); 73735375f98Sopenharmony_ci VERIFY_FAILS_END 73835375f98Sopenharmony_ci#endif 73935375f98Sopenharmony_ci} 74035375f98Sopenharmony_ci 74135375f98Sopenharmony_civoid testDoubleIsNan1(void) 74235375f98Sopenharmony_ci{ 74335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 74435375f98Sopenharmony_ci TEST_IGNORE(); 74535375f98Sopenharmony_ci#else 74635375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NAN(0.0 / d_zero); 74735375f98Sopenharmony_ci#endif 74835375f98Sopenharmony_ci} 74935375f98Sopenharmony_ci 75035375f98Sopenharmony_civoid testDoubleIsNan2(void) 75135375f98Sopenharmony_ci{ 75235375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 75335375f98Sopenharmony_ci TEST_IGNORE(); 75435375f98Sopenharmony_ci#else 75535375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 75635375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NOT_NAN(0.0 / d_zero); 75735375f98Sopenharmony_ci VERIFY_FAILS_END 75835375f98Sopenharmony_ci#endif 75935375f98Sopenharmony_ci} 76035375f98Sopenharmony_ci 76135375f98Sopenharmony_civoid testDoubleIsNotNan1(void) 76235375f98Sopenharmony_ci{ 76335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 76435375f98Sopenharmony_ci TEST_IGNORE(); 76535375f98Sopenharmony_ci#else 76635375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 76735375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NAN(234.9); 76835375f98Sopenharmony_ci VERIFY_FAILS_END 76935375f98Sopenharmony_ci#endif 77035375f98Sopenharmony_ci} 77135375f98Sopenharmony_ci 77235375f98Sopenharmony_civoid testDoubleIsNotNan2(void) 77335375f98Sopenharmony_ci{ 77435375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 77535375f98Sopenharmony_ci TEST_IGNORE(); 77635375f98Sopenharmony_ci#else 77735375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NOT_NAN(234.9); 77835375f98Sopenharmony_ci#endif 77935375f98Sopenharmony_ci} 78035375f98Sopenharmony_ci 78135375f98Sopenharmony_civoid testDoubleInfIsNotNan(void) 78235375f98Sopenharmony_ci{ 78335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 78435375f98Sopenharmony_ci TEST_IGNORE(); 78535375f98Sopenharmony_ci#else 78635375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 78735375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NAN(1.0 / d_zero); 78835375f98Sopenharmony_ci VERIFY_FAILS_END 78935375f98Sopenharmony_ci#endif 79035375f98Sopenharmony_ci} 79135375f98Sopenharmony_ci 79235375f98Sopenharmony_civoid testDoubleNanIsNotInf(void) 79335375f98Sopenharmony_ci{ 79435375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 79535375f98Sopenharmony_ci TEST_IGNORE(); 79635375f98Sopenharmony_ci#else 79735375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 79835375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_INF(0.0 / d_zero); 79935375f98Sopenharmony_ci VERIFY_FAILS_END 80035375f98Sopenharmony_ci#endif 80135375f98Sopenharmony_ci} 80235375f98Sopenharmony_ci 80335375f98Sopenharmony_civoid testDoubleIsDeterminate1(void) 80435375f98Sopenharmony_ci{ 80535375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 80635375f98Sopenharmony_ci TEST_IGNORE(); 80735375f98Sopenharmony_ci#else 80835375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_DETERMINATE(0.0); 80935375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_DETERMINATE(123.3); 81035375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_DETERMINATE(-88.3); 81135375f98Sopenharmony_ci#endif 81235375f98Sopenharmony_ci} 81335375f98Sopenharmony_ci 81435375f98Sopenharmony_civoid testDoubleIsDeterminate2(void) 81535375f98Sopenharmony_ci{ 81635375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 81735375f98Sopenharmony_ci TEST_IGNORE(); 81835375f98Sopenharmony_ci#else 81935375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 82035375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(-88.3); 82135375f98Sopenharmony_ci VERIFY_FAILS_END 82235375f98Sopenharmony_ci#endif 82335375f98Sopenharmony_ci} 82435375f98Sopenharmony_ci 82535375f98Sopenharmony_civoid testDoubleIsNotDeterminate1(void) 82635375f98Sopenharmony_ci{ 82735375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 82835375f98Sopenharmony_ci TEST_IGNORE(); 82935375f98Sopenharmony_ci#else 83035375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(1.0 / d_zero); 83135375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(-1.0 / d_zero); 83235375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(0.0 / d_zero); 83335375f98Sopenharmony_ci#endif 83435375f98Sopenharmony_ci} 83535375f98Sopenharmony_ci 83635375f98Sopenharmony_civoid testDoubleIsNotDeterminate2(void) 83735375f98Sopenharmony_ci{ 83835375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 83935375f98Sopenharmony_ci TEST_IGNORE(); 84035375f98Sopenharmony_ci#else 84135375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 84235375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_IS_DETERMINATE(-1.0 / d_zero); 84335375f98Sopenharmony_ci VERIFY_FAILS_END 84435375f98Sopenharmony_ci#endif 84535375f98Sopenharmony_ci} 84635375f98Sopenharmony_ci 84735375f98Sopenharmony_civoid testDoubleTraitFailsOnInvalidTrait(void) 84835375f98Sopenharmony_ci{ 84935375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 85035375f98Sopenharmony_ci TEST_IGNORE(); 85135375f98Sopenharmony_ci#else 85235375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 85335375f98Sopenharmony_ci UnityAssertDoubleSpecial(1.0, NULL, __LINE__, UNITY_FLOAT_INVALID_TRAIT); 85435375f98Sopenharmony_ci VERIFY_FAILS_END 85535375f98Sopenharmony_ci#endif 85635375f98Sopenharmony_ci} 85735375f98Sopenharmony_ci 85835375f98Sopenharmony_civoid testEqualDoubleArrays(void) 85935375f98Sopenharmony_ci{ 86035375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 86135375f98Sopenharmony_ci TEST_IGNORE(); 86235375f98Sopenharmony_ci#else 86335375f98Sopenharmony_ci double p0[] = {1.0, -8.0, 25.4, -0.123}; 86435375f98Sopenharmony_ci double p1[] = {1.0, -8.0, 25.4, -0.123}; 86535375f98Sopenharmony_ci double p2[] = {1.0, -8.0, 25.4, -0.2}; 86635375f98Sopenharmony_ci double p3[] = {1.0, -23.0, 25.0, -0.26}; 86735375f98Sopenharmony_ci 86835375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p0, 1); 86935375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p0, 4); 87035375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); 87135375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p2, 3); 87235375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p3, 1); 87335375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(NULL, NULL, 1); 87435375f98Sopenharmony_ci#endif 87535375f98Sopenharmony_ci} 87635375f98Sopenharmony_ci 87735375f98Sopenharmony_civoid testNotEqualDoubleArraysExpectedNull(void) 87835375f98Sopenharmony_ci{ 87935375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 88035375f98Sopenharmony_ci TEST_IGNORE(); 88135375f98Sopenharmony_ci#else 88235375f98Sopenharmony_ci double* p0 = NULL; 88335375f98Sopenharmony_ci double p1[] = {1.0, 8.0, 25.4, 0.252}; 88435375f98Sopenharmony_ci 88535375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 88635375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); 88735375f98Sopenharmony_ci VERIFY_FAILS_END 88835375f98Sopenharmony_ci#endif 88935375f98Sopenharmony_ci} 89035375f98Sopenharmony_ci 89135375f98Sopenharmony_civoid testNotEqualDoubleArraysActualNull(void) 89235375f98Sopenharmony_ci{ 89335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 89435375f98Sopenharmony_ci TEST_IGNORE(); 89535375f98Sopenharmony_ci#else 89635375f98Sopenharmony_ci double p0[] = {1.0, 8.0, 25.4, 0.253}; 89735375f98Sopenharmony_ci double* p1 = NULL; 89835375f98Sopenharmony_ci 89935375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 90035375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); 90135375f98Sopenharmony_ci VERIFY_FAILS_END 90235375f98Sopenharmony_ci#endif 90335375f98Sopenharmony_ci} 90435375f98Sopenharmony_ci 90535375f98Sopenharmony_civoid testNotEqualDoubleArrays1(void) 90635375f98Sopenharmony_ci{ 90735375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 90835375f98Sopenharmony_ci TEST_IGNORE(); 90935375f98Sopenharmony_ci#else 91035375f98Sopenharmony_ci double p0[] = {1.0, 8.0, 25.4, 0.25666666667}; 91135375f98Sopenharmony_ci double p1[] = {1.0, 8.0, 25.4, 0.25666666666}; 91235375f98Sopenharmony_ci 91335375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 91435375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); 91535375f98Sopenharmony_ci VERIFY_FAILS_END 91635375f98Sopenharmony_ci#endif 91735375f98Sopenharmony_ci} 91835375f98Sopenharmony_ci 91935375f98Sopenharmony_civoid testNotEqualDoubleArrays2(void) 92035375f98Sopenharmony_ci{ 92135375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 92235375f98Sopenharmony_ci TEST_IGNORE(); 92335375f98Sopenharmony_ci#else 92435375f98Sopenharmony_ci double p0[] = {1.0, 8.0, 25.4, 0.253}; 92535375f98Sopenharmony_ci double p1[] = {2.0, 8.0, 25.4, 0.253}; 92635375f98Sopenharmony_ci 92735375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 92835375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); 92935375f98Sopenharmony_ci VERIFY_FAILS_END 93035375f98Sopenharmony_ci#endif 93135375f98Sopenharmony_ci} 93235375f98Sopenharmony_ci 93335375f98Sopenharmony_civoid testNotEqualDoubleArrays3(void) 93435375f98Sopenharmony_ci{ 93535375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 93635375f98Sopenharmony_ci TEST_IGNORE(); 93735375f98Sopenharmony_ci#else 93835375f98Sopenharmony_ci double p0[] = {1.0, 8.0, 25.4, 0.253}; 93935375f98Sopenharmony_ci double p1[] = {1.0, 8.0, 25.5, 0.253}; 94035375f98Sopenharmony_ci 94135375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 94235375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); 94335375f98Sopenharmony_ci VERIFY_FAILS_END 94435375f98Sopenharmony_ci#endif 94535375f98Sopenharmony_ci} 94635375f98Sopenharmony_ci 94735375f98Sopenharmony_civoid testNotEqualDoubleArraysNegative1(void) 94835375f98Sopenharmony_ci{ 94935375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 95035375f98Sopenharmony_ci TEST_IGNORE(); 95135375f98Sopenharmony_ci#else 95235375f98Sopenharmony_ci double p0[] = {-1.0, -8.0, -25.4, -0.2566666667}; 95335375f98Sopenharmony_ci double p1[] = {-1.0, -8.0, -25.4, -0.2566666666}; 95435375f98Sopenharmony_ci 95535375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 95635375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); 95735375f98Sopenharmony_ci VERIFY_FAILS_END 95835375f98Sopenharmony_ci#endif 95935375f98Sopenharmony_ci} 96035375f98Sopenharmony_ci 96135375f98Sopenharmony_civoid testNotEqualDoubleArraysNegative2(void) 96235375f98Sopenharmony_ci{ 96335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 96435375f98Sopenharmony_ci TEST_IGNORE(); 96535375f98Sopenharmony_ci#else 96635375f98Sopenharmony_ci double p0[] = {-1.0, -8.0, -25.4, -0.253}; 96735375f98Sopenharmony_ci double p1[] = {-2.0, -8.0, -25.4, -0.253}; 96835375f98Sopenharmony_ci 96935375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 97035375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); 97135375f98Sopenharmony_ci VERIFY_FAILS_END 97235375f98Sopenharmony_ci#endif 97335375f98Sopenharmony_ci} 97435375f98Sopenharmony_ci 97535375f98Sopenharmony_civoid testNotEqualDoubleArraysNegative3(void) 97635375f98Sopenharmony_ci{ 97735375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 97835375f98Sopenharmony_ci TEST_IGNORE(); 97935375f98Sopenharmony_ci#else 98035375f98Sopenharmony_ci double p0[] = {-1.0, -8.0, -25.4, -0.253}; 98135375f98Sopenharmony_ci double p1[] = {-1.0, -8.0, -25.5, -0.253}; 98235375f98Sopenharmony_ci 98335375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 98435375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); 98535375f98Sopenharmony_ci VERIFY_FAILS_END 98635375f98Sopenharmony_ci#endif 98735375f98Sopenharmony_ci} 98835375f98Sopenharmony_ci 98935375f98Sopenharmony_civoid testEqualDoubleArraysNaN(void) 99035375f98Sopenharmony_ci{ 99135375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 99235375f98Sopenharmony_ci TEST_IGNORE(); 99335375f98Sopenharmony_ci#else 99435375f98Sopenharmony_ci double p0[] = {1.0, 0.0 / d_zero, 25.4, 0.253}; 99535375f98Sopenharmony_ci double p1[] = {1.0, 0.0 / d_zero, 25.4, 0.253}; 99635375f98Sopenharmony_ci 99735375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); 99835375f98Sopenharmony_ci#endif 99935375f98Sopenharmony_ci} 100035375f98Sopenharmony_ci 100135375f98Sopenharmony_civoid testEqualDoubleArraysInf(void) 100235375f98Sopenharmony_ci{ 100335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 100435375f98Sopenharmony_ci TEST_IGNORE(); 100535375f98Sopenharmony_ci#else 100635375f98Sopenharmony_ci double p0[] = {1.0, 1.0 / d_zero, 25.4, 0.253}; 100735375f98Sopenharmony_ci double p1[] = {1.0, 1.0 / d_zero, 25.4, 0.253}; 100835375f98Sopenharmony_ci 100935375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); 101035375f98Sopenharmony_ci#endif 101135375f98Sopenharmony_ci} 101235375f98Sopenharmony_ci 101335375f98Sopenharmony_civoid testNotEqualDoubleArraysLengthZero(void) 101435375f98Sopenharmony_ci{ 101535375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 101635375f98Sopenharmony_ci TEST_IGNORE(); 101735375f98Sopenharmony_ci#else 101835375f98Sopenharmony_ci double p0[1] = {0.0}; 101935375f98Sopenharmony_ci double p1[1] = {0.0}; 102035375f98Sopenharmony_ci 102135375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 102235375f98Sopenharmony_ci TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 0); 102335375f98Sopenharmony_ci VERIFY_FAILS_END 102435375f98Sopenharmony_ci#endif 102535375f98Sopenharmony_ci} 102635375f98Sopenharmony_ci 102735375f98Sopenharmony_civoid testDoubleArraysWithin(void) 102835375f98Sopenharmony_ci{ 102935375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 103035375f98Sopenharmony_ci TEST_IGNORE(); 103135375f98Sopenharmony_ci#else 103235375f98Sopenharmony_ci double p0[] = {1.0, -8.0, 25.4, -0.123}; 103335375f98Sopenharmony_ci double p1[] = {1.0, -8.0, 25.4, -0.123}; 103435375f98Sopenharmony_ci double p2[] = {1.0, -8.0, 25.4, -0.2}; 103535375f98Sopenharmony_ci double p3[] = {1.0, -23.0, 25.0, -0.26}; 103635375f98Sopenharmony_ci double p4[] = {2.0, -9.0, 26.2, 0.26}; 103735375f98Sopenharmony_ci double p5[] = {-1.0, -7.0, 29.0, 2.6}; 103835375f98Sopenharmony_ci 103935375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(1.0, p0, p0, 1); 104035375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(1.0, p0, p0, 4); 104135375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(1.0, p0, p1, 4); 104235375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(1.0, p0, p2, 3); 104335375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(1.0, p0, p3, 1); 104435375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(1.0, p0, p4, 1); 104535375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(1.0, p0, p4, 4); 104635375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(2.0, p0, p5, 1); 104735375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(2.0, p0, p5, 2); 104835375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(1.0, NULL, NULL, 1); 104935375f98Sopenharmony_ci#endif 105035375f98Sopenharmony_ci} 105135375f98Sopenharmony_ci 105235375f98Sopenharmony_civoid testDoubleArraysWithinUnusualDelta(void) 105335375f98Sopenharmony_ci{ 105435375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 105535375f98Sopenharmony_ci TEST_IGNORE(); 105635375f98Sopenharmony_ci#else 105735375f98Sopenharmony_ci double p0[] = {-INFINITY, -8.0, 25.4, -0.123}; 105835375f98Sopenharmony_ci double p1[] = {INFINITY, 10.1}; 105935375f98Sopenharmony_ci 106035375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(INFINITY, p0, p1, 2); 106135375f98Sopenharmony_ci 106235375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 106335375f98Sopenharmony_ci TEST_ASSERT_DOUBLE_ARRAY_WITHIN(NAN, p0, p0, 4); 106435375f98Sopenharmony_ci VERIFY_FAILS_END 106535375f98Sopenharmony_ci#endif 106635375f98Sopenharmony_ci} 106735375f98Sopenharmony_ci 106835375f98Sopenharmony_civoid testEqualDoubleEachEqual(void) 106935375f98Sopenharmony_ci{ 107035375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 107135375f98Sopenharmony_ci TEST_IGNORE(); 107235375f98Sopenharmony_ci#else 107335375f98Sopenharmony_ci double p0[] = {1.0, 1.0, 1.0, 1.0}; 107435375f98Sopenharmony_ci double p1[] = {-0.123, -0.123, -0.123, -0.123}; 107535375f98Sopenharmony_ci double p2[] = {25.4, 25.4, 25.4, -0.2}; 107635375f98Sopenharmony_ci double p3[] = {1.0, -23.0, 25.0, -0.26}; 107735375f98Sopenharmony_ci 107835375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(1.0, p0, 1); 107935375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(1.0, p0, 4); 108035375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(-0.123, p1, 4); 108135375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(25.4, p2, 3); 108235375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(1.0, p3, 1); 108335375f98Sopenharmony_ci#endif 108435375f98Sopenharmony_ci} 108535375f98Sopenharmony_ci 108635375f98Sopenharmony_civoid testNotEqualDoubleEachEqualActualNull(void) 108735375f98Sopenharmony_ci{ 108835375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 108935375f98Sopenharmony_ci TEST_IGNORE(); 109035375f98Sopenharmony_ci#else 109135375f98Sopenharmony_ci double* p0 = NULL; 109235375f98Sopenharmony_ci 109335375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 109435375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(5, p0, 4); 109535375f98Sopenharmony_ci VERIFY_FAILS_END 109635375f98Sopenharmony_ci#endif 109735375f98Sopenharmony_ci} 109835375f98Sopenharmony_ci 109935375f98Sopenharmony_civoid testNotEqualDoubleEachEqual1(void) 110035375f98Sopenharmony_ci{ 110135375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 110235375f98Sopenharmony_ci TEST_IGNORE(); 110335375f98Sopenharmony_ci#else 110435375f98Sopenharmony_ci double p0[] = {0.253, 8.0, 0.253, 0.253}; 110535375f98Sopenharmony_ci 110635375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 110735375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(0.253, p0, 4); 110835375f98Sopenharmony_ci VERIFY_FAILS_END 110935375f98Sopenharmony_ci#endif 111035375f98Sopenharmony_ci} 111135375f98Sopenharmony_ci 111235375f98Sopenharmony_civoid testNotEqualDoubleEachEqual2(void) 111335375f98Sopenharmony_ci{ 111435375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 111535375f98Sopenharmony_ci TEST_IGNORE(); 111635375f98Sopenharmony_ci#else 111735375f98Sopenharmony_ci double p0[] = {8.0, 8.0, 8.0, 0.253}; 111835375f98Sopenharmony_ci 111935375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 112035375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(8.0, p0, 4); 112135375f98Sopenharmony_ci VERIFY_FAILS_END 112235375f98Sopenharmony_ci#endif 112335375f98Sopenharmony_ci} 112435375f98Sopenharmony_ci 112535375f98Sopenharmony_civoid testNotEqualDoubleEachEqual3(void) 112635375f98Sopenharmony_ci{ 112735375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 112835375f98Sopenharmony_ci TEST_IGNORE(); 112935375f98Sopenharmony_ci#else 113035375f98Sopenharmony_ci double p0[] = {1.0, 1.0, 1.0, 0.253}; 113135375f98Sopenharmony_ci 113235375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 113335375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(1.0, p0, 4); 113435375f98Sopenharmony_ci VERIFY_FAILS_END 113535375f98Sopenharmony_ci#endif 113635375f98Sopenharmony_ci} 113735375f98Sopenharmony_ci 113835375f98Sopenharmony_civoid testNotEqualDoubleEachEqualNegative1(void) 113935375f98Sopenharmony_ci{ 114035375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 114135375f98Sopenharmony_ci TEST_IGNORE(); 114235375f98Sopenharmony_ci#else 114335375f98Sopenharmony_ci double p0[] = {-1.0, -0.253, -0.253, -0.253}; 114435375f98Sopenharmony_ci 114535375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 114635375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(-0.253, p0, 4); 114735375f98Sopenharmony_ci VERIFY_FAILS_END 114835375f98Sopenharmony_ci#endif 114935375f98Sopenharmony_ci} 115035375f98Sopenharmony_ci 115135375f98Sopenharmony_civoid testNotEqualDoubleEachEqualNegative2(void) 115235375f98Sopenharmony_ci{ 115335375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 115435375f98Sopenharmony_ci TEST_IGNORE(); 115535375f98Sopenharmony_ci#else 115635375f98Sopenharmony_ci double p0[] = {-25.4, -8.0, -25.4, -25.4}; 115735375f98Sopenharmony_ci 115835375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 115935375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(-25.4, p0, 4); 116035375f98Sopenharmony_ci VERIFY_FAILS_END 116135375f98Sopenharmony_ci#endif 116235375f98Sopenharmony_ci} 116335375f98Sopenharmony_ci 116435375f98Sopenharmony_civoid testNotEqualDoubleEachEqualNegative3(void) 116535375f98Sopenharmony_ci{ 116635375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 116735375f98Sopenharmony_ci TEST_IGNORE(); 116835375f98Sopenharmony_ci#else 116935375f98Sopenharmony_ci double p0[] = {-8.0, -8.0, -8.0, -0.253}; 117035375f98Sopenharmony_ci 117135375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 117235375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(-8.0, p0, 4); 117335375f98Sopenharmony_ci VERIFY_FAILS_END 117435375f98Sopenharmony_ci#endif 117535375f98Sopenharmony_ci} 117635375f98Sopenharmony_ci 117735375f98Sopenharmony_civoid testEqualDoubleEachEqualNaN(void) 117835375f98Sopenharmony_ci{ 117935375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 118035375f98Sopenharmony_ci TEST_IGNORE(); 118135375f98Sopenharmony_ci#else 118235375f98Sopenharmony_ci double p0[] = {0.0 / d_zero, 0.0 / d_zero, 0.0 / d_zero, 0.0 / d_zero}; 118335375f98Sopenharmony_ci 118435375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(0.0 / d_zero, p0, 4); 118535375f98Sopenharmony_ci#endif 118635375f98Sopenharmony_ci} 118735375f98Sopenharmony_ci 118835375f98Sopenharmony_civoid testEqualDoubleEachEqualInf(void) 118935375f98Sopenharmony_ci{ 119035375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 119135375f98Sopenharmony_ci TEST_IGNORE(); 119235375f98Sopenharmony_ci#else 119335375f98Sopenharmony_ci double p0[] = {1.0 / d_zero, 1.0 / d_zero, 25.4, 0.253}; 119435375f98Sopenharmony_ci 119535375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(1.0 / d_zero, p0, 2); 119635375f98Sopenharmony_ci#endif 119735375f98Sopenharmony_ci} 119835375f98Sopenharmony_ci 119935375f98Sopenharmony_civoid testNotEqualDoubleEachEqualLengthZero(void) 120035375f98Sopenharmony_ci{ 120135375f98Sopenharmony_ci#ifdef UNITY_EXCLUDE_DOUBLE 120235375f98Sopenharmony_ci TEST_IGNORE(); 120335375f98Sopenharmony_ci#else 120435375f98Sopenharmony_ci double p0[1] = {0.0}; 120535375f98Sopenharmony_ci 120635375f98Sopenharmony_ci EXPECT_ABORT_BEGIN 120735375f98Sopenharmony_ci TEST_ASSERT_EACH_EQUAL_DOUBLE(0.0, p0, 0); 120835375f98Sopenharmony_ci VERIFY_FAILS_END 120935375f98Sopenharmony_ci#endif 121035375f98Sopenharmony_ci} 121135375f98Sopenharmony_ci 121235375f98Sopenharmony_civoid testDoublePrinting(void) 121335375f98Sopenharmony_ci{ 121435375f98Sopenharmony_ci#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_EXCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY) 121535375f98Sopenharmony_ci TEST_IGNORE(); 121635375f98Sopenharmony_ci#else 121735375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("0", 0.0); 121835375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("4.99e-07", 0.000000499); 121935375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("5.0000005e-07", 0.00000050000005); 122035375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("0.100469499", 0.100469499); 122135375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("1", 0.9999999995); /*Rounding to int place*/ 122235375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("1", 1.0); 122335375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("1.25", 1.25); 122435375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("7.99999999", 7.99999999); /*Not rounding*/ 122535375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("16.0000002", 16.0000002); 122635375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("16.0000004", 16.0000004); 122735375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("16.0000006", 16.0000006); 122835375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("999999999", 999999999.0); /*Last full print integer*/ 122935375f98Sopenharmony_ci 123035375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("0", -0.0); /* -0 no supported on all targets */ 123135375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-4.99e-07", -0.000000499); 123235375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-5.0000005e-07", -0.00000050000005); 123335375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-0.100469499", -0.100469499); 123435375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-1", -0.9999999995); /*Rounding to int place*/ 123535375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-1", -1.0); 123635375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-1.25", -1.25); 123735375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-7.99999999", -7.99999999); /*Not rounding*/ 123835375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-16.0000002", -16.0000002); 123935375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-16.0000004", -16.0000004); 124035375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-16.0000006", -16.0000006); 124135375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-999999999", -999999999.0); /*Last full print integer*/ 124235375f98Sopenharmony_ci 124335375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("0.1004695", 0.10046949999999999); 124435375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("4.2949673e+09", 4294967295.9); 124535375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("4.2949673e+09", 4294967296.0); 124635375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("1e+10", 9999999995.0); 124735375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("9.00719925e+15", 9007199254740990.0); 124835375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("7e+100", 7.0e+100); 124935375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("3e+200", 3.0e+200); 125035375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("9.23456789e+300", 9.23456789e+300); 125135375f98Sopenharmony_ci 125235375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-0.1004695", -0.10046949999999999); 125335375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-4.2949673e+09", -4294967295.9); 125435375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-4.2949673e+09", -4294967296.0); 125535375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-7e+100", -7.0e+100); 125635375f98Sopenharmony_ci#endif 125735375f98Sopenharmony_ci} 125835375f98Sopenharmony_ci 125935375f98Sopenharmony_civoid testDoublePrintingRoundTiesToEven(void) 126035375f98Sopenharmony_ci{ 126135375f98Sopenharmony_ci#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_EXCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY) 126235375f98Sopenharmony_ci TEST_IGNORE(); 126335375f98Sopenharmony_ci#else 126435375f98Sopenharmony_ci #ifdef UNITY_ROUND_TIES_AWAY_FROM_ZERO 126535375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("1.00000001e+10", 10000000050.0); 126635375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("9.00719925e+15", 9007199245000000.0); 126735375f98Sopenharmony_ci #else /* Default to Round ties to even */ 126835375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("1e+10", 10000000050.0); 126935375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("9.00719924e+15", 9007199245000000.0); 127035375f98Sopenharmony_ci #endif 127135375f98Sopenharmony_ci#endif 127235375f98Sopenharmony_ci} 127335375f98Sopenharmony_ci 127435375f98Sopenharmony_civoid testDoublePrintingInfinityAndNaN(void) 127535375f98Sopenharmony_ci{ 127635375f98Sopenharmony_ci#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_EXCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY) 127735375f98Sopenharmony_ci TEST_IGNORE(); 127835375f98Sopenharmony_ci#else 127935375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("inf", 1.0 / d_zero); 128035375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("-inf", -1.0 / d_zero); 128135375f98Sopenharmony_ci 128235375f98Sopenharmony_ci TEST_ASSERT_EQUAL_PRINT_FLOATING("nan", 0.0 / d_zero); 128335375f98Sopenharmony_ci#endif 128435375f98Sopenharmony_ci} 1285