⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_mcom.cc

📁 机器人仿真平台,和stage配合运行
💻 CC
字号:
/* * $Id: test_mcom.cc,v 1.2.2.2 2003/05/23 21:23:44 gerkey Exp $ * * a test for the C++ MComProxy */#include "playerclient.h"#include "test.h"#include <unistd.h>#include <math.h>inttest_mcom(PlayerClient* client, int index){  unsigned char access;  MComProxy mcom(client,index,'c');  printf("device [mcom] index [%d]\n", index);  TEST("subscribing (read)");  if((mcom.ChangeAccess(PLAYER_READ_MODE,&access) < 0) ||     (access != PLAYER_READ_MODE))  {    FAIL();    printf("DRIVER: %s\n", mcom.driver_name);    return -1;  }  PASS();  printf("DRIVER: %s\n", mcom.driver_name);  TEST("push");  char data[MCOM_DATA_LEN];  memset(data, 0, MCOM_DATA_LEN);  strcpy(data, "what hath god wrought?");  if(mcom.Push(1, "test", data) == 0)    PASS();  else  {    FAIL();    return(-1);  }  TEST("read");  if(mcom.Read(1, "test") == 0)   {    printf("read test string from mcom: \"%s\"\n", mcom.LastData());    PASS();  }  else  {    FAIL();    return(-1);  }  TEST("pop");  if(mcom.Pop(1, "test") == 0) {      printf("popped test string from mcom: \"%s\"\n", mcom.LastData());      PASS();  } else {      FAIL();  }  TEST("unsubscribing");  if((mcom.ChangeAccess(PLAYER_CLOSE_MODE,&access) < 0) ||     (access != PLAYER_CLOSE_MODE))  {    FAIL();    return -1;  }  PASS();  return(0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -