summaryrefslogtreecommitdiff
path: root/i/marvin
diff options
context:
space:
mode:
authordufourj2006-05-25 01:27:52 +0000
committerdufourj2006-05-25 01:27:52 +0000
commit016484d07ca7c6516bb47464756b85bf664fc856 (patch)
tree82b8e937056335784fbd61110b5ebd298d4036c8 /i/marvin
parentecc3c0a1f65123a164ee2afeb755a09afa4097c9 (diff)
Ai :
- correction dans la classe de test (postcall et wait).
Diffstat (limited to 'i/marvin')
-rw-r--r--i/marvin/src/ai/test_ai.cc24
1 files changed, 20 insertions, 4 deletions
diff --git a/i/marvin/src/ai/test_ai.cc b/i/marvin/src/ai/test_ai.cc
index 6635ce2..27d32a1 100644
--- a/i/marvin/src/ai/test_ai.cc
+++ b/i/marvin/src/ai/test_ai.cc
@@ -25,18 +25,32 @@
#include "tester/tester.hh"
#include "ai/ai.hh"
+#include "timer/timer.hh"
-class TestAI : public Tester
+class TestAi : public Tester
{
private:
Ai ai_;
/// Called after each command
void postcall (void)
{
- // Update ?
+ while (!ai_.update ())
+ ;
+ }
+ /// Wait.
+ void wait (int ms)
+ {
+ int t, stop;
+ t = Timer::getProgramTime ();
+ stop = t + ms;
+ while (t < stop)
+ {
+ ai_.temporisation (stop - t);
+ t = Timer::getProgramTime ();
+ }
}
public:
- TestAI(int argc, char ** argv)
+ TestAi(int argc, char ** argv)
:Tester(argc, argv), ai_(config_)
{}
void preRun (void)
@@ -60,6 +74,8 @@ class TestAI : public Tester
interpreter.add("homologation", Interpreter::memFunc(ai_,
&Ai::progHomoloRobal),
"Programme d'homologation du robal");
+ interpreter.add ("_postcall",
+ Interpreter::memFunc (*this, &TestAi::postcall));
}
void postRun(void)
{
@@ -72,7 +88,7 @@ int main (int argc, char **argv)
{
try
{
- TestAI ta(argc, argv);
+ TestAi ta(argc, argv);
ta.run ();
}
catch (const std::exception &e)