<commit_before>#include <catch.hpp>
#include <rapidcheck-catch.h>

#include "rapidcheck/detail/RandomEngine.h"

using namespace rc;
using namespace rc::detail;

#define ENOUGH 10000

TEST_CASE("RandomEngine") {
    SECTION("nextAtom") {
        prop("same seeds yields same sequences of numbers",
             [] (RandomEngine::Seed seed) {
                 RandomEngine r1(seed);
                 RandomEngine r2(seed);
                 for (int i = 0; i < ENOUGH; i++)
                     RC_ASSERT(r1.nextAtom() == r2.nextAtom());
             });

        prop("a copy of a randomEngine yields the same sequences of numbers as"
             " the original",
             [] (RandomEngine::Seed seed) {
                 RandomEngine r1(seed);
                 RandomEngine r2(r1);
                 for (int i = 0; i < ENOUGH; i++)
                     RC_ASSERT(r1.nextAtom() == r2.nextAtom());
             });

        prop("different seeds yields different sequences of numbers",
             [] {
                 auto s1 = *gen::arbitrary<RandomEngine::Seed>();
                 auto s2 = *gen::distinctFrom(s1);

                 RandomEngine r1(s1);
                 RandomEngine r2(s2);
                 std::vector<RandomEngine::Atom> atoms1;
                 std::vector<RandomEngine::Atom> atoms2;
                 for (int i = 0; i < ENOUGH; i++) {
                     atoms1.push_back(r1.nextAtom());
                     atoms2.push_back(r2.nextAtom());
                 }

                 RC_ASSERT(atoms1 != atoms2);
             });
    }
}
<commit_msg>Move RandomEngineTests to new framework<commit_after>#include <catch.hpp>
#include <rapidcheck-catch.h>

#include "rapidcheck/detail/RandomEngine.h"

using namespace rc;
using namespace rc::detail;

#define ENOUGH 10000

TEST_CASE("RandomEngine") {
    SECTION("nextAtom") {
        newprop(
            "same seeds yields same sequences of numbers",
            [] (RandomEngine::Seed seed) {
                RandomEngine r1(seed);
                RandomEngine r2(seed);
                for (int i = 0; i < ENOUGH; i++)
                    RC_ASSERT(r1.nextAtom() == r2.nextAtom());
            });

        newprop(
            "a copy of a randomEngine yields the same sequences of numbers as"
            " the original",
            [] (RandomEngine::Seed seed) {
                RandomEngine r1(seed);
                RandomEngine r2(r1);
                for (int i = 0; i < ENOUGH; i++)
                    RC_ASSERT(r1.nextAtom() == r2.nextAtom());
            });

        newprop(
            "different seeds yields different sequences of numbers",
            [] {
                auto s1 = *newgen::arbitrary<RandomEngine::Seed>();
                auto s2 = *newgen::distinctFrom(s1);

                RandomEngine r1(s1);
                RandomEngine r2(s2);
                std::vector<RandomEngine::Atom> atoms1;
                std::vector<RandomEngine::Atom> atoms2;
                for (int i = 0; i < ENOUGH; i++) {
                    atoms1.push_back(r1.nextAtom());
                    atoms2.push_back(r2.nextAtom());
                }

                RC_ASSERT(atoms1 != atoms2);
            });
    }
}

{'fraction_non_alphanumeric': 0.11977542108546475, 'fraction_numerical': 0.019962570180910792, 'mean_word_length': 1.586290322580645, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 13, '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': '5695974', 'n_tokens_mistral': 956, 'n_tokens_neox': 892, 'n_words': 207}