New button template
This commit is contained in:
34
templates/button/test/test_unit.cpp.tmpl
Normal file
34
templates/button/test/test_unit.cpp.tmpl
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* test_unit.cpp -- Your unit tests go here.
|
||||
*
|
||||
* This file is YOURS. Anvil will never overwrite it.
|
||||
* The button example tests are in test_button_app.cpp.
|
||||
*
|
||||
* Unit tests use MockHal and ButtonMock to verify exact behavior
|
||||
* without real hardware. See test_button_app.cpp for examples.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
#include "hal.h"
|
||||
#include "mock_hal.h"
|
||||
#include "button_mock.h"
|
||||
#include "{{PROJECT_NAME}}_app.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::AnyNumber;
|
||||
using ::testing::Return;
|
||||
|
||||
// Example: add your own tests below
|
||||
// TEST(MyTests, DescribeWhatItTests) {
|
||||
// ::testing::NiceMock<MockHal> mock;
|
||||
// ButtonMock btn;
|
||||
//
|
||||
// ButtonApp app(&mock, &btn);
|
||||
// app.begin();
|
||||
//
|
||||
// btn.setPressed(true);
|
||||
// app.update();
|
||||
// EXPECT_EQ(app.pressCount(), 1);
|
||||
// }
|
||||
Reference in New Issue
Block a user