Skip to content

Commit

Permalink
libcxx/Support.h
Browse files Browse the repository at this point in the history
  • Loading branch information
morzhovets committed Jan 4, 2024
1 parent 7425dc2 commit 345761b
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 53 deletions.
55 changes: 2 additions & 53 deletions test/sources/LibcxxTester.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,60 +12,9 @@

#pragma once

#include <iostream>
#include <cfloat>
#include <string>
#include <cmath>

#ifdef __cpp_lib_optional
#include <optional>
#endif

#if !defined(TEST_MSVC) && !defined(__cpp_lib_transparent_operators)
#define LIBCPP_HAS_NO_TRANSPARENT_OPERATORS
#endif

#if !defined(LIBCPP_TEST_DEDUCTION_GUIDES) && defined(MOMO_HAS_DEDUCTION_GUIDES)
#if defined(TEST_MSVC) && _MSC_VER >= 1924
#define LIBCPP_TEST_DEDUCTION_GUIDES
#endif
#if defined(TEST_GCC) && __GNUC__ >= 8
#define LIBCPP_TEST_DEDUCTION_GUIDES
#endif
#endif

//#define LIBCPP_HAS_BAD_NEWS_FOR_MOMO
#include "libcxx/Support.h"

//#define LIBCPP_TEST_MIN_ALLOCATOR
//#define LIBCPP_TEST_STACK_ALLOCATOR

#include "libcxx/support/MoveOnly.h"
#include "libcxx/support/Copyable.h"
#include "libcxx/support/NotConstructible.h"
#include "libcxx/support/DefaultOnly.h"
#include "libcxx/support/Emplaceable.h"
#include "libcxx/support/Counter.h"
#include "libcxx/support/Moveable.h"
#include "libcxx/support/test_allocator.h"
#include "libcxx/support/test_iterators.h"
#include "libcxx/support/test_compare.h"
#include "libcxx/support/test_hash.h"
#include "libcxx/support/private_constructor.h"
#include "libcxx/support/is_transparent.h"
#include "libcxx/support/test_macros.h"
#include "libcxx/support/test_transparent_unordered.h"
//#include "libcxx/support/min_allocator.h"
//#include "libcxx/support/stack_allocator.h"

struct LibcppIntHash
{
size_t operator()(int key) const noexcept
{
return static_cast<size_t>(key);
}
};

#define LIBCPP_CATCH(expr) try { (void)(expr); assert(false); } catch (...) {}
#include <iostream>

#define LIBCXX_TEST_BEGIN(name) \
namespace name { \
Expand Down
67 changes: 67 additions & 0 deletions test/sources/libcxx/Support.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**********************************************************\
This file is part of the
https://github.com/morzhovets/momo
project, distributed under the MIT License. See
https://github.com/morzhovets/momo/blob/branch_cpp11/LICENSE
for details.
test/sources/libcxx/Support.h
\**********************************************************/

#pragma once

#include <cfloat>
#include <string>
#include <cmath>

#ifdef __cpp_lib_optional
#include <optional>
#endif

#if !defined(TEST_MSVC) && !defined(__cpp_lib_transparent_operators)
#define LIBCPP_HAS_NO_TRANSPARENT_OPERATORS
#endif

#if !defined(LIBCPP_TEST_DEDUCTION_GUIDES) && defined(MOMO_HAS_DEDUCTION_GUIDES)
#if defined(TEST_MSVC) && _MSC_VER >= 1924
#define LIBCPP_TEST_DEDUCTION_GUIDES
#endif
#if defined(TEST_GCC) && __GNUC__ >= 8
#define LIBCPP_TEST_DEDUCTION_GUIDES
#endif
#endif

//#define LIBCPP_HAS_BAD_NEWS_FOR_MOMO

//#define LIBCPP_TEST_MIN_ALLOCATOR
//#define LIBCPP_TEST_STACK_ALLOCATOR

#include "libcxx/support/MoveOnly.h"
#include "libcxx/support/Copyable.h"
#include "libcxx/support/NotConstructible.h"
#include "libcxx/support/DefaultOnly.h"
#include "libcxx/support/Emplaceable.h"
#include "libcxx/support/Counter.h"
#include "libcxx/support/Moveable.h"
#include "libcxx/support/test_allocator.h"
#include "libcxx/support/test_iterators.h"
#include "libcxx/support/test_compare.h"
#include "libcxx/support/test_hash.h"
#include "libcxx/support/private_constructor.h"
#include "libcxx/support/is_transparent.h"
#include "libcxx/support/test_macros.h"
#include "libcxx/support/test_transparent_unordered.h"
//#include "libcxx/support/min_allocator.h"
//#include "libcxx/support/stack_allocator.h"

struct LibcppIntHash
{
size_t operator()(int key) const noexcept
{
return static_cast<size_t>(key);
}
};

#define LIBCPP_CATCH(expr) try { (void)(expr); assert(false); } catch (...) {}

0 comments on commit 345761b

Please sign in to comment.