ADD cpplint args in action file
This commit is contained in:
@ -24,12 +24,12 @@
|
||||
* @version 0.2.0
|
||||
***************************************************************************/
|
||||
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "mbed.h"
|
||||
#include "unity/unity.h"
|
||||
#include "utest/utest.h"
|
||||
#include "greentea-client/test_env.h" // NOLINT
|
||||
#include "mbed.h" // NOLINT
|
||||
#include "unity/unity.h" // NOLINT
|
||||
#include "utest/utest.h" // NOLINT
|
||||
|
||||
using namespace utest::v1;
|
||||
namespace utest::v1 {
|
||||
struct Test {
|
||||
Test() {
|
||||
_instanceCount++;
|
||||
@ -97,8 +97,8 @@ void test_instance_sharing() {
|
||||
}
|
||||
|
||||
/**********************
|
||||
* UNIQUE PTR EXERCISE *
|
||||
**********************/
|
||||
* UNIQUE PTR EXERCISE *
|
||||
**********************/
|
||||
|
||||
/*
|
||||
* Check normal lifetime on a unique_ptr
|
||||
@ -114,7 +114,7 @@ void test_single_unique_ptr_lifetime() {
|
||||
TEST_ASSERT_EQUAL(Test::kMagicNumber, p1->_value);
|
||||
|
||||
const uint32_t number = 42;
|
||||
p1->_value = number;
|
||||
p1->_value = number;
|
||||
TEST_ASSERT_EQUAL(number, p1->_value);
|
||||
|
||||
p1.reset();
|
||||
@ -132,12 +132,12 @@ void test_unique_ptr_transfer() {
|
||||
TEST_ASSERT_EQUAL(0, Test::_instanceCount);
|
||||
|
||||
{
|
||||
//create p1
|
||||
// create p1
|
||||
std::unique_ptr<Test> p1 = std::make_unique<Test>();
|
||||
TEST_ASSERT_EQUAL(Test::kMagicNumber, p1->_value);
|
||||
TEST_ASSERT_EQUAL(1, Test::_instanceCount);
|
||||
|
||||
//transfer p1 to p2
|
||||
// transfer p1 to p2
|
||||
std::unique_ptr<Test> p2 = std::move(p1);
|
||||
TEST_ASSERT_EQUAL(Test::kMagicNumber, p2->_value);
|
||||
TEST_ASSERT_EQUAL(1, Test::_instanceCount);
|
||||
@ -145,7 +145,7 @@ void test_unique_ptr_transfer() {
|
||||
p2.reset();
|
||||
|
||||
TEST_ASSERT_EQUAL(0, Test::_instanceCount);
|
||||
TEST_ASSERT(!p1);
|
||||
TEST_ASSERT(!p1); // cppcheck-suppress accessMoved
|
||||
TEST_ASSERT(!p2);
|
||||
}
|
||||
|
||||
@ -160,13 +160,13 @@ void test_unique_ptr_release() {
|
||||
TEST_ASSERT_EQUAL(0, Test::_instanceCount);
|
||||
|
||||
{
|
||||
//create p1
|
||||
// create p1
|
||||
std::unique_ptr<Test> p1 = std::make_unique<Test>();
|
||||
TEST_ASSERT_EQUAL(Test::kMagicNumber, p1->_value);
|
||||
TEST_ASSERT_EQUAL(1, Test::_instanceCount);
|
||||
|
||||
//transfer and release p1 to p2
|
||||
Test * p2 = p1.release();
|
||||
// transfer and release p1 to p2
|
||||
Test* p2 = p1.release();
|
||||
TEST_ASSERT_EQUAL(Test::kMagicNumber, p2->_value);
|
||||
TEST_ASSERT_EQUAL(1, Test::_instanceCount);
|
||||
|
||||
@ -192,21 +192,21 @@ void test_unique_ptr_swap() {
|
||||
const uint32_t number1 = 65;
|
||||
const uint32_t number2 = 42;
|
||||
|
||||
//create p1
|
||||
// create p1
|
||||
std::unique_ptr<Test> p1 = std::make_unique<Test>();
|
||||
TEST_ASSERT_EQUAL(Test::kMagicNumber, p1->_value);
|
||||
TEST_ASSERT_EQUAL(1, Test::_instanceCount);
|
||||
p1->_value = number1;
|
||||
TEST_ASSERT_EQUAL(number1, p1->_value);
|
||||
|
||||
//create p2
|
||||
// create p2
|
||||
std::unique_ptr<Test> p2 = std::make_unique<Test>();
|
||||
TEST_ASSERT_EQUAL(Test::kMagicNumber, p2->_value);
|
||||
TEST_ASSERT_EQUAL(2, Test::_instanceCount);
|
||||
p2->_value = number2;
|
||||
TEST_ASSERT_EQUAL(number2, p2->_value);
|
||||
|
||||
//swap
|
||||
// swap
|
||||
p1.swap(p2);
|
||||
|
||||
TEST_ASSERT_EQUAL(number1, p2->_value);
|
||||
@ -223,11 +223,9 @@ void test_unique_ptr_swap() {
|
||||
TEST_ASSERT_EQUAL(0, Test::_instanceCount);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************
|
||||
* RAW PTR EXERCISE *
|
||||
*******************/
|
||||
* RAW PTR EXERCISE *
|
||||
*******************/
|
||||
|
||||
/**
|
||||
* Test that a shared pointer correctly manages the lifetime of the underlying raw pointer
|
||||
@ -242,12 +240,12 @@ void test_single_raw_ptr_lifetime() {
|
||||
TEST_ASSERT_EQUAL(1, Test::_instanceCount);
|
||||
TEST_ASSERT_EQUAL(Test::kMagicNumber, t1._value);
|
||||
|
||||
Test * p1 = &t1;
|
||||
Test* p1 = &t1;
|
||||
TEST_ASSERT_EQUAL(1, Test::_instanceCount);
|
||||
TEST_ASSERT_EQUAL(Test::kMagicNumber, p1->_value);
|
||||
|
||||
const uint32_t number1 = 42;
|
||||
p1->_value = number1;
|
||||
p1->_value = number1;
|
||||
TEST_ASSERT_EQUAL(number1, p1->_value);
|
||||
TEST_ASSERT_EQUAL(number1, t1._value);
|
||||
|
||||
@ -285,4 +283,5 @@ static Case cases[] = {
|
||||
|
||||
static Specification specification(greentea_setup, cases);
|
||||
|
||||
int main() { return !Harness::run(specification); }
|
||||
int main() { return !Harness::run(specification); }
|
||||
}; // namespace utest::v1
|
||||
|
Reference in New Issue
Block a user