@@ -291,7 +291,7 @@ struct NodeBox {
291291 std::unique_ptr<Node> node;
292292 NodeBox *parent;
293293
294- std::monostate fillIfElseNode (SymVal cond, int id );
294+ std::monostate fillIfElseNode (SymVal cond);
295295 std::monostate fillFinishedNode ();
296296 std::monostate fillFailedNode ();
297297 std::monostate fillUnreachableNode ();
@@ -344,11 +344,10 @@ struct IfElseNode : Node {
344344 SymVal cond;
345345 std::unique_ptr<NodeBox> true_branch;
346346 std::unique_ptr<NodeBox> false_branch;
347- int id;
348347
349- IfElseNode (SymVal cond, NodeBox *parent, int id )
348+ IfElseNode (SymVal cond, NodeBox *parent)
350349 : cond(cond), true_branch(std::make_unique<NodeBox>(parent)),
351- false_branch (std::make_unique<NodeBox>(parent)), id(id) {}
350+ false_branch (std::make_unique<NodeBox>(parent)) {}
352351
353352 std::string to_string () override {
354353 std::string result = " IfElseNode {\n " ;
@@ -481,10 +480,10 @@ inline NodeBox::NodeBox(NodeBox *parent)
481480 /* TODO: avoid allocation of unexplored node */
482481 parent(parent) {}
483482
484- inline std::monostate NodeBox::fillIfElseNode (SymVal cond, int id ) {
483+ inline std::monostate NodeBox::fillIfElseNode (SymVal cond) {
485484 // fill the current NodeBox with an ifelse branch node when it's unexplored
486485 if (this ->isUnexplored ()) {
487- node = std::make_unique<IfElseNode>(cond, this , id );
486+ node = std::make_unique<IfElseNode>(cond, this );
488487 }
489488 assert (
490489 dynamic_cast <IfElseNode *>(node.get ()) != nullptr &&
@@ -583,7 +582,8 @@ class ExploreTree_t {
583582 std::monostate fillFailedNode () { return cursor->fillFailedNode (); }
584583
585584 std::monostate fillIfElseNode (SymVal cond, int id) {
586- return cursor->fillIfElseNode (cond, id);
585+ branch_cov_map[id] = true ;
586+ return cursor->fillIfElseNode (cond);
587587 }
588588
589589 std::monostate moveCursor (bool branch, Snapshot_t snapshot) {
@@ -637,6 +637,14 @@ class ExploreTree_t {
637637 // For now, we just iterate through the tree and return the first unexplored
638638 return pick_unexplored_of (root.get ());
639639 }
640+ std::vector<bool > branch_cov_map;
641+ bool all_branch_covered () const {
642+ for (bool covered : branch_cov_map) {
643+ if (!covered)
644+ return false ;
645+ }
646+ return true ;
647+ }
640648
641649private:
642650 NodeBox *pick_unexplored_of (NodeBox *node) {
0 commit comments