#include "client/annotation.h"
#include <algorithm>
#include <iterator>
#include <string>
#include <type_traits>
#include <vector>
#include "base/rand_util.h"
#include "client/crashpad_info.h"
#include "gtest/gtest.h"
#include "util/misc/clock.h"
#include "util/thread/thread.h"
namespace crashpad {
namespace test {
namespace {
#if (__cplusplus >= 202002L)
template <typename Iterator>
requires std::input_iterator<Iterator>
void VerifyIsInputIterator(Iterator) { … }
#else
template <typename Iterator>
struct IsLegacyIteratorImpl {
static constexpr bool value =
std::is_copy_constructible_v<Iterator> &&
std::is_copy_assignable_v<Iterator> && std::is_destructible_v<Iterator> &&
std::is_swappable_v<Iterator> &&
!std::is_same_v<typename std::iterator_traits<Iterator>::reference,
void> &&
std::is_same_v<decltype(++std::declval<Iterator>()), Iterator&> &&
!std::is_same_v<decltype(*std::declval<Iterator>()), void>;
};
template <typename Iterator>
struct IsLegacyInputIteratorImpl {
static constexpr bool value =
IsLegacyIteratorImpl<Iterator>::value &&
std::is_base_of_v<
std::input_iterator_tag,
typename std::iterator_traits<Iterator>::iterator_category> &&
std::is_convertible_v<decltype(std::declval<Iterator>() !=
std::declval<Iterator>()),
bool> &&
std::is_convertible_v<decltype(std::declval<Iterator>() ==
std::declval<Iterator>()),
bool> &&
std::is_same_v<decltype(*std::declval<Iterator>()),
typename std::iterator_traits<Iterator>::reference> &&
std::is_same_v<decltype(++std::declval<Iterator>()), Iterator&> &&
std::is_same_v<decltype(std::declval<Iterator>()++), Iterator> &&
std::is_same_v<decltype(*(++std::declval<Iterator>())),
typename std::iterator_traits<Iterator>::reference>;
};
template <typename Iterator>
void VerifyIsInputIterator(Iterator) {
static_assert(IsLegacyInputIteratorImpl<Iterator>::value);
}
#endif
TEST(AnnotationListStatic, Register) { … }
class AnnotationList : public testing::Test { … };
TEST_F(AnnotationList, SetAndClear) { … }
TEST_F(AnnotationList, DuplicateKeys) { … }
TEST_F(AnnotationList, IteratorSingleAnnotation) { … }
TEST_F(AnnotationList, IteratorMultipleAnnotationsInserted) { … }
TEST_F(AnnotationList, IteratorMultipleAnnotationsInsertedAndRemoved) { … }
TEST_F(AnnotationList, IteratorIsInputIterator) { … }
class RaceThread : public Thread { … };
TEST_F(AnnotationList, MultipleThreads) { … }
}
}
}