aboutsummaryrefslogtreecommitdiff
path: root/tools/interface_generator/test
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2024-08-07 17:36:57 +0300
committeraqua <aqua@iserlohn-fortress.net>2024-08-07 17:36:57 +0300
commitdcd2f898af9d4efcb22417c19fa1b3abc8c548c5 (patch)
tree3ef0eaa4b9595bf90c733e8f196edd1c3f72c472 /tools/interface_generator/test
parentAdded interface_generator (diff)
downloadkernel-dcd2f898af9d4efcb22417c19fa1b3abc8c548c5.tar.xz
Added bazel rule for interface_generator
Diffstat (limited to 'tools/interface_generator/test')
-rw-r--r--tools/interface_generator/test/BUILD.bazel17
-rw-r--r--tools/interface_generator/test/test_kstdio.cpp20
2 files changed, 37 insertions, 0 deletions
diff --git a/tools/interface_generator/test/BUILD.bazel b/tools/interface_generator/test/BUILD.bazel
new file mode 100644
index 0000000..5d6348d
--- /dev/null
+++ b/tools/interface_generator/test/BUILD.bazel
@@ -0,0 +1,17 @@
+load("//:defs.bzl", "generate_interface")
+
+generate_interface(
+ name = "kstdio",
+ interface = "kstdio",
+ license = "//:LICENSE.md",
+)
+
+cc_test(
+ name = "test_kstdio",
+ srcs = ["kstdio_mock.cpp", "test_kstdio.cpp"],
+ deps = [
+ ":kstdio",
+ "@googletest//:gtest",
+ "@googletest//:gtest_main",
+ ],
+)
diff --git a/tools/interface_generator/test/test_kstdio.cpp b/tools/interface_generator/test/test_kstdio.cpp
new file mode 100644
index 0000000..95540a4
--- /dev/null
+++ b/tools/interface_generator/test/test_kstdio.cpp
@@ -0,0 +1,20 @@
+#include "kstdio_mock.hpp"
+
+using ::testing::StrEq;
+
+class kstdioFixture : public ::testing::Test {
+protected:
+ void
+ SetUp()
+ {
+ }
+
+ kstdio_mock m_kstdio_mock;
+};
+
+TEST_F(kstdioFixture, printfCallsMock)
+{
+ EXPECT_CALL(m_kstdio_mock, printf(StrEq("hello world")));
+
+ kstdio_printf("hello world");
+}