mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
047ae0d4d8
This commit applies our `clang-format` rules globally. From now on, all commits should respect our configuration file. Pretty large change.
39 lines
799 B
C++
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());
|
|
}
|