修复了测试框架编译缺少头文件的问题

添加了测试示例
This commit is contained in:
2022-05-08 11:48:04 +08:00
parent 42df13da84
commit 82f5b2292b
6 changed files with 35 additions and 5 deletions

View File

@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.0)
project(bus_test)
set(CMAKE_CXX_STANDARD 11)
add_subdirectory(./GTest)
include_directories(GTest/googletest/include)

21
test/io_test.cpp Normal file
View File

@@ -0,0 +1,21 @@
//
// Created by ricardo on 2022/5/7.
//
#include "gtest/gtest.h"
#include "gmock/gmock.h"
extern "C"
{
#include "rail.h"
}
using ::testing::Return;
using ::testing::AtLeast;
using ::testing::Exactly;
using namespace testing;
TEST(test, test)
{
int result = add(1, 1);
EXPECT_EQ(2, result);
}