Adding support for windows and fixing some errors

This commit is contained in:
Ilusha 2024-01-15 16:35:16 -08:00 committed by Ilya Shurupov
parent 7660d58f26
commit 420bb37039
84 changed files with 168 additions and 255 deletions

View file

@ -1,15 +1,15 @@
#include "NewPlacement.hpp"
#include "Buffer2D.hpp"
#include "Testing.hpp"
#include "Tests.hpp"
#include "HeapAllocator.hpp"
using namespace tp;
const ualni size = 1000;
TEST_DEF_STATIC(Simple1) {
Buffer2D<int, HeapAlloc> buff;
Buffer2D<int, tp::HeapAlloc> buff;
buff.reserve({ 4, 4 });
buff.set({ 2, 2 }, 5);
TEST(buff.get({ 2, 2 }) == 5);
@ -22,4 +22,4 @@ TEST_DEF_STATIC(Simple2) {
TEST_DEF(Buffer2d) {
testSimple1();
testSimple2();
}
}

View file

@ -1,5 +1,3 @@
#include "NewPlacement.hpp"
#include "Buffer.hpp"
#include "Testing.hpp"
#include "Tests.hpp"
@ -9,7 +7,7 @@ using namespace tp;
const ualni size = 1000;
TEST_DEF_STATIC(Simple1) {
Buffer<TestClass, HeapAlloc> buff;
Buffer<TestClass, tp::HeapAlloc> buff;
TEST(buff.size() == 0);
for (auto i : Range(size * 10)) {
buff.append(TestClass(i));
@ -21,7 +19,7 @@ TEST_DEF_STATIC(Simple1) {
}
TEST_DEF_STATIC(Simple2) {
Buffer<TestClass, HeapAlloc> buff(size);
Buffer<TestClass, tp::HeapAlloc> buff(size);
TEST(buff.size() == size);
for (auto i : Range(size * 10))
buff.append(TestClass(i));
@ -34,4 +32,4 @@ TEST_DEF_STATIC(Simple2) {
TEST_DEF(Buffer) {
testSimple1();
testSimple2();
}
}

View file

@ -1,5 +1,3 @@
#include "NewPlacement.hpp"
#include "Archiver.hpp"
#include "Testing.hpp"
#include "Tests.hpp"
@ -7,7 +5,7 @@
using namespace tp;
TEST_DEF_STATIC(SimpleReference) {
tp::List<TestClass, HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
tp::List<TestClass, tp::HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
list.pushBack(TestClass(5));
list.pushFront(TestClass(0));
@ -24,7 +22,7 @@ TEST_DEF_STATIC(SimpleReference) {
}
TEST_DEF_STATIC(SimplePointer) {
tp::List<TestClass*, HeapAlloc> list = { new TestClass(1), new TestClass(2), new TestClass(3), new TestClass(4) };
tp::List<TestClass*, tp::HeapAlloc> list = { new TestClass(1), new TestClass(2), new TestClass(3), new TestClass(4) };
list.pushBack(new TestClass(5));
list.pushFront(new TestClass(0));
@ -45,8 +43,8 @@ TEST_DEF_STATIC(SimplePointer) {
}
TEST_DEF_STATIC(Copy) {
tp::List<TestClass, HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
tp::List<TestClass, HeapAlloc> list2 = list;
tp::List<TestClass, tp::HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
tp::List<TestClass, tp::HeapAlloc> list2 = list;
TEST_EQUAL(list, list2);
@ -55,7 +53,7 @@ TEST_DEF_STATIC(Copy) {
}
TEST_DEF_STATIC(Serialization) {
tp::List<TestClass, HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
tp::List<TestClass, tp::HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
ArchiverExample<1024, false> write;
ArchiverExample<1024, true> read;
@ -82,4 +80,4 @@ TEST_DEF(List) {
testSimplePointer();
testSimpleReference();
testSerialization();
}
}

View file

@ -1,5 +1,3 @@
#include "NewPlacement.hpp"
#include "Archiver.hpp"
#include "Map.hpp"
#include "Testing.hpp"
@ -8,7 +6,7 @@
using namespace tp;
TEST_DEF_STATIC(SimpleReference) {
tp::Map<tp::ualni, TestClass, HeapAlloc> map;
tp::Map<tp::ualni, TestClass, tp::HeapAlloc> map;
for (auto i : Range(1000, 100000)) {
map.put(i, TestClass(i));
@ -42,7 +40,7 @@ TEST_DEF_STATIC(SimpleReference) {
}
TEST_DEF_STATIC(SimplePointer) {
tp::Map<tp::ualni, TestClass*, HeapAlloc> map;
tp::Map<tp::ualni, TestClass*, tp::HeapAlloc> map;
for (auto i : Range(1000)) {
map.put(i, new TestClass(i));
@ -80,13 +78,13 @@ TEST_DEF_STATIC(SimplePointer) {
}
TEST_DEF_STATIC(Copy) {
tp::Map<tp::ualni, TestClass, HeapAlloc> map;
tp::Map<tp::ualni, TestClass, tp::HeapAlloc> map;
for (auto i : Range(10)) {
map.put(i, TestClass(i));
}
tp::Map<tp::ualni, TestClass, HeapAlloc> map2 = map;
tp::Map<tp::ualni, TestClass, tp::HeapAlloc> map2 = map;
TEST_EQUAL(map, map2);
@ -95,7 +93,7 @@ TEST_DEF_STATIC(Copy) {
}
TEST_DEF_STATIC(SaveLoad) {
tp::Map<tp::ualni, TestClass, HeapAlloc> map;
tp::Map<tp::ualni, TestClass, tp::HeapAlloc> map;
for (auto i : Range(10)) {
map.put(i, TestClass(i));
@ -128,4 +126,4 @@ TEST_DEF(Map) {
testSimplePointer();
testSimpleReference();
testSaveLoad();
}
}

View file

@ -1,5 +1,3 @@
#include "NewPlacement.hpp"
#include "Testing.hpp"
#include "Tests.hpp"
#include "Tree.hpp"
@ -7,7 +5,7 @@
using namespace tp;
TEST_DEF_STATIC(Simple) {
AvlTree<AvlNumericKey<alni>, TestClass, HeapAlloc> tree;
AvlTree<AvlNumericKey<alni>, TestClass, tp::HeapAlloc> tree;
TEST(tree.size() == 0);
TEST(tree.head() == nullptr);
@ -24,7 +22,7 @@ TEST_DEF_STATIC(Simple) {
}
TEST_DEF_STATIC(Persistance) {
AvlTree<AvlNumericKey<alni>, TestClass, HeapAlloc> tree;
AvlTree<AvlNumericKey<alni>, TestClass, tp::HeapAlloc> tree;
const auto size = 1000;
@ -126,4 +124,4 @@ TEST_DEF_STATIC(Persistance) {
TEST_DEF(Avl) {
testSimple();
testPersistance();
}
}