Skip to content

Commit

Permalink
Update libcxx tests
Browse files Browse the repository at this point in the history
  • Loading branch information
morzhovets committed Jan 4, 2024
1 parent 15061cf commit 8fb221e
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 46 deletions.
23 changes: 14 additions & 9 deletions test/sources/LibcxxArrayTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,44 @@

#include "../../include/momo/stdish/vector.h"

#define LIBCXX_TEST_FAILURE

#define LIBCXX_TEST_ARRAY
#define LIBCXX_TEST_PREFIX "libcxx_test_array_0"
namespace libcxx_test_array_0
{

class LibcxxArraySettings : public momo::ArraySettings<0, false>
{
public:
static const momo::CheckMode checkMode = momo::CheckMode::exception;
};

template<typename TValue,
typename TAllocator = std::allocator<TValue>>
using vector = momo::stdish::vector<TValue, TAllocator,
momo::Array<TValue, momo::MemManagerStd<TAllocator>,
momo::ArrayItemTraits<TValue, momo::MemManagerStd<TAllocator>>, LibcxxArraySettings>>;

#define LIBCXX_TEST_FAILURE
#define LIBCXX_TEST_ARRAY
#define LIBCXX_TEST_PREFIX "libcxx_test_array_0"
#include "libcxx/VectorTests.h"
}
#undef LIBCXX_TEST_PREFIX
#undef LIBCXX_TEST_ARRAY

#undef LIBCXX_TEST_FAILURE

#define LIBCXX_TEST_INTCAP_ARRAY
#define LIBCXX_TEST_PREFIX "libcxx_test_array_5"
} // namespace libcxx_test_array_0

namespace libcxx_test_array_5
{

template<typename TValue,
typename TAllocator = std::allocator<TValue>>
using vector = momo::stdish::vector_intcap<5, TValue, TAllocator>;

#define LIBCXX_TEST_INTCAP_ARRAY
#define LIBCXX_TEST_PREFIX "libcxx_test_array_5"
#include "libcxx/VectorTests.h"
}
#undef LIBCXX_TEST_PREFIX
#undef LIBCXX_TEST_INTCAP_ARRAY

} // namespace libcxx_test_array_5

#endif // TEST_LIBCXX_ARRAY
13 changes: 9 additions & 4 deletions test/sources/LibcxxHashMapTester.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
namespace
{

#define LIBCXX_TEST_FAILURE

#define LIBCXX_TEST_PREFIX "libcxx_test_hash_map_" LIBCXX_TEST_BUCKET_NAME
class LibcxxHashMapSettings : public momo::HashMapSettings
{
public:
static const momo::CheckMode checkMode = momo::CheckMode::exception;
};

namespace libcxx_test_hash_map
{

template<typename TKey, typename TMapped,
typename THashFunc = std::hash<TKey>,
typename TEqualFunc = std::equal_to<TKey>,
Expand All @@ -36,9 +37,13 @@ using unordered_map = momo::stdish::unordered_map<TKey, TMapped, THashFunc, TEqu
momo::MemManagerStd<TAllocator>,
momo::HashMapKeyValueTraits<TKey, TMapped, momo::MemManagerStd<TAllocator>>,
LibcxxHashMapSettings>>;

#define LIBCXX_TEST_FAILURE
#define LIBCXX_TEST_PREFIX "libcxx_test_hash_map_" LIBCXX_TEST_BUCKET_NAME
#include "libcxx/UnorderedMapTests.h"
#undef LIBCXX_TEST_PREFIX

#undef LIBCXX_TEST_FAILURE

} // namespace libcxx_test_hash_map

} // namespace
8 changes: 7 additions & 1 deletion test/sources/LibcxxHashMapTesterOpen8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,22 @@
namespace
{

#define LIBCXX_TEST_PREFIX "libcxx_test_hash_map_open"
namespace libcxx_test_hash_map
{

template<typename TKey, typename TMapped,
typename THashFunc = std::hash<TKey>,
typename TEqualFunc = std::equal_to<TKey>,
typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>>
using unordered_map = momo::stdish::unordered_map_open<TKey, TMapped,
THashFunc, TEqualFunc, TAllocator>;

#define LIBCXX_TEST_PREFIX "libcxx_test_hash_map_open"
#include "libcxx/UnorderedMapTests.h"
#undef LIBCXX_TEST_PREFIX

} // namespace libcxx_test_hash_map

} // namespace

#endif // TEST_LIBCXX_HASH_MAP
13 changes: 9 additions & 4 deletions test/sources/LibcxxHashMultiMapTester.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
namespace
{

#define LIBCXX_TEST_FAILURE

#define LIBCXX_TEST_PREFIX "libcxx_test_hash_multimap_" LIBCXX_TEST_BUCKET_NAME
class LibcxxHashMultiMapSettings : public momo::HashMultiMapSettings
{
public:
static const momo::CheckMode checkMode = momo::CheckMode::exception;
};

namespace libcxx_test_hash_multimap
{

template<typename TKey, typename TMapped,
typename THashFunc = std::hash<TKey>,
typename TEqualFunc = std::equal_to<TKey>,
Expand All @@ -36,9 +37,13 @@ using unordered_multimap = momo::stdish::unordered_multimap<TKey, TMapped, THash
momo::MemManagerStd<TAllocator>,
momo::HashMultiMapKeyValueTraits<TKey, TMapped, momo::MemManagerStd<TAllocator>>,
LibcxxHashMultiMapSettings>>;

#define LIBCXX_TEST_FAILURE
#define LIBCXX_TEST_PREFIX "libcxx_test_hash_multimap_" LIBCXX_TEST_BUCKET_NAME
#include "libcxx/UnorderedMultiMapTests.h"
#undef LIBCXX_TEST_PREFIX

#undef LIBCXX_TEST_FAILURE

} // namespace libcxx_test_hash_multimap

} // namespace
8 changes: 7 additions & 1 deletion test/sources/LibcxxHashMultiMapTesterOpen8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,22 @@
namespace
{

#define LIBCXX_TEST_PREFIX "libcxx_test_hash_multimap_open"
namespace libcxx_test_hash_multimap
{

template<typename TKey, typename TMapped,
typename THashFunc = std::hash<TKey>,
typename TEqualFunc = std::equal_to<TKey>,
typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>>
using unordered_multimap = momo::stdish::unordered_multimap_open<TKey, TMapped,
THashFunc, TEqualFunc, TAllocator>;

#define LIBCXX_TEST_PREFIX "libcxx_test_hash_multimap_open"
#include "libcxx/UnorderedMultiMapTests.h"
#undef LIBCXX_TEST_PREFIX

} // namespace libcxx_test_hash_multimap

} // namespace

#endif // TEST_LIBCXX_HASH_MULTI_MAP
13 changes: 9 additions & 4 deletions test/sources/LibcxxHashSetTester.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
namespace
{

#define LIBCXX_TEST_FAILURE

#define LIBCXX_TEST_PREFIX "libcxx_test_hash_set_" LIBCXX_TEST_BUCKET_NAME
class LibcxxHashSetSettings : public momo::HashSetSettings
{
public:
static const momo::CheckMode checkMode = momo::CheckMode::exception;
};

namespace libcxx_test_hash_set
{

template<typename TKey,
typename THashFunc = std::hash<TKey>,
typename TEqualFunc = std::equal_to<TKey>,
Expand All @@ -36,9 +37,13 @@ using unordered_set = momo::stdish::unordered_set<TKey, THashFunc, TEqualFunc, T
momo::MemManagerStd<TAllocator>,
momo::HashSetItemTraits<TKey, momo::MemManagerStd<TAllocator>>,
LibcxxHashSetSettings>>;

#define LIBCXX_TEST_FAILURE
#define LIBCXX_TEST_PREFIX "libcxx_test_hash_set_" LIBCXX_TEST_BUCKET_NAME
#include "libcxx/UnorderedSetTests.h"
#undef LIBCXX_TEST_PREFIX

#undef LIBCXX_TEST_FAILURE

} // namespace libcxx_test_hash_set

} // namespace
8 changes: 7 additions & 1 deletion test/sources/LibcxxHashSetTesterOpen8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,21 @@
namespace
{

#define LIBCXX_TEST_PREFIX "libcxx_test_hash_set_open"
namespace libcxx_test_hash_set
{

template<typename TKey,
typename THashFunc = std::hash<TKey>,
typename TEqualFunc = std::equal_to<TKey>,
typename TAllocator = std::allocator<TKey>>
using unordered_set = momo::stdish::unordered_set_open<TKey, THashFunc, TEqualFunc, TAllocator>;

#define LIBCXX_TEST_PREFIX "libcxx_test_hash_set_open"
#include "libcxx/UnorderedSetTests.h"
#undef LIBCXX_TEST_PREFIX

} // namespace libcxx_test_hash_set

} // namespace

#endif // TEST_LIBCXX_HASH_SET
28 changes: 18 additions & 10 deletions test/sources/LibcxxSegmentedArrayTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,58 @@
#include "../../include/momo/stdish/vector.h"
#include "../../include/momo/SegmentedArray.h"

#define LIBCXX_TEST_FAILURE

#define LIBCXX_TEST_SEGMENTED_ARRAY

#define LIBCXX_TEST_PREFIX "libcxx_test_segmented_array_sqrt"
namespace libcxx_test_segmented_array_sqrt
{

class LibcxxSegmentedArraySettings
: public momo::SegmentedArraySettings<momo::SegmentedArrayItemCountFunc::sqrt, 3>
{
public:
static const momo::CheckMode checkMode = momo::CheckMode::exception;
};

template<typename TValue,
typename TAllocator = std::allocator<TValue>>
using vector = momo::stdish::vector<TValue, TAllocator,
momo::SegmentedArray<TValue, momo::MemManagerStd<TAllocator>,
momo::SegmentedArrayItemTraits<TValue, momo::MemManagerStd<TAllocator>>,
LibcxxSegmentedArraySettings>>;

#define LIBCXX_TEST_FAILURE
#define LIBCXX_TEST_SEGMENTED_ARRAY
#define LIBCXX_TEST_PREFIX "libcxx_test_segmented_array_sqrt"
#include "libcxx/VectorTests.h"
}
#undef LIBCXX_TEST_PREFIX
#undef LIBCXX_TEST_SEGMENTED_ARRAY
#undef LIBCXX_TEST_FAILURE

} // namespace libcxx_test_segmented_array_sqrt

#define LIBCXX_TEST_PREFIX "libcxx_test_segmented_array_cnst"
namespace libcxx_test_segmented_array_cnst
{

class LibcxxSegmentedArraySettings
: public momo::SegmentedArraySettings<momo::SegmentedArrayItemCountFunc::cnst, 0>
{
public:
static const momo::CheckMode checkMode = momo::CheckMode::exception;
};

template<typename TValue,
typename TAllocator = std::allocator<TValue>>
using vector = momo::stdish::vector<TValue, TAllocator,
momo::SegmentedArray<TValue, momo::MemManagerStd<TAllocator>,
momo::SegmentedArrayItemTraits<TValue, momo::MemManagerStd<TAllocator>>,
LibcxxSegmentedArraySettings>>;

#define LIBCXX_TEST_FAILURE
#define LIBCXX_TEST_SEGMENTED_ARRAY
#define LIBCXX_TEST_PREFIX "libcxx_test_segmented_array_cnst"
#include "libcxx/VectorTests.h"
}
#undef LIBCXX_TEST_PREFIX

#undef LIBCXX_TEST_SEGMENTED_ARRAY

#undef LIBCXX_TEST_FAILURE

} // namespace libcxx_test_segmented_array_cnst

#endif // TEST_LIBCXX_ARRAY
7 changes: 4 additions & 3 deletions test/sources/LibcxxTreeMapTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

#include "../../include/momo/stdish/map.h"

namespace
namespace libcxx_test_tree_map
{

#define LIBCXX_TEST_PREFIX "libcxx_test_tree_map"
template<typename TKey, typename TMapped,
typename TLessFunc = std::less<TKey>,
typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>>
Expand All @@ -31,9 +30,11 @@ using map = momo::stdish::map<TKey, TMapped, TLessFunc, TAllocator,
momo::MemManagerStd<TAllocator>,
momo::TreeMapKeyValueTraits<TKey, TMapped, momo::MemManagerStd<TAllocator>>,
momo::TreeMapSettings>>;

#define LIBCXX_TEST_PREFIX "libcxx_test_tree_map"
#include "libcxx/MapTests.h"
#undef LIBCXX_TEST_PREFIX

} // namespace
} // namespace libcxx_test_tree_map

#endif // TEST_LIBCXX_TREE_MAP
7 changes: 4 additions & 3 deletions test/sources/LibcxxTreeMultiMapTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

#include "../../include/momo/stdish/map.h"

namespace
namespace libcxx_test_tree_multimap
{

#define LIBCXX_TEST_PREFIX "libcxx_test_tree_multimap"
template<typename TKey, typename TMapped,
typename TLessFunc = std::less<TKey>,
typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>>
Expand All @@ -31,9 +30,11 @@ using multimap = momo::stdish::multimap<TKey, TMapped, TLessFunc, TAllocator,
momo::MemManagerStd<TAllocator>,
momo::TreeMapKeyValueTraits<TKey, TMapped, momo::MemManagerStd<TAllocator>>,
momo::TreeMapSettings>>;

#define LIBCXX_TEST_PREFIX "libcxx_test_tree_multimap"
#include "libcxx/MultiMapTests.h"
#undef LIBCXX_TEST_PREFIX

} // namespace
} // namespace libcxx_test_tree_multimap

#endif // TEST_LIBCXX_TREE_MAP
7 changes: 4 additions & 3 deletions test/sources/LibcxxTreeMultiSetTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

#include "../../include/momo/stdish/set.h"

namespace
namespace libcxx_test_tree_multiset
{

#define LIBCXX_TEST_PREFIX "libcxx_test_tree_multiset"
template<typename TKey,
typename TLessFunc = std::less<TKey>,
typename TAllocator = std::allocator<TKey>>
Expand All @@ -31,9 +30,11 @@ using multiset = momo::stdish::multiset<TKey, TLessFunc, TAllocator,
momo::MemManagerStd<TAllocator>,
momo::TreeSetItemTraits<TKey, momo::MemManagerStd<TAllocator>>,
momo::TreeSetSettings>>;

#define LIBCXX_TEST_PREFIX "libcxx_test_tree_multiset"
#include "libcxx/MultiSetTests.h"
#undef LIBCXX_TEST_PREFIX

} // namespace
} // namespace libcxx_test_tree_multiset

#endif // TEST_LIBCXX_TREE_SET
7 changes: 4 additions & 3 deletions test/sources/LibcxxTreeSetTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

#include "../../include/momo/stdish/set.h"

namespace
namespace libcxx_test_tree_set
{

#define LIBCXX_TEST_PREFIX "libcxx_test_tree_set"
template<typename TKey,
typename TLessFunc = std::less<TKey>,
typename TAllocator = std::allocator<TKey>>
Expand All @@ -31,9 +30,11 @@ using set = momo::stdish::set<TKey, TLessFunc, TAllocator,
momo::MemManagerStd<TAllocator>,
momo::TreeSetItemTraits<TKey, momo::MemManagerStd<TAllocator>>,
momo::TreeSetSettings>>;

#define LIBCXX_TEST_PREFIX "libcxx_test_tree_set"
#include "libcxx/SetTests.h"
#undef LIBCXX_TEST_PREFIX

} // namespace
} // namespace libcxx_test_tree_set

#endif // TEST_LIBCXX_TREE_SET

0 comments on commit 8fb221e

Please sign in to comment.