<commit_before>//
// common SIMD type tests
//
// following macros are expected to be defined
// SIMD_TYPE -- name of the SIMD type as a string
// SIMD_TEST_TAG -- catch tests tag(s) as a string
// SIMD_WIDTH -- expected W
// SIMD_LOAD_AF -- expression that extracts vector_t from bufAF
// SIMD_LOAD_AU -- expression that extracts vector_t from bufAU
// SIMD_LOAD_AS -- expression that extracts vector_t from bufAS
//

TEST_CASE(SIMD_TYPE " basic guarantees", SIMD_TEST_TAG) {
    REQUIRE(F::W == SIMD_WIDTH);
    REQUIRE(U::W == SIMD_WIDTH);
    REQUIRE(S::W == SIMD_WIDTH);
    REQUIRE((std::is_same<F::scalar_t, float>::value));
    REQUIRE((std::is_same<U::scalar_t, uint32_t>::value));
    REQUIRE((std::is_same<S::scalar_t, int32_t>::value));
    REQUIRE(sizeof(F) == sizeof(F::vector_t));
    REQUIRE(sizeof(U) == sizeof(U::vector_t));
    REQUIRE(sizeof(S) == sizeof(S::vector_t));
    REQUIRE(alignof(F) == alignof(F::vector_t));
    REQUIRE(alignof(U) == alignof(U::vector_t));
    REQUIRE(alignof(S) == alignof(S::vector_t));
    REQUIRE(sizeof(F::scalar_t) * F::W == sizeof(F));
    REQUIRE(sizeof(U::scalar_t) * U::W == sizeof(U));
    REQUIRE(sizeof(S::scalar_t) * S::W == sizeof(S));
    REQUIRE((std::is_trivially_copyable<F>::value));
    REQUIRE((std::is_trivially_copyable<U>::value));
    REQUIRE((std::is_trivially_copyable<S>::value));
}

TEST_CASE(SIMD_TYPE " explicit construction", SIMD_TEST_TAG) {
    simd::storage<F> rf = bufZF;
    simd::storage<U> ru = bufZU;
    simd::storage<S> rs = bufZS;

    auto tor = [&rf, &ru, &rs](const F& tf, const U& tu, const S& ts) {
        rf = tf; ru = tu; rs = ts;
    };

    SECTION("from scalar_t") {<commit_msg>Require presence of first_element method in tests<commit_after>//
// common SIMD type tests
//
// following macros are expected to be defined
// SIMD_TYPE -- name of the SIMD type as a string
// SIMD_TEST_TAG -- catch tests tag(s) as a string
// SIMD_WIDTH -- expected W
// SIMD_LOAD_AF -- expression that extracts vector_t from bufAF
// SIMD_LOAD_AU -- expression that extracts vector_t from bufAU
// SIMD_LOAD_AS -- expression that extracts vector_t from bufAS
//

TEST_CASE(SIMD_TYPE " basic guarantees", SIMD_TEST_TAG) {
    REQUIRE(F::W == SIMD_WIDTH);
    REQUIRE(U::W == SIMD_WIDTH);
    REQUIRE(S::W == SIMD_WIDTH);
    REQUIRE((std::is_same<F::scalar_t, float>::value));
    REQUIRE((std::is_same<U::scalar_t, uint32_t>::value));
    REQUIRE((std::is_same<S::scalar_t, int32_t>::value));
    REQUIRE(sizeof(F) == sizeof(F::vector_t));
    REQUIRE(sizeof(U) == sizeof(U::vector_t));
    REQUIRE(sizeof(S) == sizeof(S::vector_t));
    REQUIRE(alignof(F) == alignof(F::vector_t));
    REQUIRE(alignof(U) == alignof(U::vector_t));
    REQUIRE(alignof(S) == alignof(S::vector_t));
    REQUIRE(sizeof(F::scalar_t) * F::W == sizeof(F));
    REQUIRE(sizeof(U::scalar_t) * U::W == sizeof(U));
    REQUIRE(sizeof(S::scalar_t) * S::W == sizeof(S));
    REQUIRE((std::is_trivially_copyable<F>::value));
    REQUIRE((std::is_trivially_copyable<U>::value));
    REQUIRE((std::is_trivially_copyable<S>::value));
    REQUIRE((std::is_same<decltype(std::declval<F>().first_element()), F::scalar_t>::value));
    REQUIRE((std::is_same<decltype(std::declval<U>().first_element()), U::scalar_t>::value));
    REQUIRE((std::is_same<decltype(std::declval<S>().first_element()), S::scalar_t>::value));
}

TEST_CASE(SIMD_TYPE " explicit construction", SIMD_TEST_TAG) {
    simd::storage<F> rf = bufZF;
    simd::storage<U> ru = bufZU;
    simd::storage<S> rs = bufZS;

    auto tor = [&rf, &ru, &rs](const F& tf, const U& tu, const S& ts) {
        rf = tf; ru = tu; rs = ts;
    };

    SECTION("from scalar_t") {
{'fraction_non_alphanumeric': 0.18505434782608696, 'fraction_numerical': 0.002173913043478261, 'mean_word_length': 4.628440366972477, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '86048', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1405, 'n_words': 264}