Started with gobotrpc autogenerated parser and ctest (not working)
This commit is contained in:
25
gobotrpc/out/cpp/.vscode/tasks.json
vendored
Normal file
25
gobotrpc/out/cpp/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cmake",
|
||||
"label": "CMake: build",
|
||||
"command": "build",
|
||||
"targets": [
|
||||
"all"
|
||||
],
|
||||
"group": "build",
|
||||
"problemMatcher": [],
|
||||
"detail": "CMake template build task",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": false,
|
||||
"panel": "dedicated",
|
||||
"showReuseMessage": true,
|
||||
"clear": true
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
20
gobotrpc/out/cpp/CMakeLists.txt
Normal file
20
gobotrpc/out/cpp/CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.28.3)
|
||||
project(TestingGobotRPCParser)
|
||||
|
||||
|
||||
# GoogleTest requires at least C++23
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Adding gtest
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
gcov
|
||||
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
|
||||
add_executable(TestingGobotRPCParser test/main.cpp)
|
||||
target_link_libraries(TestingGobotRPCParser gtest_main)
|
||||
0
gobotrpc/out/cpp/cov.info
Normal file
0
gobotrpc/out/cpp/cov.info
Normal file
11
gobotrpc/out/cpp/gobotrpc.cmake
Normal file
11
gobotrpc/out/cpp/gobotrpc.cmake
Normal file
@@ -0,0 +1,11 @@
|
||||
add_libary(gobotrpc STATIC)
|
||||
|
||||
target_sources(gobotrpc
|
||||
PRIVATE
|
||||
src/package_util.cpp
|
||||
)
|
||||
|
||||
target_include_directories(gobotrpc
|
||||
PUBLIC
|
||||
include
|
||||
)
|
||||
33
gobotrpc/out/cpp/include/enums.hpp
Normal file
33
gobotrpc/out/cpp/include/enums.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
/**
|
||||
* This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool
|
||||
*/
|
||||
|
||||
enum class GOBOTRPC_ENUM_NodeType {
|
||||
kHub = 0,
|
||||
kHead = 1,
|
||||
kCorexy = 2,
|
||||
kVacun = 3,
|
||||
};
|
||||
|
||||
enum class GOBOTRPC_ENUM_NodeStatus {
|
||||
kReady = 0,
|
||||
kWorking = 1,
|
||||
kBusy = 2,
|
||||
kError = 3,
|
||||
};
|
||||
|
||||
enum class GOBOTRPC_ENUM_ErrorCode {
|
||||
};
|
||||
|
||||
enum class GOBOTRPC_ENUM_HeadPos {
|
||||
kUp = 0,
|
||||
kDown = 1,
|
||||
};
|
||||
|
||||
enum class GOBOTRPC_ENUM_StoneStatus {
|
||||
kEmpty = 0,
|
||||
kLow = 1,
|
||||
kFill = 2,
|
||||
};
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#pragma once
|
||||
/**
|
||||
* This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool
|
||||
*/
|
||||
|
||||
enum class GOBOTRPC_ENUM_NodeType {
|
||||
GOBOTRPC_ENUM_kHub = 0,
|
||||
GOBOTRPC_ENUM_kHead = 1,
|
||||
GOBOTRPC_ENUM_kCorexy = 2,
|
||||
GOBOTRPC_ENUM_kVacun = 3,
|
||||
};
|
||||
|
||||
enum class GOBOTRPC_ENUM_NodeStatus {
|
||||
GOBOTRPC_ENUM_kReady = 0,
|
||||
GOBOTRPC_ENUM_kWorking = 1,
|
||||
GOBOTRPC_ENUM_kBusy = 2,
|
||||
GOBOTRPC_ENUM_kError = 3,
|
||||
};
|
||||
|
||||
enum class GOBOTRPC_ENUM_ErrorCode {
|
||||
};
|
||||
|
||||
enum class GOBOTRPC_ENUM_HeadPos {
|
||||
GOBOTRPC_ENUM_kUp = 0,
|
||||
GOBOTRPC_ENUM_kDown = 1,
|
||||
};
|
||||
|
||||
enum class GOBOTRPC_ENUM_StoneStatus {
|
||||
GOBOTRPC_ENUM_kEmpty = 0,
|
||||
GOBOTRPC_ENUM_kLow = 1,
|
||||
GOBOTRPC_ENUM_kFill = 2,
|
||||
};
|
||||
|
||||
127
gobotrpc/out/cpp/include/package_structs.hpp
Normal file
127
gobotrpc/out/cpp/include/package_structs.hpp
Normal file
@@ -0,0 +1,127 @@
|
||||
#pragma once
|
||||
/**
|
||||
* This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "enums.hpp"
|
||||
|
||||
enum GOBOTRPC_RPCNames {
|
||||
kInvalid = 255,
|
||||
kGetInfo = 1,
|
||||
kReset = 2,
|
||||
kResetInfo = 3,
|
||||
kStatusUpdate = 4,
|
||||
kError = 5,
|
||||
kHome = 7,
|
||||
kGoto = 9,
|
||||
kSetBoardCorner = 11,
|
||||
kSetVacumOffset = 13,
|
||||
kReleaseMotors = 15,
|
||||
kDrop = 17,
|
||||
kStoneStatus = 19,
|
||||
kMoveZAxis = 21,
|
||||
kSetVacum = 23,
|
||||
};
|
||||
|
||||
enum GOBOTRPC_RPCTypes {
|
||||
kReq = 0,
|
||||
kRes = 1,
|
||||
};
|
||||
|
||||
int getPackageSize(uint8_t data);
|
||||
|
||||
|
||||
struct GOBOTRPC_GetInfoReq {
|
||||
};
|
||||
|
||||
struct GOBOTRPC_GetInfoRes {
|
||||
int32_t addr : 32;
|
||||
GOBOTRPC_ENUM_NodeType type : 8;
|
||||
GOBOTRPC_ENUM_NodeStatus status : 8;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_ResetReq {
|
||||
};
|
||||
|
||||
struct GOBOTRPC_ResetInfoRes {
|
||||
GOBOTRPC_ENUM_NodeStatus status : 8;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_StatusUpdateRes {
|
||||
GOBOTRPC_ENUM_NodeStatus status : 8;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_ErrorRes {
|
||||
GOBOTRPC_ENUM_ErrorCode error : 8;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_HomeReq {
|
||||
};
|
||||
|
||||
struct GOBOTRPC_HomeRes {
|
||||
int32_t x : 32;
|
||||
int32_t y : 32;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_GotoReq {
|
||||
int8_t x : 8;
|
||||
int8_t y : 8;
|
||||
bool offset : 8;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_GotoRes {
|
||||
};
|
||||
|
||||
struct GOBOTRPC_SetBoardCornerReq {
|
||||
int32_t x1 : 32;
|
||||
int32_t y1 : 32;
|
||||
int32_t x2 : 32;
|
||||
int32_t y2 : 32;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_SetBoardCornerRes {
|
||||
};
|
||||
|
||||
struct GOBOTRPC_SetVacumOffsetReq {
|
||||
int32_t x : 32;
|
||||
int32_t y : 32;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_SetVacumOffsetRes {
|
||||
};
|
||||
|
||||
struct GOBOTRPC_ReleaseMotorsReq {
|
||||
bool enable : 8;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_ReleaseMotorsRes {
|
||||
};
|
||||
|
||||
struct GOBOTRPC_DropReq {
|
||||
};
|
||||
|
||||
struct GOBOTRPC_DropRes {
|
||||
GOBOTRPC_ENUM_StoneStatus status : 8;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_StoneStatusReq {
|
||||
};
|
||||
|
||||
struct GOBOTRPC_StoneStatusRes {
|
||||
GOBOTRPC_ENUM_StoneStatus status : 8;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_MoveZAxisReq {
|
||||
GOBOTRPC_ENUM_HeadPos pos : 8;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_MoveZAxisRes {
|
||||
};
|
||||
|
||||
struct GOBOTRPC_SetVacumReq {
|
||||
bool enable : 8;
|
||||
};
|
||||
|
||||
struct GOBOTRPC_SetVacumRes {
|
||||
};
|
||||
63
gobotrpc/out/cpp/src/package_util.cpp
Normal file
63
gobotrpc/out/cpp/src/package_util.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
/**
|
||||
* This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "package_structs.hpp"
|
||||
#include "enums.hpp"
|
||||
|
||||
int getPackageSize(uint8_t data) {
|
||||
switch(data) {
|
||||
case RPCNames::GOBOTRPC_GetInfoReq:
|
||||
return 0;
|
||||
case RPCNames::GOBOTRPC_GetInfoRes:
|
||||
return 6;
|
||||
case RPCNames::GOBOTRPC_ResetReq:
|
||||
return 0;
|
||||
case RPCNames::GOBOTRPC_ResetInfoRes:
|
||||
return 1;
|
||||
case RPCNames::GOBOTRPC_StatusUpdateRes:
|
||||
return 1;
|
||||
case RPCNames::GOBOTRPC_ErrorRes:
|
||||
return 1;
|
||||
case RPCNames::GOBOTRPC_HomeReq:
|
||||
return 0;
|
||||
case RPCNames::GOBOTRPC_HomeRes:
|
||||
return 8;
|
||||
case RPCNames::GOBOTRPC_GotoReq:
|
||||
return 3;
|
||||
case RPCNames::GOBOTRPC_GotoRes:
|
||||
return 0;
|
||||
case RPCNames::GOBOTRPC_SetBoardCornerReq:
|
||||
return 16;
|
||||
case RPCNames::GOBOTRPC_SetBoardCornerRes:
|
||||
return 0;
|
||||
case RPCNames::GOBOTRPC_SetVacumOffsetReq:
|
||||
return 8;
|
||||
case RPCNames::GOBOTRPC_SetVacumOffsetRes:
|
||||
return 0;
|
||||
case RPCNames::GOBOTRPC_ReleaseMotorsReq:
|
||||
return 1;
|
||||
case RPCNames::GOBOTRPC_ReleaseMotorsRes:
|
||||
return 0;
|
||||
case RPCNames::GOBOTRPC_DropReq:
|
||||
return 0;
|
||||
case RPCNames::GOBOTRPC_DropRes:
|
||||
return 1;
|
||||
case RPCNames::GOBOTRPC_StoneStatusReq:
|
||||
return 0;
|
||||
case RPCNames::GOBOTRPC_StoneStatusRes:
|
||||
return 1;
|
||||
case RPCNames::GOBOTRPC_MoveZAxisReq:
|
||||
return 1;
|
||||
case RPCNames::GOBOTRPC_MoveZAxisRes:
|
||||
return 0;
|
||||
case RPCNames::GOBOTRPC_SetVacumReq:
|
||||
return 1;
|
||||
case RPCNames::GOBOTRPC_SetVacumRes:
|
||||
return 0;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
14
gobotrpc/out/cpp/test/main.cpp
Normal file
14
gobotrpc/out/cpp/test/main.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(DummyTest, BasicAssertions) {
|
||||
// Expect two strings not to be equal.
|
||||
EXPECT_STRNE("hello", "world");
|
||||
// Expect equality.
|
||||
EXPECT_EQ(7 * 6, 42);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
Reference in New Issue
Block a user