mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
076aeac7f3
This commit moves around most files. The new directory structure is as follows: * `lib/$LIBRARY/`: contains a library, i.e., a set of `.cpp` files used by multiple libraries/tools. * `include/revng/$LIBRARY/`: contains the public headers associated to the library in `lib/$LIBRARY/`. * `tools/$TOOL/`: directory where all the `.cpp` files (and private headers) for a tool reside. Currently we have two tools: `revamb` and `revamb-dump`. On top of this, all file names are now in camel case.
38 lines
824 B
C++
38 lines
824 B
C++
/// \file sentinel.cpp
|
|
/// \brief Tests for ClassSentinel
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
// Boost includes
|
|
#define BOOST_TEST_MODULE StackAnalysis
|
|
bool init_unit_test();
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
// Local libraries includes
|
|
#include "revng/Support/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());
|
|
}
|