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

#include "rapidcheck/newgen/Exec.h"

#include "util/Predictable.h"
#include "util/GenUtils.h"

using namespace rc;
using namespace rc::newgen::detail;
using namespace rc::test;

TEST_CASE("newgen::exec") {
    prop("yields the same result as execRaw but without recipe",
         [](const GenParams &params) {
             using Tuple = std::tuple<int, int, int>;

             const auto callable = [](const FixedCountdown<2> &a) {
                 return std::make_tuple(
                     a.value,
                     *genFixedCountdown(2),
                     *genFixedCountdown(2));
             };

             const auto expected = newgen::map(
                 execRaw(callable), [](const std::pair<Tuple, Recipe> &p) {
                     return p.first;
                 })(params.random, params.size);

             const auto actual = newgen::exec(callable)(params.random,
                                                        params.size);

             RC_ASSERT(actual == expected);
         });

    SECTION("works with non-copyable types") {
        auto shrinkable = newgen::exec([=](NonCopyable nc) {
            return std::move(nc);
        })(Random(), 0);
        REQUIRE(isArbitraryPredictable(shrinkable.value()));
    }
}
<commit_msg>Move ExecTests to new framework<commit_after>#include <catch.hpp>
#include <rapidcheck-catch.h>

#include "rapidcheck/newgen/Exec.h"

#include "util/Predictable.h"
#include "util/GenUtils.h"

using namespace rc;
using namespace rc::newgen::detail;
using namespace rc::test;

TEST_CASE("newgen::exec") {
    newprop(
        "yields the same result as execRaw but without recipe",
        [](const GenParams &params) {
            using Tuple = std::tuple<int, int, int>;

            const auto callable = [](const FixedCountdown<2> &a) {
                return std::make_tuple(
                    a.value,
                    *genFixedCountdown(2),
                    *genFixedCountdown(2));
            };

            const auto expected = newgen::map(
                execRaw(callable), [](const std::pair<Tuple, Recipe> &p) {
                    return p.first;
                })(params.random, params.size);

            const auto actual = newgen::exec(callable)(params.random,
                                                       params.size);

            RC_ASSERT(actual == expected);
        });

    SECTION("works with non-copyable types") {
        auto shrinkable = newgen::exec([=](NonCopyable nc) {
            return std::move(nc);
        })(Random(), 0);
        REQUIRE(isArbitraryPredictable(shrinkable.value()));
    }
}

{'fraction_non_alphanumeric': 0.12881608339538347, 'fraction_numerical': 0.0029784065524944155, 'mean_word_length': 1.9334061135371179, 'pattern_counts': {'":': 0, '<': 13, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '632127', 'n_tokens_mistral': 784, 'n_tokens_neox': 745, 'n_words': 167}