<commit_before>#include "TestCommon.hh" //to get argparser

using namespace SDLut;

Logger testlog("ScreenAccess");

class Assert : public AssertEngine
{
    video::Rect assertedrect;
    video::Color color;
public:
    Assert(Logger& l, ArgParser& ap,video::Rect assertrect, video::Color c)
            : AssertEngine(l,ap), assertedrect(assertrect), color(c)
    {
        if ( ! testlog.isFileLogEnabled() ) testlog.enableFileLog("TestScreenAccess.log");
    }

    bool assertresize(int width, int height)
    {
        if (assertedrect.getx() < 0) assertedrect.resetx(0);
        if (assertedrect.gety() < 0) assertedrect.resety(0);
        if ( (int)(assertedrect.getx() + assertedrect.getw() ) > width ) assertedrect.resetw( width - assertedrect.getx() );
        if ( (int)(assertedrect.gety() + assertedrect.geth() ) > height ) assertedrect.reseth( height - assertedrect.gety() );

        return true;
    }
    bool assertrender(video::ScreenBuffer& sb) const
    {
        bool res = true;
        int x =assertedrect.getx(), y =assertedrect.gety();
        while ( y < (int)assertedrect.geth())
        {
            while ( x < (int)assertedrect.getw() )
            {
                res = res && (sb.getColorAt(x,y) == color);
            }
        }

        return res ;
    }
};

class Test : public TestEngine
{
    video::Rect testedrect;
    video::Color color;
public:

    Test(Logger& l, Assert & a, video::Rect testrect, video::Color c) : TestEngine(l,a), testedrect(testrect),color(c) {}
    bool resize(int width, int height)
    {
        //check rect size
        if (testedrect.getx() < 0) testedrect.resetx(0);
        if (testedrect.gety() < 0) testedrect.resety(0);
        if ( (int)(testedrect.getx() + testedrect.getw()) > width ) testedrect.resetw( width - testedrect.getx() );
        if ( (int)(testedrect.gety() + testedrect.geth()) > height ) testedrect.reseth( height - testedrect.gety() );

        return true;
    }
    bool render(video::ScreenBuffer& sb) const
    {
        if ( (1 == testedrect.geth() ) && ( testedrect.getw() == 1 ) )
        {
            sb.setColorAt( testedrect.getx(),testedrect.gety(),color );
        }
        else<commit_msg>fix for midnight coding syndrome...<commit_after>#include "TestCommon.hh" //to get argparser

using namespace SDLut;

Logger testlog("ScreenAccess");

class Assert : public AssertEngine
{
    video::Rect assertedrect;
    video::Color color;
public:
    Assert(Logger& l, ArgParser& ap,video::Rect assertrect, video::Color c)
            : AssertEngine(l,ap), assertedrect(assertrect), color(c)
    {
        if ( ! testlog.isFileLogEnabled() ) testlog.enableFileLog("TestScreenAccess.log");
    }

    bool assertresize(int width, int height)
    {
        if (assertedrect.getx() < 0) assertedrect.resetx(0);
        if (assertedrect.gety() < 0) assertedrect.resety(0);
        if ( (int)(assertedrect.getx() + assertedrect.getw() ) > width ) assertedrect.resetw( width - assertedrect.getx() );
        if ( (int)(assertedrect.gety() + assertedrect.geth() ) > height ) assertedrect.reseth( height - assertedrect.gety() );

        return true;
    }
    bool assertrender(video::ScreenBuffer& sb) const
    {
        bool res = true;
        unsigned int x =0, y =0;
        while ( y < assertedrect.geth())
        {
            while ( x < assertedrect.getw())
            {
                res = res && (sb.getColorAt(x + assertedrect.getx(),y + assertedrect.gety()) == color);
                x++;
            }
            y++;
        }

        return res ;
    }
};

class Test : public TestEngine
{
    video::Rect testedrect;
    video::Color color;
public:

    Test(Logger& l, Assert & a, video::Rect testrect, video::Color c) : TestEngine(l,a), testedrect(testrect),color(c) {}
    bool resize(int width, int height)
    {
        //check rect size
        if (testedrect.getx() < 0) testedrect.resetx(0);
        if (testedrect.gety() < 0) testedrect.resety(0);
        if ( (int)(testedrect.getx() + testedrect.getw()) > width ) testedrect.resetw( width - testedrect.getx() );
        if ( (int)(testedrect.gety() + testedrect.geth()) > height ) testedrect.reseth( height - testedrect.gety() );

        return true;
    }
    bool render(video::ScreenBuffer& sb) const
    {
        if ( (1 == testedrect.geth() ) && ( testedrect.getw() == 1 ) )
        {
            sb.setColorAt( testedrect.getx(),testedrect.gety(),color );
        }
        else
{'fraction_non_alphanumeric': 0.14742729306487695, 'fraction_numerical': 0.004921700223713647, 'mean_word_length': 2.565390749601276, 'pattern_counts': {'":': 0, '<': 15, '<?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': '5083648', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1403, 'n_words': 304}