File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -109,3 +109,19 @@ target_link_libraries(
109109)
110110
111111gtest_discover_tests(sensing_blocks_test)
112+
113+ # motion_blocks_test
114+ add_executable (
115+ motion_blocks_test
116+ motion_blocks_test.cpp
117+ )
118+
119+ target_link_libraries (
120+ motion_blocks_test
121+ GTest::gtest_main
122+ GTest::gmock_main
123+ scratchcpp
124+ scratchcpp_mocks
125+ )
126+
127+ gtest_discover_tests(motion_blocks_test)
Original file line number Diff line number Diff line change 1+ #include < scratchcpp/compiler.h>
2+ #include < scratchcpp/block.h>
3+ #include < enginemock.h>
4+
5+ #include " ../common.h"
6+ #include " blocks/motionblocks.h"
7+ #include " engine/internal/engine.h"
8+
9+ using namespace libscratchcpp ;
10+
11+ using ::testing::Return;
12+
13+ class MotionBlocksTest : public testing ::Test
14+ {
15+ public:
16+ void SetUp () override
17+ {
18+ m_section = std::make_unique<MotionBlocks>();
19+ m_section->registerBlocks (&m_engine);
20+ }
21+
22+ std::unique_ptr<IBlockSection> m_section;
23+ EngineMock m_engineMock;
24+ Engine m_engine;
25+ };
26+
27+ TEST_F (MotionBlocksTest, Name)
28+ {
29+ ASSERT_EQ (m_section->name (), " Motion" );
30+ }
31+
32+ TEST_F (MotionBlocksTest, CategoryVisible)
33+ {
34+ ASSERT_TRUE (m_section->categoryVisible ());
35+ }
36+
37+ TEST_F (MotionBlocksTest, RegisterBlocks)
38+ {
39+ m_section->registerBlocks (&m_engineMock);
40+ }
You can’t perform that action at this time.
0 commit comments