#include "basic/basic.h"
#include "basic/basic.cpp"

void Test() {
    // Basic constructors
    {
        String a = "thing";
        String b("thing");
        Assert(a == b);
        String c = {};
        Assert(c.len == 0 && c.data == NULL);
        Assert(a != c);
    }

    // Accessors
    {
        String a = "thing";
        Assert(Skip(a, 1) == "hing");
        Assert(Chop(a, 1) == "thin");
        Assert(GetPrefix(a, 1) == "t");
        Assert(GetPostfix(a, 1) == "g");
        Assert(GetSlice(a, 0) == "thing");
        Assert(GetSlice(a, 0, -1) == "thin");
        Assert(GetSlice(a, 1, -1) == "hin");
        Assert(GetSlice(a, -2, -1) == "n");
    }

    {
        Scratch scratch;
        String16 a = Format16(scratch, "Memes %d", 30);
        Assert(a == u"Memes 30");
    }
    {
        Vec2 a = {1,1};
        Vec2 b = 2 + a;
    }

}

int main() {
    Scratch scratch;
    String data = ReadFile(scratch, "../data/init.lua");
    Array<String> array = {scratch};

    Add(&array, String{"String BaseLuaConfig = R\"==(\n"});
    Add(&array, data);
    Add(&array, String{"\n)==\";\n"});
    String result = Merge(scratch, array, "");
    WriteFile("../src/text_editor/generated_config.cpp", result);
}