Import Mbed OS hard-float snapshot
This commit is contained in:
49
drivers/tests/UNITTESTS/Watchdog/test_watchdog.cpp
Normal file
49
drivers/tests/UNITTESTS/Watchdog/test_watchdog.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Arm Limited and affiliates.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "gtest/gtest.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "Watchdog.h"
|
||||
|
||||
using namespace mbed;
|
||||
extern bool testcase;
|
||||
// AStyle ignored as the definition is not clear due to preprocessor usage
|
||||
// *INDENT-OFF*
|
||||
class TestWatchdog : public testing::Test {
|
||||
protected:
|
||||
|
||||
void SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
void TearDown()
|
||||
{
|
||||
}
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
TEST_F(TestWatchdog, test_watchdog_start_stop_get_timeout)
|
||||
{
|
||||
EXPECT_TRUE(Watchdog::get_instance().start(500));
|
||||
EXPECT_TRUE(Watchdog::get_instance().stop());
|
||||
EXPECT_FALSE(Watchdog::get_instance().stop());
|
||||
EXPECT_EQ(500, Watchdog::get_instance().get_timeout());
|
||||
}
|
||||
|
||||
TEST_F(TestWatchdog, test_watchdog_get_max_timeout)
|
||||
{
|
||||
EXPECT_EQ(0xFFFFFFFF, Watchdog::get_instance().get_max_timeout());
|
||||
}
|
||||
29
drivers/tests/UNITTESTS/Watchdog/unittest.cmake
Normal file
29
drivers/tests/UNITTESTS/Watchdog/unittest.cmake
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
####################
|
||||
# UNIT TESTS
|
||||
####################
|
||||
set(TEST_SUITE_NAME "Watchdog")
|
||||
|
||||
# Add test specific include paths
|
||||
set(unittest-includes ${unittest-includes}
|
||||
.
|
||||
../hal
|
||||
)
|
||||
|
||||
# Source files
|
||||
set(unittest-sources
|
||||
../drivers/source/Watchdog.cpp
|
||||
)
|
||||
|
||||
# Test files
|
||||
set(unittest-test-sources
|
||||
../drivers/tests/UNITTESTS/Watchdog/test_watchdog.cpp
|
||||
stubs/mbed_critical_stub.c
|
||||
stubs/mbed_assert_stub.cpp
|
||||
stubs/watchdog_api_stub.c
|
||||
)
|
||||
|
||||
set(unittest-test-flags
|
||||
-DDEVICE_WATCHDOG
|
||||
-DMBED_WDOG_ASSERT=1
|
||||
)
|
||||
Reference in New Issue
Block a user