Files
behavior-tree/core/tests/dispatch_audit_test.cpp
T

12 lines
879 B
C++
Raw Normal View History

#include "workflow_fixture.hpp"
#include <fstream>
int main(){
Simulator driver;const auto path=Fixture::test_root()+"/dispatch-audit.journal";
ActiveGoalRegistry registry(driver,path);GoalRequest q;q.robot_id="robot";q.trace={"task","pick","run",1,1,1,1};q.skill=Skill::PICK;
bool observed=false;
registry.set_dispatch_recorder([&](const GoalRequest& request){std::ifstream durable(path);std::string line;std::getline(durable,line);assert(line.find(request.goal_id)!=std::string::npos);assert(driver.sent.empty());observed=true;throw std::runtime_error("task audit journal unavailable");});
auto id=registry.start(q,SteadyTime{});assert(id);assert(observed);assert(driver.sent.empty());assert(registry.robot_locked("robot"));
q.trace.attempt=2;assert(!registry.start(q,SteadyTime{}));
std::cout<<"dispatch manifest audit failure prevents transport and retains lock\n";
}