/usr/src/rpm/BUILD/libirobot-create-0.1/tests/script-test.cc File Reference

#include "common.hh"

Include dependency graph for script-test.cc:


Functions

int run_test (iRobot::Create &robot, std::stringstream &)

Function Documentation

int run_test ( iRobot::Create robot,
std::stringstream &   
)

00022 {
00023   using namespace iRobot;
00024 
00025   Create::opcodes_t script;
00026 
00027   // Send some valid commands.
00028   script.push_back (Create::OPCODE_START);
00029   script.push_back (Create::OPCODE_WAIT_EVENT);
00030   robot.sendScriptCommand (script);
00031 
00032   // Check too long script.
00033   while (script.size () <= Create::SCRIPT_MAX_SIZE)
00034     script.push_back (Create::OPCODE_START);
00035   CHECK_FAILURE
00036     (InvalidArgument,
00037      robot.sendScriptCommand (script));
00038   script.clear ();
00039 
00040   // Check min opcode - 1.
00041   Create::Opcode min = static_cast<Create::Opcode> (Create::OPCODE_START - 1);
00042   script.push_back (min);
00043   CHECK_FAILURE
00044     (InvalidArgument,
00045      robot.sendScriptCommand (script));
00046   script.clear ();
00047 
00048   // Check max opcode + 1
00049   Create::Opcode max = static_cast<Create::Opcode>
00050     (Create::OPCODE_WAIT_EVENT + 1);
00051   script.push_back (max);
00052   CHECK_FAILURE
00053     (InvalidArgument,
00054      robot.sendScriptCommand (script));
00055 
00056   return TEST_SUCCEED;
00057 }


Generated on Thu Aug 28 14:38:09 2008 for iRobot Create library by  doxygen 1.5.4