mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-01 19:36:06 +00:00

This patch almost entirely rewrites the unique_ptr tests. There are a couple of reasons for this: A) Most of the *.fail.cpp tests were either incorrect or could be better written as a *.pass.cpp test that uses <type_traits> to check if certain operations are valid (Ex. Using static_assert(!std::is_copy_constructible_v<T>) instead of writing a failure test). B) [unique.ptr.runtime] has very poor test coverage. Many of the constructors and assignment operators have to tests at all. The special members that have tests have very few test cases and are typically way out of date. C) The tests for [unique.ptr.single] and [unique.ptr.runtime] are largely duplicates of each other. This means common requirements have two different sets of tests in two different test files. This makes the tests harder to maintain than if there was a single copy. To address (A) this patch changes almost all of the *.fail.cpp tests into .pass.cpp tests using type traits; Allowing the *.fail.cpp tests to be removed. The address (B) and (C) the tests for [unique.ptr.single] and [unique.ptr.runtime] have been combined into a single directory, allowing both specializations to share common tests. Tests specific to the single/runtime specializations are given the suffix "*.single.pass.cpp" or "*.runtime.pass.cpp". Finally the unique.ptr test have been moved into the correct directory according to the standard. Specifically they have been removed from "utilities/memory" into "utilities/smartptr". PS. This patch also adds newly written tests for upcoming unique_ptr changes/fixes. However since these tests don't currently pass they are guarded by the macro TEST_WORKAROUND_UPCOMING_UNIQUE_PTR_CHANGES. This allows other STL's to validate the tests before libc++ implements the changes. The relevant libc++ changes should land in the next week. llvm-svn: 300388
29 lines
987 B
C++
29 lines
987 B
C++
// -*- C++ -*-
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
// Source Licenses. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SUPPORT_TEST_WORKAROUNDS_H
|
|
#define SUPPORT_TEST_WORKAROUNDS_H
|
|
|
|
#include "test_macros.h"
|
|
|
|
#if defined(TEST_COMPILER_C1XX)
|
|
# define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
|
|
#endif
|
|
|
|
// FIXME(EricWF): Remove this. This macro guards tests for upcoming changes
|
|
// and fixes to unique_ptr. Until the changes have been implemented in trunk
|
|
// the tests have to be disabled. However the tests have been left in until
|
|
// then so they can be used by other standard libraries.
|
|
#if defined(_LIBCPP_VERSION)
|
|
# define TEST_WORKAROUND_UPCOMING_UNIQUE_PTR_CHANGES
|
|
#endif
|
|
|
|
#endif // SUPPORT_TEST_WORKAROUNDS_H
|