M_INC (resp. M_DEC) of M_UNDERFLOW (resp. M_OVERFLOW)

will keep the initial error.
This commit is contained in:
Patrick Pelissier committed 2022-09-16 18:46:13 +02:00
1 parent 10a759b09e
commit 3641829198
2 files changed
+5

No files matched your search

+2
View File
@@ -523,6 +523,7 @@ M_BEGIN_PROTECTED_CODE
#define M_INC_52 53
#define M_INC_53 M_OVERFLOW
#define M_INC_M_OVERFLOW M_OVERFLOW
#define M_INC_M_UNDERFLOW M_UNDERFLOW
/* Decrement the number given in argument (from [0..52[)
@@ -531,6 +532,7 @@ M_BEGIN_PROTECTED_CODE
*/
#define M_DEC(x) M_C(M_DEC_, x)
#define M_DEC_M_UNDERFLOW M_UNDERFLOW
#define M_DEC_M_OVERFLOW M_OVERFLOW
#define M_DEC_0 M_UNDERFLOW
#define M_DEC_1 0
#define M_DEC_2 1
+3
View File
@@ -156,6 +156,9 @@ static void test_incdec(void)
assert(!M_KEYWORD_P(M_OVERFLOW, M_ADD(M_MAX_NB_ARGUMENT, 1)));
assert(M_KEYWORD_P(M_OVERFLOW, M_ADD(M_MAX_NB_ARGUMENT, 2)));
assert(M_KEYWORD_P(M_OVERFLOW, M_ADD(M_MAX_NB_ARGUMENT, 3)));
// Test if the initial error is not lost in translation
assert(M_KEYWORD_P(M_UNDERFLOW, M_INC(M_UNDERFLOW)));
assert(M_KEYWORD_P(M_OVERFLOW, M_DEC(M_OVERFLOW)));
assert(M_AND(0, 0) == 0);
assert(M_AND(0, 1) == 0);