File tree Expand file tree Collapse file tree 3 files changed +7
-35
lines changed Expand file tree Collapse file tree 3 files changed +7
-35
lines changed Original file line number Diff line number Diff line change @@ -54,12 +54,17 @@ void Test_CF_CFDP_GetValueEncodedSize(void)
54
54
UtAssert_UINT32_EQ (CF_CFDP_GetValueEncodedSize (16777216 ), 4 );
55
55
UtAssert_UINT32_EQ (CF_CFDP_GetValueEncodedSize (UINT32_MAX ), 4 );
56
56
57
+ #ifdef UINT64_C
57
58
/*
58
59
* This next case uses UINT64_C macro to force promotion so the +1 is done as 64-bit,
59
- * otherwise the UINT32_MAX is a 32-bit value and +1 results in 0.
60
+ * otherwise the UINT32_MAX is a 32-bit value and +1 results in 0. Not all systems have
61
+ * UINT64_C so these will be skipped in that case.
60
62
*/
61
63
UtAssert_UINT32_EQ (CF_CFDP_GetValueEncodedSize (UINT32_MAX + UINT64_C (1 )), 5 );
64
+ #endif
65
+ #ifdef UINT64_MAX
62
66
UtAssert_UINT32_EQ (CF_CFDP_GetValueEncodedSize (UINT64_MAX ), 8 );
67
+ #endif
63
68
}
64
69
65
70
void Test_CF_EncodeIntegerInSize (void )
@@ -1305,4 +1310,4 @@ void UtTest_Setup(void)
1305
1310
1306
1311
Add_CF_Encode_tests ();
1307
1312
Add_CF_Decode_tests ();
1308
- }
1313
+ }
Original file line number Diff line number Diff line change @@ -448,38 +448,6 @@ int Any_int_Except(int exception)
448
448
return random_val ;
449
449
}
450
450
451
- int Any_int_GreaterThan (int floor ) /* NOTE: INTMAX_MAX will fail, and is invalid value */
452
- {
453
- int random_val ;
454
- bool coin_toss ;
455
-
456
- if (floor > 0 )
457
- {
458
- random_val = (int )(rand () % (INTMAX_MAX - floor - 1 )); /* -1 for greater than */
459
-
460
- random_val += floor + 1 ;
461
- }
462
- else
463
- {
464
- coin_toss = rand () % 2 ;
465
-
466
- if (coin_toss == HEADS )
467
- {
468
- random_val = (int )(rand () % (- floor )); /* floor is negative, -floor inverts to positive */
469
- /* 0 to INTMAX_MAX becomes -1 to INTMAX_MIN */
470
- random_val *= -1 ; /* flip sign */
471
- random_val += -1 ; /* subtract 1, 0 becomes -1 */
472
- }
473
- else
474
- {
475
- random_val = (int )(rand () % (INTMAX_MAX )); /* floor is negative, random will be positive so any positive (or
476
- zero) will work */
477
- }
478
- }
479
-
480
- return random_val ;
481
- }
482
-
483
451
int Any_int_Negative (void )
484
452
{
485
453
return ((rand () % MAX_INT ) * -1 ) - 1 ; /* *-1 flips sign, -1 for 0 and MIN_INT */
Original file line number Diff line number Diff line change @@ -261,7 +261,6 @@ uint64 Any_uint64_Except(uint64 exception);
261
261
unsigned int Any_unsigned_int (void );
262
262
int Any_int (void );
263
263
int Any_int_Except (int exception );
264
- int Any_int_GreaterThan (int floor );
265
264
int Any_int_Negative (void );
266
265
int Any_int_Positive (void );
267
266
int Any_int_PositiveExcept (int exception );
You can’t perform that action at this time.
0 commit comments