Skip to content

Commit

Permalink
Add unit tests for 'bdd_optmin'
Browse files Browse the repository at this point in the history
  • Loading branch information
SSoelvsten committed Feb 13, 2024
1 parent 07e9754 commit facd409
Show file tree
Hide file tree
Showing 6 changed files with 714 additions and 40 deletions.
3 changes: 3 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ test/adiar/bdd/evaluate:
test/adiar/bdd/if_then_else:
$(MAKE) $(MAKE_FLAGS) test TEST_FOLDER=test/adiar/bdd TEST_NAME=if_then_else

test/adiar/bdd/optmin:
$(MAKE) $(MAKE_FLAGS) test TEST_FOLDER=test/adiar/bdd TEST_NAME=optmin

test/adiar/bdd/pred:
$(MAKE) $(MAKE_FLAGS) test TEST_FOLDER=test/adiar/bdd TEST_NAME=pred

Expand Down
2 changes: 1 addition & 1 deletion src/adiar/bdd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ namespace adiar
///
/// \param c A (pure) function that provides the cost function's coefficient.
///
/// \param cb A callback function that is called in \em descending order.
/// \param cb A callback function that is called in \em descending order.
///
/// \returns The cost of the satisfying solution if any, otherwise NaN.
///
Expand Down
1 change: 0 additions & 1 deletion src/adiar/internal/algorithms/optmin.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ namespace adiar::internal
{
if (dd_istrue(dd)) { return 0.0; }
if (dd_isfalse(dd)) { return NAN; }
// adiar_assert(!dd_isterminal(dd), "Count algorithm does not work on terminal-only edge case");

// Compute amount of memory available for auxiliary data structures after
// having opened all streams.
Expand Down
1 change: 1 addition & 0 deletions test/adiar/bdd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ add_test(adiar-bdd-build test_build.cpp)
add_test(adiar-bdd-count test_count.cpp)
add_test(adiar-bdd-evaluate test_evaluate.cpp)
add_test(adiar-bdd-if_then_else test_if_then_else.cpp)
add_test(adiar-bdd-optmin test_optmin.cpp)
add_test(adiar-bdd-pred test_pred.cpp)
add_test(adiar-bdd-negate test_negate.cpp)
add_test(adiar-bdd-quantify test_quantify.cpp)
Expand Down
76 changes: 38 additions & 38 deletions test/adiar/bdd/test_count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ go_bandit([]() {

shared_levelized_file<bdd::node_type> bdd_1;
/*
1 ---- x0
/ \
| 2 ---- x1
|/ \
3 | ---- x2
/ \ /
F 4 ---- x3
/ \
F T
// 1 ---- x0
// / \
// | 2 ---- x1
// |/ \
// 3 | ---- x2
// / \ /
// F 4 ---- x3
// / \
// F T
*/

{ // Garbage collect writer to free write-lock
Expand All @@ -30,13 +30,13 @@ go_bandit([]() {

shared_levelized_file<bdd::node_type> bdd_2;
/*
---- x0
1 ---- x1
/ \
2 | ---- x2
/ \ /
F T
// ---- x0
//
// 1 ---- x1
// / \
// 2 | ---- x2
// / \ /
// F T
*/

{ // Garbage collect writer to free write-lock
Expand All @@ -49,13 +49,13 @@ go_bandit([]() {

shared_levelized_file<bdd::node_type> bdd_3;
/*
---- x0
1 ---- x1
/ \
2 3 ---- x2
/ \/ \
F T F
// ---- x0
//
// 1 ---- x1
// / \
// 2 3 ---- x2
// / \/ \
// F T F
*/

{ // Garbage collect writer to free write-lock
Expand All @@ -69,16 +69,16 @@ go_bandit([]() {

shared_levelized_file<bdd::node_type> bdd_4;
/*
__1__ ---- x0
/ \
_2_ _3_ ---- x2
/ \ / \
\ 4 / ---- x4
\ / \ /
\/ \/
5 6 ---- x6
/ \ / \
T F F T
// __1__ ---- x0
// / \
// _2_ _3_ ---- x2
// / \ / \
// \ 4 / ---- x4
// \ / \ /
// \/ \/
// 5 6 ---- x6
// / \ / \
// T F F T
*/

{ // Garbage collect writer to free write-lock
Expand All @@ -95,7 +95,7 @@ go_bandit([]() {

shared_levelized_file<bdd::node_type> bdd_T;
/*
T
// T
*/

{ // Garbage collect writer to free write-lock
Expand All @@ -105,7 +105,7 @@ go_bandit([]() {

shared_levelized_file<bdd::node_type> bdd_F;
/*
F
// F
*/

{ // Garbage collect writer to free write-lock
Expand All @@ -115,9 +115,9 @@ go_bandit([]() {

shared_levelized_file<bdd::node_type> bdd_root_1;
/*
1 ---- x1
/ \
F T
// 1 ---- x1
// / \
// F T
*/

{ // Garbage collect writer to free write-lock
Expand Down
Loading

0 comments on commit facd409

Please sign in to comment.