[buddy] execute some of the tests during "make check"
* examples/bddtest/Makefile.am, src/Makefile.am (TESTS): Add this variable. * examples/bddtest/bddtest.cxx: Return non-zero on error.
This commit is contained in:
parent
f99ddef787
commit
5a9c8aad0d
3 changed files with 20 additions and 6 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
include ../Makefile.def
|
include ../Makefile.def
|
||||||
|
TESTS = bddtest$(EXEEXT)
|
||||||
check_PROGRAMS = bddtest
|
check_PROGRAMS = bddtest
|
||||||
bddtest_SOURCES = bddtest.cxx
|
bddtest_SOURCES = bddtest.cxx
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include <bddx.h>
|
#include <bddx.h>
|
||||||
|
|
||||||
static const int varnum = 5;
|
static const int varnum = 5;
|
||||||
|
static int err = 0;
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Example of allsat print handler.
|
Example of allsat print handler.
|
||||||
|
|
@ -47,6 +48,7 @@ void test1_check(bdd x)
|
||||||
{
|
{
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
double anum = bdd_satcount(x);
|
double anum = bdd_satcount(x);
|
||||||
|
bool error = false;
|
||||||
|
|
||||||
cout << "Checking bdd with " << setw(4) << anum << " assignments: ";
|
cout << "Checking bdd with " << setw(4) << anum << " assignments: ";
|
||||||
|
|
||||||
|
|
@ -59,15 +61,25 @@ void test1_check(bdd x)
|
||||||
|
|
||||||
// Now the summed set should be equal to the original set
|
// Now the summed set should be equal to the original set
|
||||||
if (allsatSumBDD == x)
|
if (allsatSumBDD == x)
|
||||||
cout << " Sum-OK. ";
|
{
|
||||||
|
cout << " Sum-OK. ";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cout << " Sum-ERROR. ";
|
{
|
||||||
|
cout << " Sum-ERROR. ";
|
||||||
|
err = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// The subtracted set should be empty
|
// The subtracted set should be empty
|
||||||
if (allsatBDD == bddfalse)
|
if (allsatBDD == bddfalse)
|
||||||
cout << "Sub-OK.\n";
|
{
|
||||||
|
cout << "Sub-OK.\n";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cout << "Sub-ERROR.\n";
|
{
|
||||||
|
cout << "Sub-ERROR.\n";
|
||||||
|
err = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -141,5 +153,5 @@ int main()
|
||||||
|
|
||||||
bdd_done();
|
bdd_done();
|
||||||
|
|
||||||
return 0;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ libbddx_la_SOURCES = \
|
||||||
reorder.c \
|
reorder.c \
|
||||||
tree.c
|
tree.c
|
||||||
|
|
||||||
|
TESTS = bddtest$(EXEEXT)
|
||||||
check_PROGRAMS = bddtest
|
check_PROGRAMS = bddtest
|
||||||
bddtest_SOURCES = bddtest.cxx
|
bddtest_SOURCES = bddtest.cxx
|
||||||
bddtest_CPPFLAGS = -I$(top_builddir)
|
bddtest_CPPFLAGS = -I$(top_builddir)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue