*/
class PSPlanner {
private:
- BicycleCar *cc_ = nullptr;
- BicycleCar *gc_ = new BicycleCar();
- ParkingSlot *ps_ = new ParkingSlot();
+ BicycleCar cc_;
+ BicycleCar gc_;
+ ParkingSlot ps_;
public:
// find entry
/*! \brief Find entry to the parking slot.
void fer();
// getters, setters
- BicycleCar *cc() { return this->cc_; }
- BicycleCar *gc() { return this->gc_; }
- ParkingSlot *ps() { return this->ps_; }
+ BicycleCar &cc() { return this->cc_; }
+ BicycleCar &gc() { return this->gc_; }
+ ParkingSlot &ps() { return this->ps_; }
PSPlanner();
};
WVTEST_MAIN("parking slot planner basic test")
{
- PSPlanner *psp = new PSPlanner();
- psp->ps()->border(3, 3, 5, 3, 5, 8, 3, 8);
- psp->gc()->x(4);
- psp->gc()->y(4);
- psp->gc()->h(M_PI / 2);
- psp->gc()->mtr(10);
- psp->gc()->wb(2);
- psp->gc()->w(1);
- psp->gc()->l(3);
- psp->gc()->he(1.5);
- psp->gc()->df(2 + 0.5);
- psp->gc()->dr(0.5);
+ PSPlanner psp;
+ psp.ps().border(3, 3, 5, 3, 5, 8, 3, 8);
+ psp.gc().x(4);
+ psp.gc().y(4);
+ psp.gc().h(M_PI / 2);
+ psp.gc().mtr(10);
+ psp.gc().wb(2);
+ psp.gc().w(1);
+ psp.gc().l(3);
+ psp.gc().he(1.5);
+ psp.gc().df(2 + 0.5);
+ psp.gc().dr(0.5);
// init orientation
- WVPASS(psp->gc() != nullptr);
- WVPASSEQ_DOUBLE(psp->ps()->heading(), psp->gc()->h(), 0.00001);
+ WVPASSEQ_DOUBLE(psp.ps().heading(), psp.gc().h(), 0.00001);
}