<commit_before>#include <exception>
#include <functional>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
#include "TestRunner.h"
#include "xUnitAssert.h"
#include "xUnitMacros.h"

using namespace xUnitpp;

const class
{
public:
    template<typename T0, typename T1>
    void Equal(T0 t0, T1 t1) const
    {
        if (t0 != t1)
        {
            throw xUnitAssert("");
        }
    }

    template<typename T0, typename T1>
    void NotEqual(T0 t0, T1 t1) const
    {
        if (t0 == t1)
        {
            throw xUnitAssert("");
        }
    }

    // DoesNotThrow
    // Throws
    // Fail
    // False
    // True
    // Empty
    // NotEmpty
    // Contains
    // DoesNotContain


} Assert;

FACT(SuccessfulFact)
{
    Assert.Equal(1, 1);
}

FACT(FailingFact)
{
    Assert.Equal(0, 1);
}

void TestingTheory(int x, char y, bool equal)
{
    if (equal)
    {
        Assert.Equal(x, y);
    }
    else
    {
        Assert.NotEqual(x, y);
    }
}

THEORY(TestingTheory, int, char, bool)
{
    auto result = std::vector<std::tuple<int, char, bool>>();
    result.push_back(std::make_tuple(1, (char)1, true));
    result.push_back(std::make_tuple(0, (char)1, false));
    result.push_back(std::make_tuple(0, (char)1, true));
    return result;
}

struct MyFixture
{
    MyFixture()
        : x(0)
        , y(1)
        , match(false)
    {
    }

    int x;
    int y;
    bool match;
};

FACT_FIXTURE(TestFactFixture, MyFixture)
{
    Assert.NotEqual(x, y);
}

SUITE(Special)
{
    FACT(SuiteFact)
    {
        Assert.Equal(0, 1);
    }

    void SuiteTheory(int x, char y)
    {
        Assert.Equal(x, y);
    }

    THEORY(SuiteTheory, int, char)
    {
        auto result = std::vector<std::tuple<int, char>>();
        result.push_back(std::make_tuple(1, (char)1));
        return result;
    }

    FACT_FIXTURE(SuiteFactFixture, MyFixture)
    {
        Assert.Equal(x, y - 1);
    }
}

int main()
{
    xUnitpp::RunAllTests();
}
<commit_msg>half-assing the implementation of the Assert members (half-assing because I'm not testing the results yet)<commit_after>#include <exception>
#include <functional>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
#include "TestRunner.h"
#include "xUnitAssert.h"
#include "xUnitMacros.h"

using namespace xUnitpp;

const class
{
public:
    template<typename T0, typename T1>
    void Equal(T0 t0, T1 t1) const
    {
        if (t0 != t1)
        {
            throw xUnitAssert("");
        }
    }

    template<typename T0, typename T1>
    void NotEqual(T0 t0, T1 t1) const
    {
        if (t0 == t1)
        {
            throw xUnitAssert("");
        }
    }

    template<typename TFunc>
    void DoesNotThrow(TFunc &&fn)
    {
        try
        {
            fn();
        }
        catch (std::exception &e)
        {
            throw xUnitAssert(std::string("Caught std::exception with message: ") + e.what());
        }
        catch (...)
        {
            throw xUnitAssert(std::string("Caught unknown exception (crash) with message: ") + e.what());
        }
    }

    template<typename TException, typename TFunc>
    TException Throws(TFunc &&fn)
    {
        try
        {
            fn();
        }
        catch (TException e)
        {
            return e;
        }
        catch (std::exception &e)
        {
            throw xUnitAssert(std::string("Caught std::exception with message: ") + e.what());
        }
        catch (...)
        {
            throw xUnitAssert(std::string("Caught unknown exception (crash) with message: ") + e.what());
        }

        throw xUnitAssert(std::string("Did not catch any exceptions."));
    }

    void Fail()
    {
        throw xUnitAssert("Fail.");
    }

    void False(bool b)
    {
        if (b)
        {
            throw xUnitAssert("Expected false.");
        }
    }

    void True(bool b)
    {
        if (!b)
        {
            throw xUnitAssert("Expected true.");
        }
    }

    template<typename TContainer>
    void Empty(TContainer container)
    {
        if (!container.empty())
        {
            throw xUnitAssert("Container is not empty.");
        }
    }

    template<typename TContainer>
    void NotEmpty(TContainer container)
    {
        if (container.empty())
        {
            throw xUnitAssert("Container is empty.");
        }
    }

    template<typename TContainer, typename TItem>
    void DoesNotContain(TContainer container, TItem item)
    {
        if (std::find(container.begin(), container.end(), item))
        {
            throw xUnitAssert("Container contains item.");
        }
    }

    template<typename TContainer, typename TItem>
    void Contains(TContainer container, TItem item)
    {
        if (!std::find(container.begin(), container.end(), item))
        {
            throw xUnitAssert("Container does not contain item.");
        }
    }
} Assert;

FACT(SuccessfulFact)
{
    Assert.Equal(1, 1);
}

FACT(FailingFact)
{
    Assert.Equal(0, 1);
}

void TestingTheory(int x, char y, bool equal)
{
    if (equal)
    {
        Assert.Equal(x, y);
    }
    else
    {
        Assert.NotEqual(x, y);
    }
}

THEORY(TestingTheory, int, char, bool)
{
    auto result = std::vector<std::tuple<int, char, bool>>();
    result.push_back(std::make_tuple(1, (char)1, true));
    result.push_back(std::make_tuple(0, (char)1, false));
    result.push_back(std::make_tuple(0, (char)1, true));
    return result;
}

struct MyFixture
{
    MyFixture()
        : x(0)
        , y(1)
        , match(false)
    {
    }

    int x;
    int y;
    bool match;
};

FACT_FIXTURE(TestFactFixture, MyFixture)
{
    Assert.NotEqual(x, y);
}

SUITE(Special)
{
    FACT(SuiteFact)
    {
        Assert.Equal(0, 1);
    }

    void SuiteTheory(int x, char y)
    {
        Assert.Equal(x, y);
    }

    THEORY(SuiteTheory, int, char)
    {
        auto result = std::vector<std::tuple<int, char>>();
        result.push_back(std::make_tuple(1, (char)1));
        return result;
    }

    FACT_FIXTURE(SuiteFactFixture, MyFixture)
    {
        Assert.Equal(x, y - 1);
    }
}

int main()
{
    xUnitpp::RunAllTests();
}

{'fraction_non_alphanumeric': 0.1306486320319705, 'fraction_numerical': 0.010144482016600061, 'mean_word_length': 1.7560355781448538, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '4465109', 'n_tokens_mistral': 2211, 'n_tokens_neox': 2142, 'n_words': 447}