Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/cdd/cdd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions test/test_cdd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down