mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
12d093b459
This commit performs the changes necessary in order to integrate with revng-qa, the new project for cross-project quality assurance. Basically, the source code of all the tests has been moved in revng-qa, which will take care of producing "artifacts" (i.e., compiled programs), using the appropriate cross-compilers. revng will then consume them and produce new artifacts to be consumed by other tools down the pipeline. The directory structure of the tests has been reworked to reflect `revng-qa`. A large amount of boilerplate code has been dropped. Note that certain actions, that used to be carried out during testing, are now part of the regular build process. Specifically, lifting the tests is performed at build time, so that they can be installed.
44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
/// \file ClassSentinel.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"
|
|
#include "revng/UnitTestHelpers/UnitTestHelpers.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;
|
|
}
|
|
|
|
#if !(defined(__OPTIMIZE__) || defined(__SANITIZE_ADDRESS__) \
|
|
|| (defined(__has_feature) && __has_feature(address_sanitizer)))
|
|
BOOST_TEST(DanglingPointer->Sentinel.isDestroyed());
|
|
#else
|
|
(void) DanglingPointer;
|
|
#endif
|
|
}
|