File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -93,3 +93,19 @@ target_link_libraries(
9393)
9494
9595gtest_discover_tests(custom_blocks_test)
96+
97+ # sensing_blocks_test
98+ add_executable (
99+ sensing_blocks_test
100+ sensing_blocks_test.cpp
101+ )
102+
103+ target_link_libraries (
104+ sensing_blocks_test
105+ GTest::gtest_main
106+ GTest::gmock_main
107+ scratchcpp
108+ scratchcpp_mocks
109+ )
110+
111+ gtest_discover_tests(sensing_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/sensingblocks.h"
7+ #include " engine/internal/engine.h"
8+
9+ using namespace libscratchcpp ;
10+
11+ class SensingBlocksTest : public testing ::Test
12+ {
13+ public:
14+ void SetUp () override
15+ {
16+ m_section = std::make_unique<SensingBlocks>();
17+ m_section->registerBlocks (&m_engine);
18+ }
19+
20+ std::unique_ptr<IBlockSection> m_section;
21+ EngineMock m_engineMock;
22+ Engine m_engine;
23+ };
24+
25+ TEST_F (SensingBlocksTest, Name)
26+ {
27+ ASSERT_EQ (m_section->name (), " Sensing" );
28+ }
29+
30+ TEST_F (SensingBlocksTest, CategoryVisible)
31+ {
32+ ASSERT_TRUE (m_section->categoryVisible ());
33+ }
34+
35+ TEST_F (SensingBlocksTest, RegisterBlocks)
36+ {
37+ m_section->registerBlocks (&m_engineMock);
38+ }
You can’t perform that action at this time.
0 commit comments