<commit_before>#include <gtest/gtest.h>

#include <MakeReseedable.h>
#include <ModuleFactories.h>
#include <NoiseMap.h>

class TestTileGenerationPlan : public ::testing::Test {
protected:
    Reseedable x;
    Reseedable y;
    TestTileGenerationPlan() :
        x(makeX()),
        y(makeY())
    {
    };
    ~TestTileGenerationPlan() {};
};

TEST_F(TestTileGenerationPlan, TestTileGenerationPlan)
{
    sf::Image output;
    output.create(256, 256);

    NoiseMapBase::Bounds xy(0, 0, 1, 1);
    NoiseMapBase::Bounds xy_(0, -1, 1, 1);
    NoiseMapBase::Bounds x_y(-1, 0, 1, 1);
    NoiseMapBase::Bounds x_y_(-1, -1, 1, 1);

    NoiseMapImage nmixy(output, xy);
    NoiseMapImage nmixy_(output, xy_);
    NoiseMapImage nmix_y(output, x_y);
    NoiseMapImage nmix_y_(output, x_y_);

    auto write_map = [&](const Reseedable module,
                        std::string filename,
                        NoiseMapImage& nmi)
    {
        nmi.build(*module.module);
        output.saveToFile("test/"+filename+".png");
    };

    write_map(x, "x", nmixy);
    write_map(x, "x_", nmix_y);
    write_map(y, "y", nmixy);
    write_map(y, "y_", nmixy_);
    
    Reseedable stochastic = makePlaceholder(259738);
    Reseedable border_x = makePlaceholder(5204790);
    Reseedable border_y = makePlaceholder(923784);

    write_map(stochastic, "stochastic", nmixy);
    write_map(border_x, "border_x", nmixy);
    write_map(border_x, "border_x_", nmix_y);
    write_map(border_y, "border_y", nmixy);
    write_map(border_y, "border_y_", nmixy_);

    Reseedable msb_x = makeLinearMovingScaleBias(y, true, 0.8, 0.3);
    Reseedable msb_y = makeLinearMovingScaleBias(x, false, 0.8, 0.3);
    write_map(msb_x, "msb_x", nmixy);
    write_map(msb_y, "msb_y", nmixy);

    Reseedable msb_bx = makeLinearMovingScaleBias(border_x, true, 0.8, 0.3);
    Reseedable msb_by = makeLinearMovingScaleBias(border_y, false, 0.8, 0.3);
    write_map(msb_bx, "msb_bx", nmixy);
    write_map(msb_bx, "msb_bx_", nmix_y);
    write_map(msb_by, "msb_by", nmixy);
    write_map(msb_by, "msb_by_", nmixy_);

}<commit_msg>Extend TestTileGenerationPlan<commit_after>#include <gtest/gtest.h>

#include <MakeReseedable.h>
#include <ModuleFactories.h>
#include <NoiseMap.h>

class TestTileGenerationPlan : public ::testing::Test {
protected:
    Reseedable x;
    Reseedable y;
    Reseedable c0;
    Reseedable c1;
    TestTileGenerationPlan() :
        x(makeX()),
        y(makeY()),
        c0(makeConst(0)),
        c1(makeConst(1))
    {
    };
    ~TestTileGenerationPlan() {};
};

TEST_F(TestTileGenerationPlan, TestTileGenerationPlan)
{
    sf::Image output;
    output.create(256, 256);

    NoiseMapBase::Bounds xy(0, 0, 1, 1);
    NoiseMapBase::Bounds xy_(0, -1, 1, 1);
    NoiseMapBase::Bounds x_y(-1, 0, 1, 1);
    NoiseMapBase::Bounds x_y_(-1, -1, 1, 1);

    NoiseMapImage nmixy(output, xy);
    NoiseMapImage nmixy_(output, xy_);
    NoiseMapImage nmix_y(output, x_y);
    NoiseMapImage nmix_y_(output, x_y_);

    auto write_map = [&](const Reseedable module,
                        std::string filename,
                        NoiseMapImage& nmi)
    {
        nmi.build(*module.module);
        output.saveToFile("test/"+filename+".png");
    };

    //write_map(x, "x", nmixy);
    //write_map(x, "x_", nmix_y);
    //write_map(y, "y", nmixy);
    //write_map(y, "y_", nmixy_);

    //Reseedable msb_max_x = makeLinearMovingScaleBias(c1, true, 0.8, 0.3);
    //Reseedable msb_max_y = makeLinearMovingScaleBias(c1, false, 0.8, 0.3);
    //Reseedable msb_min_x = makeLinearMovingScaleBias(-c1, true, 0.8, 0.3);
    //Reseedable msb_min_y = makeLinearMovingScaleBias(-c1, false, 0.8, 0.3);

    //write_map(msb_max_x, "msb_max_x", nmixy);
    //write_map(msb_max_y, "msb_max_y", nmixy);
    //write_map(msb_min_x, "msb_min_x", nmixy);
    //write_map(msb_min_y, "msb_min_y", nmixy);

    Reseedable cc = makeCornerCombiner(true, true);
    //write_map(cc, "ccxy", nmixy);
    //write_map(cc, "ccxy_", nmixy_);
    //write_map(cc, "ccx_y", nmix_y);
    //write_map(cc, "ccx_y_", nmix_y_);
    
    // this corner's weight in the tile centre
    Reseedable stochastic = makePlaceholder(259738);
    // this corner's weight along its adjacent horizontal border
    Reseedable border_x = makePlaceholder(5204790);
    // this corner's weight along its adjacent vertical border
    Reseedable border_y = makePlaceholder(923784);

    write_map(stochastic, "stochastic", nmixy);
    write_map(border_x, "borderx_y", nmixy);
    write_map(border_x, "borderx_y_", nmixy_);
    write_map(border_y, "bordery_x", nmixy);
    write_map(border_y, "bordery_x_", nmix_y);

    Reseedable msb_bx = makeLinearMovingScaleBias(border_x, true, 0.8, 0.3);
    Reseedable msb_by = makeLinearMovingScaleBias(border_y, false, 0.8, 0.3);
    write_map(msb_bx, "msb_bx", nmixy);
    write_map(msb_bx, "msb_bx_", nmix_y);
    write_map(msb_by, "msb_by", nmixy);
    write_map(msb_by, "msb_by_", nmixy_);

    Reseedable deterministic = cc.blend(msb_by, msb_bx);
    write_map(deterministic, "deterministic", nmixy);

    Reseedable ef = makeEdgeFavouringMask(2.5, 1.5);
    write_map(ef, "ef", nmixy);
}
{'fraction_non_alphanumeric': 0.14557084706338438, 'fraction_numerical': 0.02636169800348905, 'mean_word_length': 3.5948352626892253, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1546430', 'n_tokens_mistral': 2181, 'n_tokens_neox': 2048, 'n_words': 374}