/usr/src/rpm/BUILD/libirobot-create-0.1/tests/common.hh File Reference

#include "irobot-create.hh"
#include <sstream>
#include "config.h"

Include dependency graph for common.hh:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define GENERATE_TEST()
#define CHECK_FAILURE(EXCEPTION, CMD)
#define CHECK_SENSOR_CHAR(PACKET, DATA, CONDITION)
#define CHECK_SENSOR_UCHAR(PACKET, DATA, CONDITION)   CHECK_SENSOR_CHAR (PACKET, DATA, CONDITION)


Define Documentation

#define CHECK_FAILURE ( EXCEPTION,
CMD   ) 

Value:

{                                             \
    bool failed = true;                         \
    try                                         \
      {                                         \
        CMD;                                    \
      }                                         \
    catch (EXCEPTION&)                          \
      {                                         \
        failed = false;                         \
      }                                         \
    catch (...)                                 \
      {}                                        \
    if (failed)                                 \
      return TEST_FAILED;                       \
  }

#define CHECK_SENSOR_CHAR ( PACKET,
DATA,
CONDITION   ) 

Value:

robot.sendSensorsCommand (PACKET);                    \
  stream.seekg (stream.tellp ());                       \
  stream.put (DATA);                                    \
  if (CONDITION)                                        \
    return TEST_FAILED

#define CHECK_SENSOR_UCHAR ( PACKET,
DATA,
CONDITION   )     CHECK_SENSOR_CHAR (PACKET, DATA, CONDITION)

 
#define GENERATE_TEST (  ) 

Value:

int                                                   \
  main (int argc, char** argv)                          \
  {                                                     \
    if (argc == 2                                       \
        && std::string (argv[1]) == "--version")        \
      {                                                 \
        std::cout << PACKAGE_STRING << std::endl;       \
        return 0;                                       \
      }                                                 \
                                                        \
    std::stringstream stream;                           \
    int status = 0;                                     \
    try                                                 \
      {                                                 \
        iRobot::Create robot (stream);                  \
        status = run_test (robot, stream);              \
      }                                                 \
    catch (std::runtime_error& e)                       \
      {                                                 \
        std::cerr << e.what () << std::endl;            \
        return 1;                                       \
      }                                                 \
    catch (...)                                         \
      {                                                 \
        std::cerr << "Unexpected error" << std::endl;   \
        return 2;                                       \
      }                                                 \
    std::cout << stream.str ();                         \
    return status;                                      \
  }


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