remove catch

This commit is contained in:
2025-02-17 14:32:56 +03:00
parent 78ddb76a49
commit 9bf9ffc6af
5 changed files with 0 additions and 109 deletions

View File

@@ -35,4 +35,3 @@ deps = [
subdir('src') subdir('src')
subdir('bin') subdir('bin')
subdir('tests')

View File

@@ -1,11 +0,0 @@
[wrap-file]
directory = Catch2-3.7.1
source_url = https://github.com/catchorg/Catch2/archive/v3.7.1.tar.gz
source_filename = Catch2-3.7.1.tar.gz
source_hash = c991b247a1a0d7bb9c39aa35faf0fe9e19764213f28ffba3109388e62ee0269c
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/catch2_3.7.1-1/Catch2-3.7.1.tar.gz
wrapdb_version = 3.7.1-1
[provide]
catch2 = catch2_dep
catch2-with-main = catch2_with_main_dep

View File

@@ -1,6 +0,0 @@
catch2_with_main_dep = dependency('catch2-with-main')
dep = [hack_dep, catch2_with_main_dep]
test('patterns', executable('patterns', ['patterns/ring_buffer.cpp'], dependencies : dep))
test('mt', executable('mt', ['mt/mt.cpp'], dependencies : dep))

View File

@@ -1,31 +0,0 @@
#include "catch2/catch_test_macros.hpp"
#include <forward_list>
#include "hack/mt/algorithms/max.hpp"
#include "hack/mt/algorithms/sort.hpp"
TEST_CASE("mt")
{
SECTION("max")
{
int a = 4, b = 5;
int& c = a;
REQUIRE(hack::mt::algorithms::max(4, 5) == 5);
REQUIRE(hack::mt::algorithms::max(c, b) == 5);
}
SECTION("sort")
{
std::vector<int> v { 4, 4, 6, 1, 4, 3, 2 };
std::vector<int> vs { 1, 2, 3, 4, 4, 4, 6 };
std::forward_list<int> l { 8, 7, 5, 9, 0, 1, 3, 2, 6, 4 };
std::forward_list<int> ls { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
hack::mt::algorithms::sort(v);
hack::mt::algorithms::sort(l);
REQUIRE(v == vs);
REQUIRE(l == ls);
}
}

View File

@@ -1,60 +0,0 @@
#include "catch2/catch_test_macros.hpp"
#include "hack/patterns/ring_buffer.hpp"
TEST_CASE("patterns")
{
SECTION("ring buffer")
{
// single value
hack::patterns::ring_buffer<int> rb1(10);
REQUIRE(rb1.empty() == true);
for (int i = 1; i < 13; ++i) rb1.put(i);
REQUIRE(rb1.empty() == false);
REQUIRE(rb1.size() == 10);
while(!rb1.empty()) REQUIRE(rb1.get().has_value() == true);
REQUIRE(rb1.empty() == true);
REQUIRE(rb1.size() == 0);
rb1.put(123);
rb1.put(23);
rb1.put(3);
REQUIRE(rb1.get().value() == 123);
REQUIRE(rb1.empty() == false);
REQUIRE(rb1.size() == 2);
REQUIRE(rb1.get().value() == 23);
REQUIRE(rb1.empty() == false);
REQUIRE(rb1.size() == 1);
rb1.reset();
REQUIRE(rb1.empty() == true);
REQUIRE(rb1.size() == 0);
REQUIRE(rb1.get().has_value() == false);
// vector value
std::vector<int> v { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
hack::patterns::ring_buffer<int> rb2(10);
REQUIRE(rb2.empty() == true);
rb2.put(v);
REQUIRE(rb2.get().value() == 1);
REQUIRE(rb2.get().value() == 2);
v.emplace_back(17);
rb2.put(v);
REQUIRE(rb2.get().value() == 2);
REQUIRE(rb2.get().value() == 3);
REQUIRE(rb2.get().value() == 4);
REQUIRE(rb2.get().value() == 5);
REQUIRE(rb2.get().value() == 6);
REQUIRE(rb2.get().value() == 7);
REQUIRE(rb2.get().value() == 8);
REQUIRE(rb2.get().value() == 9);
REQUIRE(rb2.get().value() == 10);
REQUIRE(rb2.get().value() == 17);
}
}