-----------------------------------------------*/
| 1084 | |
| 1085 | /*-----------------------------------------------*/ |
| 1086 | void UnityAssertFloatSpecial(const UNITY_FLOAT actual, |
| 1087 | const char* msg, |
| 1088 | const UNITY_LINE_TYPE lineNumber, |
| 1089 | const UNITY_FLOAT_TRAIT_T style) |
| 1090 | { |
| 1091 | const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet}; |
| 1092 | UNITY_INT should_be_trait = ((UNITY_INT)style & 1); |
| 1093 | UNITY_INT is_trait = !should_be_trait; |
| 1094 | UNITY_INT trait_index = (UNITY_INT)(style >> 1); |
| 1095 | |
| 1096 | RETURN_IF_FAIL_OR_IGNORE; |
| 1097 | |
| 1098 | switch (style) |
| 1099 | { |
| 1100 | case UNITY_FLOAT_IS_INF: |
| 1101 | case UNITY_FLOAT_IS_NOT_INF: |
| 1102 | is_trait = UNITY_IS_INF(actual) && (actual > 0); |
| 1103 | break; |
| 1104 | case UNITY_FLOAT_IS_NEG_INF: |
| 1105 | case UNITY_FLOAT_IS_NOT_NEG_INF: |
| 1106 | is_trait = UNITY_IS_INF(actual) && (actual < 0); |
| 1107 | break; |
| 1108 | |
| 1109 | case UNITY_FLOAT_IS_NAN: |
| 1110 | case UNITY_FLOAT_IS_NOT_NAN: |
| 1111 | is_trait = UNITY_IS_NAN(actual) ? 1 : 0; |
| 1112 | break; |
| 1113 | |
| 1114 | case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */ |
| 1115 | case UNITY_FLOAT_IS_NOT_DET: |
| 1116 | is_trait = !UNITY_IS_INF(actual) && !UNITY_IS_NAN(actual); |
| 1117 | break; |
| 1118 | |
| 1119 | case UNITY_FLOAT_INVALID_TRAIT: /* Supress warning */ |
| 1120 | default: /* including UNITY_FLOAT_INVALID_TRAIT */ |
| 1121 | trait_index = 0; |
| 1122 | trait_names[0] = UnityStrInvalidFloatTrait; |
| 1123 | break; |
| 1124 | } |
| 1125 | |
| 1126 | if (is_trait != should_be_trait) |
| 1127 | { |
| 1128 | UnityTestResultsFailBegin(lineNumber); |
| 1129 | UnityPrint(UnityStrExpected); |
| 1130 | if (!should_be_trait) |
| 1131 | { |
| 1132 | UnityPrint(UnityStrNot); |
| 1133 | } |
| 1134 | UnityPrint(trait_names[trait_index]); |
| 1135 | UnityPrint(UnityStrWas); |
| 1136 | #ifndef UNITY_EXCLUDE_FLOAT_PRINT |
| 1137 | UnityPrintFloat((UNITY_DOUBLE)actual); |
| 1138 | #else |
| 1139 | if (should_be_trait) |
| 1140 | { |
| 1141 | UnityPrint(UnityStrNot); |
| 1142 | } |
| 1143 | UnityPrint(trait_names[trait_index]); |
nothing calls this directly
no test coverage detected