Implement sba_explicit class, add tests
* src/tgba/tgbaexplicit.hh: Add sba_explicit implementation * src/tgbatest/explicit2.cc: Add test to check the good instantiation of sba_explicit_*
This commit is contained in:
parent
603c5d603b
commit
eec3a12f80
2 changed files with 165 additions and 37 deletions
|
|
@ -104,6 +104,78 @@ create_tgba_explicit_formula(bdd_dict* d, spot::ltl::default_environment& e)
|
|||
delete tgba;
|
||||
}
|
||||
|
||||
void create_sba_explicit_string(bdd_dict* d)
|
||||
{
|
||||
sba_explicit<state_explicit_string>* sba =
|
||||
new sba_explicit<state_explicit_string>(d);
|
||||
|
||||
state_explicit_string* s1 = sba->add_state("STATE1");
|
||||
state_explicit_string* s2 = sba->add_state("STATE2");
|
||||
state_explicit_string* s3 = sba->add_state("STATE3");
|
||||
|
||||
int v = d->register_acceptance_variable(ltl::constant::true_instance(), sba);
|
||||
|
||||
state_explicit_string::transition* t =
|
||||
sba->create_transition(s1, s2);
|
||||
|
||||
t = sba->create_transition(s1, s3);
|
||||
sba->add_acceptance_conditions(t, bdd_ithvar(v));
|
||||
|
||||
std::cout << "S1 ACCEPTING? " << sba->is_accepting (s1) << std::endl;
|
||||
std::cout << "S2 ACCEPTING? " << sba->is_accepting (s2) << std::endl;
|
||||
std::cout << "S3 ACCEPTING? " << sba->is_accepting (s3) << std::endl;
|
||||
|
||||
delete sba;
|
||||
}
|
||||
|
||||
void create_sba_explicit_number(bdd_dict* d)
|
||||
{
|
||||
sba_explicit<state_explicit_number>* sba =
|
||||
new sba_explicit<state_explicit_number>(d);
|
||||
|
||||
state_explicit_number* s1 = sba->add_state(1);
|
||||
state_explicit_number* s2 = sba->add_state(2);
|
||||
|
||||
//state 1 is accepting
|
||||
int v = d->register_acceptance_variable(ltl::constant::true_instance(), sba);
|
||||
|
||||
state_explicit_number::transition* t =
|
||||
sba->create_transition(s1, s2);
|
||||
sba->add_acceptance_conditions(t, bdd_ithvar(v));
|
||||
|
||||
std::cout << "S1 ACCEPTING? " << sba->is_accepting (s1) << std::endl;
|
||||
std::cout << "S2 ACCEPTING? " << sba->is_accepting (s2) << std::endl;
|
||||
|
||||
delete sba;
|
||||
}
|
||||
|
||||
void
|
||||
create_sba_explicit_formula(bdd_dict* d, spot::ltl::default_environment& e)
|
||||
{
|
||||
sba_explicit<state_explicit_formula>* sba =
|
||||
new sba_explicit<state_explicit_formula>(d);
|
||||
|
||||
state_explicit_formula* s1 = sba->add_state(e.require("a"));
|
||||
state_explicit_formula* s2 = sba->add_state(e.require("b"));
|
||||
state_explicit_formula* s3 = sba->add_state(e.require("c"));
|
||||
|
||||
int v = d->register_acceptance_variable(ltl::constant::true_instance(), sba);
|
||||
|
||||
state_explicit_formula::transition* t =
|
||||
sba->create_transition(s1, s2);
|
||||
|
||||
sba->add_acceptance_conditions(t, bdd_ithvar(v));
|
||||
|
||||
t = sba->create_transition(s1, s3);
|
||||
sba->add_acceptance_conditions(t, bdd_ithvar(v));
|
||||
|
||||
std::cout << "S1 ACCEPTING? " << sba->is_accepting (s1) << std::endl;
|
||||
std::cout << "S2 ACCEPTING? " << sba->is_accepting (s2) << std::endl;
|
||||
std::cout << "S3 ACCEPTING? " << sba->is_accepting (s3) << std::endl;
|
||||
|
||||
delete sba;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
|
|
@ -114,10 +186,22 @@ main(int argc, char** argv)
|
|||
spot::ltl::default_environment& e =
|
||||
spot::ltl::default_environment::instance();
|
||||
|
||||
//check tgba creation
|
||||
std::cout << "* TGBA explicit string" << std::endl;
|
||||
create_tgba_explicit_string(d);
|
||||
std::cout << "* TGBA explicit number" << std::endl;
|
||||
create_tgba_explicit_number(d);
|
||||
std::cout << "* TGBA explicit formula" << std::endl;
|
||||
create_tgba_explicit_formula(d, e);
|
||||
|
||||
//check sba creation
|
||||
std::cout << "* SBA explicit string, no accepting state" << std::endl;
|
||||
create_sba_explicit_string(d);
|
||||
std::cout << "* SBA explicit number, 1 accepting state" << std::endl;
|
||||
create_sba_explicit_number(d);
|
||||
std::cout << "* SBA explicit formula, 1 accepting state" << std::endl;
|
||||
create_sba_explicit_formula(d, e);
|
||||
|
||||
delete d;
|
||||
assert(spot::ltl::atomic_prop::instance_count() == 0);
|
||||
assert(spot::ltl::unop::instance_count() == 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue