From 97758ee6e65d102b5d2784a5d7d6058d43b3fe10 Mon Sep 17 00:00:00 2001 From: Martijn Goorden Date: Wed, 29 Jun 2022 15:40:03 +0200 Subject: [PATCH 1/2] Correct spelling --- include/cdd/cdd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/cdd/cdd.h b/include/cdd/cdd.h index e80d6c9..e3eb29f 100644 --- a/include/cdd/cdd.h +++ b/include/cdd/cdd.h @@ -272,7 +272,7 @@ extern void cdd_ensure_running(); extern int32_t cdd_add_bddvar(int32_t n); /** - * Interprate the CDD as clock values, and remove any negative + * Interpret the CDD as clock values, and remove any negative * clock values. * @param the original cdd * @return a cdd that does not contain negative value From 31ce50506ed5710d402e11e2aba5d62455e70a85 Mon Sep 17 00:00:00 2001 From: Martijn Goorden Date: Wed, 29 Jun 2022 15:40:46 +0200 Subject: [PATCH 2/2] Add randomized negative bounds to test case --- test/test_cdd.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/test_cdd.cpp b/test/test_cdd.cpp index 8a5d5d3..cab5a8c 100644 --- a/test/test_cdd.cpp +++ b/test/test_cdd.cpp @@ -232,7 +232,11 @@ static void test_remove_negative(size_t size) auto dbm = dbm_wrap{size}; // We create a CDD where only some range of negative values for the second clock are allowed. - cdd1 = cdd_interval(1, 0, -8, -4); + int bound1 = RANGE(); + int bound2 = RANGE(); + int low = ((bound1 >= bound2) ? bound1 : bound2) * -1; + int up = ((bound1 >= bound2) ? bound2 : bound1) * -1; + cdd1 = cdd_interval(1, 0, low, up); // Extracting a dbm triggers assert(isValid(dbm)) internally in cdd_extract_dbm. // cdd2 = cdd_extract_dbm(cdd1, dbm.raw(), size); @@ -245,11 +249,12 @@ static void test_remove_negative(size_t size) cdd3 = cdd_extract_dbm(cdd2, dbm.raw(), size); // Additional test cases - cdd1 = cdd_interval(1, 0, -8, -4); + + cdd1 = cdd_interval(1, 0, low, up); cdd2 = cdd_remove_negative(cdd1); REQUIRE(cdd2 == cdd_false()); - cdd3 = cdd_lower(1, 0, -8); + cdd3 = cdd_lower(1, 0, low); cdd4 = cdd_remove_negative(cdd3); cdd5 = cdd_remove_negative(cdd_true()); REQUIRE(cdd4 == cdd5);