<commit_before>#include "gtest/gtest.h"
#define AUTOMATIC_CONVERSIONS
#include <FileMgr.h>
#include <file/file.h>
#include <MemoryMgr.h>
#include <WindowMgr.h>

using namespace Executor;

QDGlobals qd;
#include <quickdraw/cquick.h>
#include <vdriver/vdriver.h>
#include <ResourceMgr.h>

class MockVDriver : public VideoDriver
{
    virtual void setColors(int first_color, int num_colors,
                               const struct ColorSpec *color_array) override
    {

    }

    virtual bool setMode(int width, int height, int bpp,
                                bool grayscale_p) override
    {
        width_ = 512;
        height_ = 342;
        rowBytes_ = 64;
        framebuffer_ = new uint8_t[64*342];
        bpp_ = 1;
        return true;
    }
};

class ExecutorTestEnvironment : public testing::Environment
{
    char *thingOnStack;
    fs::path tempDir;
public:
    ExecutorTestEnvironment(char* thingOnStack) : thingOnStack(thingOnStack) {}

    virtual void SetUp() override
    {
        tempDir = fs::current_path() / fs::unique_path("temptest-%%%%-%%%%-%%%%-%%%%");

        Executor::InitMemory(thingOnStack);
        Executor::ROMlib_fileinit();

        fs::create_directory(tempDir);

        if(auto fsspec = nativePathToFSSpec(tempDir))
        {
            WDPBRec wdpb;

            wdpb.ioVRefNum = fsspec->vRefNum;
            wdpb.ioWDDirID = fsspec->parID;
            wdpb.ioWDProcID = FOURCC('X', 'c', 't', 'r');
            wdpb.ioNamePtr = fsspec->name;
            PBOpenWD(&wdpb, false);
            SetVol(nullptr, wdpb.ioVRefNum);
        }

        vdriver = new MockVDriver();
        initialize_68k_emulator(nullptr, false, (uint32_t *)SYN68K_TO_US(0), 0);
        
        LM(ResErrProc) = 0;
        InitResources();
        ROMlib_InitGDevices();
        LM(TheZone) = LM(ApplZone);

        ROMlib_color_init();

        InitGraf((Ptr)&qd.thePort);
    }<commit_msg>tests: initialize more of executor (needed for list mgr tests)<commit_after>#include "gtest/gtest.h"
#define AUTOMATIC_CONVERSIONS
#include <FileMgr.h>
#include <file/file.h>
#include <MemoryMgr.h>
#include <WindowMgr.h>
#include <MenuMgr.h>
#include <FontMgr.h>

using namespace Executor;

QDGlobals qd;
#include <quickdraw/cquick.h>
#include <vdriver/vdriver.h>
#include <ResourceMgr.h>

class MockVDriver : public VideoDriver
{
    virtual void setColors(int first_color, int num_colors,
                               const struct ColorSpec *color_array) override
    {

    }

    virtual bool setMode(int width, int height, int bpp,
                                bool grayscale_p) override
    {
        width_ = 512;
        height_ = 342;
        rowBytes_ = 64;
        framebuffer_ = new uint8_t[64*342];
        bpp_ = 1;
        return true;
    }
};

class ExecutorTestEnvironment : public testing::Environment
{
    char *thingOnStack;
    fs::path tempDir;
public:
    ExecutorTestEnvironment(char* thingOnStack) : thingOnStack(thingOnStack) {}

    virtual void SetUp() override
    {
        tempDir = fs::current_path() / fs::unique_path("temptest-%%%%-%%%%-%%%%-%%%%");

        Executor::InitMemory(thingOnStack);
        Executor::ROMlib_fileinit();

        fs::create_directory(tempDir);

        if(auto fsspec = nativePathToFSSpec(tempDir))
        {
            WDPBRec wdpb;

            wdpb.ioVRefNum = fsspec->vRefNum;
            wdpb.ioWDDirID = fsspec->parID;
            wdpb.ioWDProcID = FOURCC('X', 'c', 't', 'r');
            wdpb.ioNamePtr = fsspec->name;
            PBOpenWD(&wdpb, false);
            SetVol(nullptr, wdpb.ioVRefNum);
        }

        vdriver = new MockVDriver();
        initialize_68k_emulator(nullptr, false, (uint32_t *)SYN68K_TO_US(0), 0);
        traps::init(false);

        LM(ResErrProc) = 0;
        InitResources();
        ROMlib_InitGDevices();
        LM(TheZone) = LM(ApplZone);

        ROMlib_color_init();
        LM(WindowList) = nullptr;
        LM(MenuList) = nullptr;
        LM(MBDFHndl) = nullptr;
        LM(MBSaveLoc) = nullptr;
        EM_A5 = EM_A7 = ptr_to_longint(LM(MemTop)-4);
        InitGraf((Ptr)&qd.thePort);
        InitFonts();
        InitWindows();
        InitMenus();
    }
{'fraction_non_alphanumeric': 0.12333015267175572, 'fraction_numerical': 0.012166030534351144, 'mean_word_length': 2.428454619787408, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, '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': '627075', 'n_tokens_mistral': 1474, 'n_tokens_neox': 1407, 'n_words': 268}