mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
GoogleTest hello world.
./build and ./test work automatically when cwd is inside userland/libs/XXX without --package-all.
This commit is contained in:
1
userland/libs/googletest/build
Symbolic link
1
userland/libs/googletest/build
Symbolic link
@@ -0,0 +1 @@
|
||||
../build
|
||||
9
userland/libs/googletest/fail.cpp
Normal file
9
userland/libs/googletest/fail.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(FailTest, ThisTestPasses) {
|
||||
EXPECT_EQ(1, 1);
|
||||
}
|
||||
|
||||
TEST(FailTest, ThisTestFails) {
|
||||
EXPECT_EQ(1, 2);
|
||||
}
|
||||
27
userland/libs/googletest/main.cpp
Normal file
27
userland/libs/googletest/main.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using testing::ElementsAre;
|
||||
using testing::Pair;
|
||||
|
||||
TEST(MainTest, MyTest0) {
|
||||
EXPECT_EQ(1, 1);
|
||||
|
||||
// Array comparison.
|
||||
// https://stackoverflow.com/questions/1460703/comparison-of-arrays-in-google-test
|
||||
ASSERT_THAT(
|
||||
(std::vector<int>{5, 10, 15}),
|
||||
ElementsAre(5, 10, 15)
|
||||
);
|
||||
ASSERT_THAT(
|
||||
(std::vector<std::pair<int, int>>{{1, -1}, {2, -2}}),
|
||||
ElementsAre(Pair(1, -1), Pair(2, -2))
|
||||
);
|
||||
}
|
||||
|
||||
TEST(MainTest, MyTest1) {
|
||||
EXPECT_EQ(1, 1);
|
||||
}
|
||||
1
userland/libs/googletest/test
Symbolic link
1
userland/libs/googletest/test
Symbolic link
@@ -0,0 +1 @@
|
||||
../test
|
||||
Reference in New Issue
Block a user