<commit_before>#include <type_traits>

#include <blackhole/attribute.hpp>
#include <blackhole/detail/traits/same.hpp>
#include <blackhole/log.hpp>

#include "global.hpp"

using namespace blackhole;

TEST(Traits, IsSupportedAttributeType) {
    static_assert(log::attribute::is_supported<std::uint8_t>::value,    "`std::uint8_t` must be supported");
    static_assert(log::attribute::is_supported<std::uint32_t>::value,   "`std::uint32_t` must be supported");
    static_assert(log::attribute::is_supported<std::int32_t>::value,    "`std::int32_t` must be supported");
    static_assert(log::attribute::is_supported<std::uint64_t>::value,   "`std::uint64_t` must be supported");
    static_assert(log::attribute::is_supported<std::int64_t>::value,    "`std::int64_t` must be supported");
    static_assert(log::attribute::is_supported<std::double_t>::value,   "`std::double_t` must be supported");
    static_assert(log::attribute::is_supported<std::string>::value,     "`std::string` must be supported");
    static_assert(log::attribute::is_supported<timeval>::value,         "`timeval` must be supported");
}

TEST(Traits, LiteralIsConvertibleToAttribute) {
    static_assert(log::attribute::is_constructible<const char*>::value,
                  "`const char*` must be convertible");
}

TEST(Traits, StringIsConvertibleToAttribute) {
    static_assert(log::attribute::is_constructible<const std::string&>::value,
                  "`const std::string&` must be convertible");
}

TEST(Traits, AnyCharIsImplicitConvertible) {
    static_assert(log::attribute::is_constructible<char>::value,
                  "`char` must be convertible");
    log::attribute_value_t(static_cast<char>(42));

    static_assert(log::attribute::is_constructible<unsigned char>::value,
                  "`unsigned char` must be convertible");
    log::attribute_value_t(static_cast<unsigned char>(42));

    static_assert(log::attribute::is_constructible<const char>::value,
                  "`const char` must be convertible");
    log::attribute_value_t(static_cast<const char>(42));

    static_assert(log::attribute::is_constructible<const unsigned char>::value,
                  "`const unsigned char` must be convertible");
    log::attribute_value_t(static_cast<const unsigned char>(42));
}

TEST(Traits, AnyShortIsImplicitConvertible) {
    static_assert(log::attribute::is_constructible<short>::value,
                  "`short` must be convertible");
    log::attribute_value_t(static_cast<short>(42));

    static_assert(log::attribute::is_constructible<unsigned short>::value,
                  "`unsigned short` must be convertible");
    log::attribute_value_t(static_cast<unsigned short>(42));

    static_assert(log::attribute::is_constructible<const short>::value,
                  "`const short` must be convertible");
    log::attribute_value_t(static_cast<const short>(42));

    static_assert(log::attribute::is_constructible<const unsigned short>::value,
                  "`const unsigned short` must be convertible");
    log::attribute_value_t(static_cast<const unsigned short>(42));
}

TEST(Traits, AnyIntIsImplicitConvertible) {
    static_assert(log::attribute::is_constructible<int>::value,
                  "`int` must be convertible");
    log::attribute_value_t(static_cast<int>(42));

    static_assert(log::attribute::is_constructible<unsigned int>::value,
                  "`unsigned int` must be convertible");
    log::attribute_value_t(static_cast<unsigned int>(42));

    static_assert(log::attribute::is_constructible<const int>::value,
                  "`const int` must be convertible");
    log::attribute_value_t(static_cast<const int>(42));

    static_assert(log::attribute::is_constructible<const unsigned int>::value,
                  "`const unsigned int` must be convertible");
    log::attribute_value_t(static_cast<const unsigned int>(42));
}

TEST(Traits, AnyLongLongIsImplicitConvertible) {
    static_assert(log::attribute::is_constructible<long long>::value,
                  "`long long` must be convertible");
    log::attribute_value_t(static_cast<long long>(42));

    static_assert(log::attribute::is_constructible<unsigned long long>::value,
                  "`unsigned long long` must be convertible");
    log::attribute_value_t(static_cast<unsigned long long>(42));

    static_assert(log::attribute::is_constructible<const long long>::value,
                  "`const long long` must be convertible");
    log::attribute_value_t(static_cast<const long long>(42));

    static_assert(log::attribute::is_constructible<const unsigned long long>::value,
                  "`const unsigned long long` must be convertible");
    log::attribute_value_t(static_cast<const unsigned long long>(42));
}

TEST(Traits, AreSame) {
    static_assert(aux::are_same<int>::value, "`are_same` is broken on zero parameters");
    static_assert(aux::are_same<int, int>::value, "`are_same` is broken on single parameter");
    static_assert(aux::are_same<int, int, int>::value, "`are_same` is broken on multiple parameters");
}

TEST(Traits, AddIndexSimpleTuple) {
    static_assert(
        std::is_same<
            tuple::add_index<
                std::tuple<char>
            >::type,<commit_msg>[Aux] Drop `long long` implicit conversion support, because it isn’t portable.<commit_after>#include <type_traits>

#include <blackhole/attribute.hpp>
#include <blackhole/detail/traits/same.hpp>
#include <blackhole/log.hpp>

#include "global.hpp"

using namespace blackhole;

TEST(Traits, IsSupportedAttributeType) {
    static_assert(log::attribute::is_supported<std::uint8_t>::value,    "`std::uint8_t` must be supported");
    static_assert(log::attribute::is_supported<std::uint32_t>::value,   "`std::uint32_t` must be supported");
    static_assert(log::attribute::is_supported<std::int32_t>::value,    "`std::int32_t` must be supported");
    static_assert(log::attribute::is_supported<std::uint64_t>::value,   "`std::uint64_t` must be supported");
    static_assert(log::attribute::is_supported<std::int64_t>::value,    "`std::int64_t` must be supported");
    static_assert(log::attribute::is_supported<std::double_t>::value,   "`std::double_t` must be supported");
    static_assert(log::attribute::is_supported<std::string>::value,     "`std::string` must be supported");
    static_assert(log::attribute::is_supported<timeval>::value,         "`timeval` must be supported");
}

TEST(Traits, LiteralIsConvertibleToAttribute) {
    static_assert(log::attribute::is_constructible<const char*>::value,
                  "`const char*` must be convertible");
}

TEST(Traits, StringIsConvertibleToAttribute) {
    static_assert(log::attribute::is_constructible<const std::string&>::value,
                  "`const std::string&` must be convertible");
}

TEST(Traits, AnyCharIsImplicitConvertible) {
    static_assert(log::attribute::is_constructible<char>::value,
                  "`char` must be convertible");
    log::attribute_value_t(static_cast<char>(42));

    static_assert(log::attribute::is_constructible<unsigned char>::value,
                  "`unsigned char` must be convertible");
    log::attribute_value_t(static_cast<unsigned char>(42));

    static_assert(log::attribute::is_constructible<const char>::value,
                  "`const char` must be convertible");
    log::attribute_value_t(static_cast<const char>(42));

    static_assert(log::attribute::is_constructible<const unsigned char>::value,
                  "`const unsigned char` must be convertible");
    log::attribute_value_t(static_cast<const unsigned char>(42));
}

TEST(Traits, AnyShortIsImplicitConvertible) {
    static_assert(log::attribute::is_constructible<short>::value,
                  "`short` must be convertible");
    log::attribute_value_t(static_cast<short>(42));

    static_assert(log::attribute::is_constructible<unsigned short>::value,
                  "`unsigned short` must be convertible");
    log::attribute_value_t(static_cast<unsigned short>(42));

    static_assert(log::attribute::is_constructible<const short>::value,
                  "`const short` must be convertible");
    log::attribute_value_t(static_cast<const short>(42));

    static_assert(log::attribute::is_constructible<const unsigned short>::value,
                  "`const unsigned short` must be convertible");
    log::attribute_value_t(static_cast<const unsigned short>(42));
}

TEST(Traits, AnyIntIsImplicitConvertible) {
    static_assert(log::attribute::is_constructible<int>::value,
                  "`int` must be convertible");
    log::attribute_value_t(static_cast<int>(42));

    static_assert(log::attribute::is_constructible<unsigned int>::value,
                  "`unsigned int` must be convertible");
    log::attribute_value_t(static_cast<unsigned int>(42));

    static_assert(log::attribute::is_constructible<const int>::value,
                  "`const int` must be convertible");
    log::attribute_value_t(static_cast<const int>(42));

    static_assert(log::attribute::is_constructible<const unsigned int>::value,
                  "`const unsigned int` must be convertible");
    log::attribute_value_t(static_cast<const unsigned int>(42));
}

TEST(Traits, AreSame) {
    static_assert(aux::are_same<int>::value, "`are_same` is broken on zero parameters");
    static_assert(aux::are_same<int, int>::value, "`are_same` is broken on single parameter");
    static_assert(aux::are_same<int, int, int>::value, "`are_same` is broken on multiple parameters");
}

TEST(Traits, AddIndexSimpleTuple) {
    static_assert(
        std::is_same<
            tuple::add_index<
                std::tuple<char>
            >::type,
{'fraction_non_alphanumeric': 0.14037626628075253, 'fraction_numerical': 0.009510026876162911, 'mean_word_length': 4.842391304347826, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4707542', 'n_tokens_mistral': 2935, 'n_tokens_neox': 2774, 'n_words': 499}