Files
revng-revng/tests/Unit/classsentinel.cpp
T
Alessandro Di Federico 047ae0d4d8 Apply clang-format globally
This commit applies our `clang-format` rules globally. From now on, all
commits should respect our configuration file.

Pretty large change.
2018-09-21 20:08:45 +02:00

39 lines
799 B
C++

/// \file sentinel.cpp
/// \brief Tests for ClassSentinel
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
// Standard includes
// Boost includes
#define BOOST_TEST_MODULE StackAnalysis
#include <boost/test/unit_test.hpp>
// Local includes
#include "classsentinel.h"
struct TestClass {
ClassSentinel Sentinel;
};
BOOST_AUTO_TEST_CASE(Sentinel) {
TestClass *DanglingPointer = nullptr;
{
TestClass Instance;
BOOST_TEST(!Instance.Sentinel.isMoved());
BOOST_TEST(!Instance.Sentinel.isDestroyed());
TestClass OtherInstance = std::move(Instance);
BOOST_TEST(Instance.Sentinel.isMoved());
BOOST_TEST(!Instance.Sentinel.isDestroyed());
DanglingPointer = &Instance;
}
BOOST_TEST(DanglingPointer->Sentinel.isDestroyed());
}