aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2021-07-19 16:22:39 +0200
committerGitHub <noreply@github.com>2021-07-19 16:22:39 +0200
commit57b8969a3d30cfdefe54fc46f4d5552d76bd1b82 (patch)
treeb29bd40c708c0428a1ccb4cd980e9c0fe6f4391d /example
parent0adcd28450d026c9dc090468c115be2687f08ba0 (diff)
Fix setting of flow risks on 32 bit machines (#1251)
Since 19a29e1e (NDPI_TLS_CERT_VALIDITY_TOO_LONG is 32), unit tests are failing on 32 bit machines (i.e Raspberry 4)
Diffstat (limited to 'example')
-rw-r--r--example/ndpiReader.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index ef74a5a99..99b24874b 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -3724,7 +3724,9 @@ static void hllUnitTest() {
static void bitmapUnitTest() {
u_int32_t val, i, j;
+ u_int64_t val64;
+ /* With a 32 bit integer */
for(i=0; i<32; i++) {
NDPI_ZERO_BIT(val);
NDPI_SET_BIT(val, i);
@@ -3737,6 +3739,20 @@ static void bitmapUnitTest() {
}
}
}
+
+ /* With a 64 bit integer */
+ for(i=0; i<64; i++) {
+ NDPI_ZERO_BIT(val64);
+ NDPI_SET_BIT(val64, i);
+
+ assert(NDPI_ISSET_BIT(val64, i));
+
+ for(j=0; j<64; j++) {
+ if(j != i) {
+ assert(!NDPI_ISSET_BIT(val64, j));
+ }
+ }
+ }
}
/* *********************************************** */