Kajetan Johannes Hammerle 2 ماه پیش
والد
کامیت
b861181283

+ 0 - 1
CMakeLists.txt

@@ -114,7 +114,6 @@ target_sources(core PUBLIC
         ./include/core/BitArray.hpp
         ./include/core/Box.hpp
         ./include/core/Buffer.hpp
-        ./include/core/Check.hpp
         ./include/core/Clock.hpp
         ./include/core/Color.hpp
         ./include/core/Components.hpp

+ 2 - 2
include/core/ArrayList.hpp

@@ -20,7 +20,7 @@ namespace Core {
             copy(other);
         }
 
-        ArrayList(ArrayList&& other) : ArrayList() {
+        ArrayList(ArrayList&& other) noexcept : ArrayList() {
             move(Core::move(other));
             other.clear();
         }
@@ -37,7 +37,7 @@ namespace Core {
             return *this;
         }
 
-        ArrayList& operator=(ArrayList&& other) {
+        ArrayList& operator=(ArrayList&& other) noexcept {
             if(&other != this) {
                 clear();
                 move(Core::move(other));

+ 2 - 2
include/core/BitArray.hpp

@@ -12,9 +12,9 @@ namespace Core {
     public:
         BitArray();
         BitArray(const BitArray& other);
-        BitArray(BitArray&& other);
+        BitArray(BitArray&& other) noexcept;
         ~BitArray();
-        BitArray& operator=(BitArray other);
+        BitArray& operator=(BitArray other) noexcept;
 
         BitArray& set(size_t index, u64 value);
         u64 get(size_t index) const;

+ 1 - 1
include/core/Buffer.hpp

@@ -27,7 +27,7 @@ namespace Core {
         size_t getLength() const;
         const char* getData() const;
         void clear();
-        void swap(Buffer& other);
+        void swap(Buffer& other) noexcept;
     };
 }
 

+ 0 - 19
include/core/Check.hpp

@@ -1,19 +0,0 @@
-#ifndef CORE_CHECK_HPP
-#define CORE_CHECK_HPP
-
-#if defined(__GNUC__)
-#define check_format(format_index, arg_start_index)                \
-    __attribute__((format(printf, format_index, arg_start_index)))
-#else
-#error "please add a 'check_format' option"
-#endif
-
-#if defined(__GNUC__)
-#define likely(x) __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
-#else
-#define likely(x) x
-#define unlikely(x) x
-#endif
-
-#endif

+ 3 - 3
include/core/HashMap.hpp

@@ -157,7 +157,7 @@ namespace Core {
             }
         }
 
-        HashMap(HashMap&& other) {
+        HashMap(HashMap&& other) noexcept {
             swap(other);
         }
 
@@ -176,7 +176,7 @@ namespace Core {
             coreDeleteN(reinterpret_cast<AlignedType<V>*>(values));
         }
 
-        HashMap& operator=(HashMap other) {
+        HashMap& operator=(HashMap other) noexcept {
             swap(other);
             return *this;
         }
@@ -320,7 +320,7 @@ namespace Core {
             return {keys.end(), keys.end(), nullptr, invalidSet};
         }
 
-        void swap(HashMap& o) {
+        void swap(HashMap& o) noexcept {
             Core::swap(o.keys, keys);
             Core::swap(o.values, values);
             Core::swap(o.jumps, jumps);

+ 1 - 1
include/core/HashedString.hpp

@@ -24,7 +24,7 @@ namespace Core {
         char data[N];
 
     public:
-        HashedString() : hash(), data({}) {
+        HashedString() : hash(), data{} {
         }
 
         HashedString(const char* s) : hash(hashString(s)) {

+ 3 - 3
include/core/List.hpp

@@ -28,7 +28,7 @@ namespace Core {
             }
         }
 
-        List(List&& other) : List() {
+        List(List&& other) noexcept : List() {
             swap(other);
         }
 
@@ -37,7 +37,7 @@ namespace Core {
             delete[] reinterpret_cast<AlignedType<T>*>(data);
         }
 
-        List& operator=(List other) {
+        List& operator=(List other) noexcept {
             swap(other);
             return *this;
         }
@@ -171,7 +171,7 @@ namespace Core {
             removeBySwap(length - 1);
         }
 
-        void swap(List& other) {
+        void swap(List& other) noexcept {
             Core::swap(length, other.length);
             Core::swap(capacity, other.capacity);
             Core::swap(data, other.data);

+ 1 - 1
include/core/Meta.hpp

@@ -83,7 +83,7 @@ namespace Core {
     }
 
     template<typename T>
-    void swap(T& a, T& b) {
+    void swap(T& a, T& b) noexcept {
         T tmp = Core::move(a);
         a = Core::move(b);
         b = Core::move(tmp);

+ 2 - 2
include/core/Thread.hpp

@@ -33,10 +33,10 @@ namespace Core {
 
         Thread();
         Thread(const Thread& other) = delete;
-        Thread(Thread&& other);
+        Thread(Thread&& other) noexcept;
         ~Thread();
         Thread& operator=(const Thread& other) = delete;
-        Thread& operator=(Thread&& other);
+        Thread& operator=(Thread&& other) noexcept;
         void swap(Thread& other);
         bool start(Function f, void* p);
         bool join();

+ 2 - 2
include/core/UniquePointer.hpp

@@ -20,11 +20,11 @@ namespace Core {
         UniquePointer(const UniquePointer&) = delete;
         UniquePointer& operator=(const UniquePointer&) = delete;
 
-        UniquePointer(UniquePointer&& other) : UniquePointer(other.t) {
+        UniquePointer(UniquePointer&& other) noexcept : UniquePointer(other.t) {
             other.t = nullptr;
         }
 
-        UniquePointer& operator=(UniquePointer&& other) {
+        UniquePointer& operator=(UniquePointer&& other) noexcept {
             if(this != &other) {
                 delete t;
                 t = other.t;

+ 0 - 206
old/ArrayString.cpp

@@ -1,206 +0,0 @@
-#include "core/utils/ArrayString.hpp"
-
-#include <limits.h>
-#include <stdlib.h>
-#include <uchar.h>
-
-#include "core/data/Array.hpp"
-#include "core/math/Math.hpp"
-#include "core/utils/Error.hpp"
-#include "core/utils/Utility.hpp"
-
-using BufferString = Core::BufferString;
-using Error = Core::Error;
-
-constexpr size_t stringLength(const c32* c) {
-    const c32* i = c + 1;
-    while(*(c++) != '\0') {}
-    return static_cast<size_t>(c - i);
-}
-
-using C32Buffer = Core::Array<char, MB_LEN_MAX + 1>;
-
-static C32Buffer convertC32(c32 c) {
-    C32Buffer buffer;
-    size_t n = c32rtomb(buffer.begin(), c, nullptr);
-    if(n >= buffer.getLength()) {
-        buffer[0] = '?';
-        buffer[1] = '\0';
-    } else {
-        buffer[n] = '\0';
-    }
-    return buffer;
-}
-
-BufferString::BufferString(char* buffer, size_t bufferSize)
-    : length(0), capacity(bufferSize <= 0 ? 0 : bufferSize - 1), data(buffer) {
-    data[0] = '\0';
-}
-
-BufferString& BufferString::operator=(const BufferString& other) {
-    clear();
-    other.toString(*this);
-    return *this;
-}
-
-bool BufferString::operator==(const char* s) const {
-    return strcmp(data, s) == 0;
-}
-
-bool BufferString::operator==(const BufferString& other) const {
-    return length == other.length && strcmp(data, other.data) == 0;
-}
-
-bool BufferString::operator!=(const char* s) const {
-    return !((*this) == s);
-}
-
-bool BufferString::operator!=(const BufferString& other) const {
-    return !((*this) == other);
-}
-
-char BufferString::operator[](size_t index) const {
-    return data[index];
-}
-
-size_t BufferString::getLength() const {
-    return length;
-}
-
-size_t BufferString::getCapacity() const {
-    return capacity;
-}
-
-BufferString& BufferString::append(char c) {
-    if(length < capacity) {
-        data[length++] = c;
-        data[length] = '\0';
-    }
-    return *this;
-}
-
-BufferString& BufferString::append(signed char c) {
-    return append(static_cast<char>(c));
-}
-
-BufferString& BufferString::append(unsigned char c) {
-    return append(static_cast<char>(c));
-}
-
-BufferString& BufferString::append(wchar_t c) {
-    return append(static_cast<c32>(c));
-}
-
-BufferString& BufferString::append(c32 c) {
-    return append(static_cast<const char*>(convertC32(c).begin()));
-}
-
-BufferString& BufferString::append(const char* s) {
-    // stringLength as s could be some part of data
-    for(size_t i = strlen(s); i > 0; i--) {
-        append(*(s++));
-    }
-    return *this;
-}
-
-BufferString& BufferString::append(const c32* s) {
-    // stringLength as s could be some part of data
-    for(size_t i = stringLength(s); i > 0; i--) {
-        append(*(s++));
-    }
-    return *this;
-}
-
-BufferString& BufferString::append(const signed char* s) {
-    return append(reinterpret_cast<const char*>(s));
-}
-
-BufferString& BufferString::append(const unsigned char* s) {
-    return append(reinterpret_cast<const char*>(s));
-}
-
-BufferString& BufferString::append(bool b) {
-    return b ? append("true") : append("false");
-}
-
-void BufferString::toString(BufferString& s) const {
-    size_t l = length; // length changes if &s == this
-    for(size_t i = 0; i < l; i++) {
-        s.append(data[i]);
-    }
-}
-
-void BufferString::clear() {
-    length = 0;
-    data[0] = '\0';
-}
-
-void BufferString::print() const {
-    Core::print(data);
-}
-
-void BufferString::printLine() const {
-    Core::printLine(data);
-}
-
-bool BufferString::startsWith(const BufferString& other, size_t from) const {
-    return length >= from + other.getLength() &&
-           strncmp(data + from, other.data, other.getLength()) == 0;
-}
-
-size_t BufferString::search(const BufferString& other, size_t from) const {
-    char* f = strstr(data + from, other.data);
-    return f == nullptr ? SIZE_MAX : static_cast<size_t>(f - data);
-}
-
-bool BufferString::contains(const BufferString& other, size_t from) const {
-    return search(other, from) != SIZE_MAX;
-}
-
-size_t BufferString::search(char u, size_t from) const {
-    char* f = strchr(data + from, u);
-    return f == nullptr ? SIZE_MAX : static_cast<size_t>(f - data);
-}
-
-bool BufferString::contains(char u, size_t from) const {
-    return search(u, from) != SIZE_MAX;
-}
-
-void BufferString::substring(BufferString& s, size_t from, size_t to) const {
-    s.clear();
-    to = Math::min(to + 1, length);
-    for(size_t i = from; i < to; i++) {
-        s.append(data[i]);
-    }
-}
-
-void BufferString::substring(BufferString& s, size_t from) const {
-    substring(s, from, length - 1);
-}
-
-void BufferString::replace(BufferString& s, const BufferString& search,
-                           const BufferString& replace) {
-    size_t i = 0;
-    while(i < length) {
-        if(startsWith(search, i)) {
-            s.append(replace);
-            i += search.getLength();
-        } else {
-            s.append(data[i]);
-            i++;
-        }
-    }
-    *this = s;
-}
-
-void BufferString::replace(char search, char replace) {
-    for(size_t i = 0; i < length; i++) {
-        if(data[i] == search) {
-            data[i] = replace;
-        }
-    }
-}
-
-BufferString::operator const char*() const {
-    return data;
-}

+ 0 - 168
old/ArrayString.hpp

@@ -1,168 +0,0 @@
-#ifndef CORE_ARRAY_STRING_HPP
-#define CORE_ARRAY_STRING_HPP
-
-#include <string.h>
-
-#include "core/utils/Error.hpp"
-#include "core/utils/Meta.hpp"
-#include "core/utils/Types.hpp"
-#include "core/utils/Utility.hpp"
-
-namespace Core {
-    class BufferString {
-    protected:
-        size_t length;
-        size_t capacity;
-        char* data;
-
-    public:
-        BufferString(char* buffer, size_t bufferSize);
-        BufferString(const BufferString&) = delete;
-        BufferString& operator=(const BufferString&);
-        BufferString(BufferString&&) = delete;
-        BufferString& operator=(BufferString&&) = delete;
-        bool operator==(const char* s) const;
-        bool operator==(const BufferString& other) const;
-        bool operator!=(const char* s) const;
-        bool operator!=(const BufferString& other) const;
-        char operator[](size_t index) const;
-        size_t getLength() const;
-        size_t getCapacity() const;
-        BufferString& append(char c);
-        BufferString& append(signed char c);
-        BufferString& append(unsigned char c);
-        BufferString& append(wchar_t c);
-        BufferString& append(c32 c);
-        BufferString& append(const char* s);
-        BufferString& append(const c32* s);
-        BufferString& append(const signed char* s);
-        BufferString& append(const unsigned char* s);
-        BufferString& append(bool b);
-
-        template<typename T>
-        BufferString& append(const T& t) {
-            if constexpr(requires { t.toString(*this); }) {
-                (void)t.toString(*this);
-            } else if constexpr(requires { static_cast<const char*>(t); }) {
-                append(static_cast<const char*>(t));
-            } else {
-                char buffer[64];
-                Core::toString(t, buffer, sizeof(buffer));
-                append(static_cast<const char*>(buffer));
-            }
-            return *this;
-        }
-
-        void toString(BufferString& s) const;
-        void clear();
-        void print() const;
-        void printLine() const;
-
-        template<typename... Args>
-        BufferString& format(BufferString& s, Args&&... args) {
-            if constexpr(sizeof...(args) > 0) {
-                formatR(s, 0, forward<Args>(args)...);
-                *this = s;
-            }
-            return *this;
-        }
-
-        bool startsWith(const BufferString& other, size_t from = 0) const;
-        size_t search(const BufferString& other, size_t from = 0) const;
-        bool contains(const BufferString& other, size_t from = 0) const;
-        size_t search(char u, size_t from = 0) const;
-        bool contains(char u, size_t from = 0) const;
-        void substring(BufferString& s, size_t from, size_t to) const;
-        void substring(BufferString& s, size_t from = 0) const;
-        void replace(BufferString& s, const BufferString& search,
-                     const BufferString& replace);
-        void replace(char search, char replace);
-        operator const char*() const;
-
-    private:
-        template<typename T, typename... Args>
-        void formatR(BufferString& s, size_t index, const T& t,
-                     Args&&... args) const {
-            size_t l = getLength();
-            while(index < l) {
-                char u = data[index++];
-                if(u == '#') {
-                    if(index >= l || data[index] != '#') {
-                        break;
-                    }
-                    index++;
-                }
-                s.append(u);
-            }
-            s.append(t);
-            if constexpr(sizeof...(args) > 0) {
-                formatR(s, index, forward<Args>(args)...);
-                return;
-            }
-            while(index < l) {
-                s.append(data[index++]);
-            }
-        }
-    };
-
-    template<size_t N>
-    class ArrayString final : public BufferString {
-        char data[N];
-
-    public:
-        ArrayString() : BufferString(data, N) {
-        }
-
-        ArrayString(const ArrayString& other) : BufferString(data, N) {
-            memcpy(data, other.data, sizeof(data));
-            length = other.length;
-        }
-
-        ArrayString& operator=(const ArrayString& other) {
-            if(this != &other) {
-                memcpy(data, other.data, sizeof(data));
-                length = other.length;
-            }
-            return *this;
-        }
-
-        template<typename... Args>
-        ArrayString& format(Args&&... args) {
-            ArrayString s;
-            BufferString::format(s, Core::forward<Args>(args)...);
-            return *this;
-        }
-
-        void replace(const BufferString& search, const BufferString& replace) {
-            ArrayString s;
-            BufferString::replace(s, search, replace);
-        }
-
-        using BufferString::replace;
-    };
-
-    template<typename String, typename Iterable>
-    void toString(String& s, const Iterable& i) {
-        s.append("[");
-        auto current = i.begin();
-        auto end = i.end();
-        while(current != end) {
-            s.append(*current);
-            ++current;
-            if(current != end) {
-                s.append(", ");
-            }
-        }
-        s.append("]");
-    }
-}
-
-inline bool operator==(const char* cs, const Core::BufferString& s) {
-    return s == cs;
-}
-
-inline bool operator!=(const char* cs, const Core::BufferString& s) {
-    return s != cs;
-}
-
-#endif

+ 0 - 519
old/ArrayStringTests.cpp

@@ -1,519 +0,0 @@
-#include "../Tests.hpp"
-#include "core/data/HashMap.hpp"
-#include "core/utils/ArrayString.hpp"
-#include "core/utils/Error.hpp"
-
-template class Core::ArrayString<128>;
-
-using String = Core::ArrayString<128>;
-
-static String build(const char* cs) {
-    String s;
-    s.append(cs);
-    return s;
-}
-
-static void testEquality() {
-    String s = build("test");
-    CORE_TEST_TRUE(s == "test");
-    CORE_TEST_TRUE(s == build("test"));
-    CORE_TEST_TRUE("test" == s);
-    CORE_TEST_TRUE(build("test") == s);
-    CORE_TEST_FALSE(build("tes2") == s);
-    CORE_TEST_TRUE(s == s);
-}
-
-static void testUnicodeEquality() {
-    const char* cs = "\u0040\u0400\u8000\U00100000";
-    String s = build(cs);
-    CORE_TEST_TRUE(s == cs);
-    CORE_TEST_TRUE(s == build(cs));
-    CORE_TEST_TRUE(cs == s);
-    CORE_TEST_TRUE(build(cs) == s);
-    CORE_TEST_TRUE(s == s);
-}
-
-static void testInequality() {
-    String s = build("test");
-    CORE_TEST_FALSE(s != "test");
-    CORE_TEST_FALSE(s != build("test"));
-    CORE_TEST_FALSE("test" != s);
-    CORE_TEST_FALSE(build("test") != s);
-    CORE_TEST_FALSE(s != s);
-}
-
-static void testStringAppend() {
-    String s = build("test");
-    s.append("22").append("333").append("4444");
-    CORE_TEST_EQUAL(build("test223334444"), s);
-}
-
-static void testStringAppendOverflow() {
-    Core::ArrayString<6> s;
-    s.append("te").append("23334444");
-    CORE_TEST_TRUE(build("te23334444") != s);
-}
-
-static void testCharacters() {
-    String s = build("test");
-    CORE_TEST_EQUAL('t', s[0]);
-    CORE_TEST_EQUAL('e', s[1]);
-    CORE_TEST_EQUAL('s', s[2]);
-    CORE_TEST_EQUAL('t', s[3]);
-}
-
-static void testLength() {
-    String s = build("test");
-    CORE_TEST_EQUAL(4, s.getLength());
-    s.append("aaa");
-    CORE_TEST_EQUAL(7, s.getLength());
-}
-
-static void testChar() {
-    String s = build("test");
-    for(char i = 'a'; i < 'd'; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("testabc"), s);
-}
-
-static void testSignedChar() {
-    String s = build("test");
-    for(signed char i = 'b'; i < 'e'; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("testbcd"), s);
-}
-
-static void testUnsignedChar() {
-    String s = build("test");
-    for(unsigned char i = 'c'; i < 'f'; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("testcde"), s);
-}
-
-static void testSignedShort() {
-    String s = build("test");
-    for(signed short i = 100; i < 103; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("test100101102"), s);
-}
-
-static void testUnsignedShort() {
-    String s = build("test");
-    for(unsigned short i = 101; i < 104; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("test101102103"), s);
-}
-
-static void testSignedInt() {
-    String s = build("test");
-    for(signed int i = 102; i < 105; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("test102103104"), s);
-}
-
-static void testUnsignedInt() {
-    String s = build("test");
-    for(unsigned int i = 103; i < 106; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("test103104105"), s);
-}
-
-static void testSignedLong() {
-    String s = build("test");
-    for(signed long i = 104; i < 107; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("test104105106"), s);
-}
-
-static void testUnsignedLong() {
-    String s = build("test");
-    for(unsigned long i = 105; i < 108; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("test105106107"), s);
-}
-
-static void testSignedLongLong() {
-    String s = build("test");
-    for(signed long long i = 106; i < 109; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("test106107108"), s);
-}
-
-static void testUnsignedLongLong() {
-    String s = build("test");
-    for(unsigned long long i = 107; i < 110; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("test107108109"), s);
-}
-
-static void testFloat() {
-    String s = build("test");
-    for(float i = 108; i < 111; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("test108.00109.00110.00"), s);
-}
-
-static void testDouble() {
-    String s = build("test");
-    for(double i = 109; i < 112; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("test109.00110.00111.00"), s);
-}
-
-static void testLongDouble() {
-    String s = build("test");
-    for(long double i = 110; i < 113; i++) {
-        s.append(i);
-    }
-    CORE_TEST_EQUAL(build("test110.00111.00112.00"), s);
-}
-
-static void testBool() {
-    String s = build("test");
-    s.append(true).append(false).append(true);
-    CORE_TEST_EQUAL(build("testtruefalsetrue"), s);
-}
-
-static void testIntOverflow() {
-    Core::ArrayString<4> s;
-    s.append(123456);
-
-    String o;
-    for(size_t i = 0; i < s.getCapacity(); i++) {
-        o.append(i + 1);
-    }
-
-    CORE_TEST_TRUE(o == s);
-}
-
-static void testUnicode() {
-    String s;
-    s.append('\u0040');
-    s.append(L'\u0400');
-    s.append(L'\u8000');
-    s.append(U'\U00100000');
-    CORE_TEST_EQUAL(build("\u0040\u0400\u8000\U00100000"), s);
-}
-
-static void testClear() {
-    String s = build("test");
-    s.append(1234);
-    s.clear();
-    s.append("wusi");
-    s.append("1234");
-    CORE_TEST_EQUAL(build("wusi1234"), s);
-}
-
-static void testAddSelf() {
-    String s;
-    s.append("test1").append(s).append(s);
-    CORE_TEST_EQUAL(build("test1test1test1test1"), s);
-}
-
-static void testStartsWith() {
-    String s;
-    s.append("0123456789");
-
-    String s2;
-    s2.append("123");
-    String s3;
-    s3.append("234");
-    String s4;
-    s4.append("789");
-    String s5;
-    s5.append("124");
-    String s6;
-    String s7;
-    s7.append("7891");
-
-    CORE_TEST_FALSE(s.startsWith(s2));
-    CORE_TEST_TRUE(s.startsWith(s2, 1));
-
-    CORE_TEST_FALSE(s.startsWith(s3));
-    CORE_TEST_TRUE(s.startsWith(s3, 2));
-
-    CORE_TEST_FALSE(s.startsWith(s4));
-    CORE_TEST_TRUE(s.startsWith(s4, 7));
-
-    CORE_TEST_FALSE(s.startsWith(s5));
-    CORE_TEST_FALSE(s.startsWith(s5, 3));
-
-    CORE_TEST_TRUE(s.startsWith(s6));
-    CORE_TEST_TRUE(s.startsWith(s6, 3));
-
-    CORE_TEST_FALSE(s.startsWith(s7));
-    CORE_TEST_FALSE(s.startsWith(s7, 7));
-}
-
-static void testSearch() {
-    String s;
-    s.append("0123456789");
-
-    String s2;
-    s2.append("123");
-    String s3;
-    s3.append("234");
-    String s4;
-    s4.append("789");
-    String s5;
-    s5.append("124");
-    String s6;
-    String s7;
-    s7.append("7891");
-
-    CORE_TEST_EQUAL(1, s.search(s2));
-    CORE_TEST_EQUAL(2, s.search(s3));
-    CORE_TEST_EQUAL(7, s.search(s4));
-    CORE_TEST_EQUAL(SIZE_MAX, s.search(s5));
-    CORE_TEST_EQUAL(0, s.search(s6));
-    CORE_TEST_EQUAL(SIZE_MAX, s.search(s7));
-
-    CORE_TEST_EQUAL(SIZE_MAX, s.search(s2, 3));
-    CORE_TEST_EQUAL(SIZE_MAX, s.search(s3, 3));
-    CORE_TEST_EQUAL(7, s.search(s4, 3));
-    CORE_TEST_EQUAL(SIZE_MAX, s.search(s5, 3));
-    CORE_TEST_EQUAL(3, s.search(s6, 3));
-    CORE_TEST_EQUAL(SIZE_MAX, s.search(s7, 3));
-}
-
-static void testContains() {
-    String s;
-    s.append("0123456789");
-
-    String s2;
-    s2.append("123");
-    String s3;
-    s3.append("234");
-    String s4;
-    s4.append("789");
-    String s5;
-    s5.append("124");
-    String s6;
-    String s7;
-    s7.append("7891");
-
-    CORE_TEST_TRUE(s.contains(s2));
-    CORE_TEST_TRUE(s.contains(s3));
-    CORE_TEST_TRUE(s.contains(s4));
-    CORE_TEST_FALSE(s.contains(s5));
-    CORE_TEST_TRUE(s.contains(s6));
-    CORE_TEST_FALSE(s.contains(s7));
-}
-
-static void testSearchChar() {
-    String s;
-    s.append("01üää3ä");
-
-    CORE_TEST_EQUAL(0, s.search('0'));
-    CORE_TEST_EQUAL(1, s.search('1'));
-    CORE_TEST_EQUAL(8, s.search('3'));
-}
-
-static void testContainsChar() {
-    String s;
-    s.append("01üää3ä");
-    CORE_TEST_TRUE(s.contains('0'));
-    CORE_TEST_TRUE(s.contains('1'));
-    CORE_TEST_TRUE(s.contains('3'));
-    CORE_TEST_FALSE(s.contains('a'));
-}
-
-static void testSubString() {
-    String s;
-    s.append("01üää3ä");
-
-    String sub;
-    s.substring(sub, 0);
-    CORE_TEST_STRING("01üää3ä", sub);
-    s.substring(sub, 2);
-    CORE_TEST_STRING("üää3ä", sub);
-    s.substring(sub, 4);
-    CORE_TEST_STRING("ää3ä", sub);
-    s.substring(sub, 6);
-    CORE_TEST_STRING("ä3ä", sub);
-
-    s.substring(sub, 0, 10);
-    CORE_TEST_STRING("01üää3ä", sub);
-    s.substring(sub, 1, 8);
-    CORE_TEST_STRING("1üää3", sub);
-    s.substring(sub, 2, 7);
-    CORE_TEST_STRING("üää", sub);
-    s.substring(sub, 4, 5);
-    CORE_TEST_STRING("ä", sub);
-    s.substring(sub, 4, 2);
-    CORE_TEST_STRING("", sub);
-    s.substring(sub, 6, 23);
-    CORE_TEST_STRING("ä3ä", sub);
-}
-
-static void testReplace() {
-    String s;
-    s.append("0äääää1üää3ä");
-
-    String search;
-    search.append("ää");
-
-    String replace;
-    replace.append("ABCD");
-    s.replace(search, replace);
-    CORE_TEST_STRING("0ABCDABCDä1üABCD3ä", s);
-}
-
-static void testReplaceChar() {
-    String s;
-    s.append("01YXX3X");
-    s.replace('0', 'A');
-    CORE_TEST_STRING("A1YXX3X", s);
-    s.replace('1', 'B');
-    CORE_TEST_STRING("ABYXX3X", s);
-    s.replace('Y', 'C');
-    CORE_TEST_STRING("ABCXX3X", s);
-    s.replace('X', 'D');
-    CORE_TEST_STRING("ABCDD3D", s);
-    s.replace('3', 'E');
-    CORE_TEST_STRING("ABCDDED", s);
-}
-
-static void testCastAppendSelf() {
-    String s;
-    s.append("abc");
-    s.append(s);
-    s.append(static_cast<const char*>(s));
-    CORE_TEST_STRING("abcabcabcabc", s);
-}
-
-static void testCompareWithShorter() {
-    String s;
-    s.append("abc");
-    CORE_TEST_FALSE(s == "ab");
-}
-
-static void testAppendSignedChar() {
-    const signed char buffer[] = {'a', 'b', 'c', '\0'};
-    String s;
-    s.append(buffer);
-    CORE_TEST_TRUE(s == "abc");
-}
-
-static void testAppendUnsignedChar() {
-    const unsigned char buffer[] = {'a', 'b', 'c', '\0'};
-    String s;
-    s.append(buffer);
-    CORE_TEST_TRUE(s == "abc");
-}
-
-static void testAppendError() {
-    String s;
-    s.append(Core::ErrorCode::NONE);
-    CORE_TEST_STRING("0", s);
-}
-
-static void testPrint() {
-    String s;
-    s.append('\u0040');
-    s.append(L'\u0400');
-    s.append(L'\u8000');
-    s.append(U'\U00100000');
-    CORE_TEST_EQUAL(build("\u0040\u0400\u8000\U00100000"), s);
-    s.append('\n');
-    s.print();
-}
-
-static void testKeepHash() {
-    String s;
-    s.append("a ## test #### #####");
-    s.format(1, 2, 3, 4, 5, 6, 7, 8, 9);
-    CORE_TEST_STRING("a # test ## ##123456789", s);
-}
-
-static void testFormatWithoutArguments() {
-    String s;
-    s.append("wusi");
-    s.format();
-    CORE_TEST_STRING("wusi", s);
-}
-
-static void testUnicodeString() {
-    String s;
-    s.append(U"_üö§äab");
-    CORE_TEST_STRING("_üö§äab", s);
-}
-
-static void testInvalidUnicodeString() {
-    String s;
-    s.append(static_cast<c32>(0xFFFFFFFF));
-    CORE_TEST_STRING("?", s);
-}
-
-static void testConversion() {
-    const c32* a = U"öüewfde_§$§%$ädsf";
-    const char* b = "öüewfde_§$§%$ädsf";
-
-    String s;
-    s.append(a);
-    String s2;
-    s2.append(b);
-
-    CORE_TEST_STRING(s, s2);
-}
-
-void Core::testArrayString() {
-    testEquality();
-    testUnicodeEquality();
-    testInequality();
-    testStringAppend();
-    testStringAppendOverflow();
-    testCharacters();
-    testLength();
-    testChar();
-    testSignedChar();
-    testUnsignedChar();
-    testSignedShort();
-    testUnsignedShort();
-    testSignedInt();
-    testUnsignedInt();
-    testSignedLong();
-    testUnsignedLong();
-    testSignedLongLong();
-    testUnsignedLongLong();
-    testFloat();
-    testDouble();
-    testLongDouble();
-    testBool();
-    testIntOverflow();
-    testUnicode();
-    testClear();
-    testAddSelf();
-    testStartsWith();
-    testSearch();
-    testContains();
-    testSearchChar();
-    testContainsChar();
-    testSubString();
-    testReplace();
-    testReplaceChar();
-    testCastAppendSelf();
-    testCompareWithShorter();
-    testAppendSignedChar();
-    testAppendUnsignedChar();
-    testAppendError();
-    testPrint();
-    testKeepHash();
-    testFormatWithoutArguments();
-    testUnicodeString();
-    testInvalidUnicodeString();
-    testConversion();
-}

+ 2 - 2
src/BitArray.cpp

@@ -59,7 +59,7 @@ BitArray::BitArray(const BitArray& other) : BitArray() {
     }
 }
 
-BitArray::BitArray(BitArray&& other) : BitArray() {
+BitArray::BitArray(BitArray&& other) noexcept : BitArray() {
     swap(other);
 }
 
@@ -67,7 +67,7 @@ BitArray::~BitArray() {
     coreDeleteN(data);
 }
 
-BitArray& BitArray::operator=(BitArray other) {
+BitArray& BitArray::operator=(BitArray other) noexcept {
     swap(other);
     return *this;
 }

+ 1 - 1
src/Buffer.cpp

@@ -48,7 +48,7 @@ const char* Core::Buffer::getData() const {
     return buffer;
 }
 
-void Core::Buffer::swap(Buffer& other) {
+void Core::Buffer::swap(Buffer& other) noexcept {
     Core::swap(length, other.length);
     Core::swap(capacity, other.capacity);
     Core::swap(buffer, other.buffer);

+ 2 - 2
src/Thread.cpp

@@ -36,7 +36,7 @@ MutexGuard::~MutexGuard() {
 Thread::Thread() : thread() {
 }
 
-Thread::Thread(Thread&& other) : thread() {
+Thread::Thread(Thread&& other) noexcept : thread() {
     swap(other);
 }
 
@@ -44,7 +44,7 @@ Thread::~Thread() {
     join();
 }
 
-Thread& Thread::operator=(Thread&& other) {
+Thread& Thread::operator=(Thread&& other) noexcept {
     if(this != &other) {
         join();
         thread = Core::move(other.thread);

+ 9 - 9
test/Main.cpp

@@ -61,34 +61,34 @@ int main(int argAmount, const char** args) {
         }
     }
 
-    testList(light);
-    testUniquePointer();
-    testVector();
-    testMath();
-    testClock(light);
     testArray();
+    testArrayList(light);
     testBitArray();
     testBox();
     testBuffer(light);
+    testClock(light);
+    testColor();
     testComponents();
     testFile();
     testFrustum();
-    testArrayList(light);
     testHashMap(light);
-    testMatrix();
-    testColor();
     testHashedString();
+    testList(light);
+    testMath();
+    testMatrix();
     testPlane();
     testQuaternion();
-    testThread();
     testQueue();
     testRandom(light);
     if(light) {
         testReadLine();
     }
     testTerminal(!light);
+    testThread();
     testUnicode();
+    testUniquePointer();
     testUtility();
+    testVector();
     testView();
 
     Core::logLevel = Core::LogLevel::WARNING;

+ 0 - 9
test/Tests.hpp

@@ -9,34 +9,25 @@
 [[noreturn]] void testPreCanaryNewArray();
 void testArray();
 void testArrayList(bool light);
-void testArrayString();
 void testBitArray();
 void testBox();
 void testBuffer(bool light);
-void testBufferedValue();
 void testClock(bool light);
 void testColor();
 void testComponents();
-void testError();
 void testFile();
-void testFileReader();
 void testFrustum();
 void testHashMap(bool light);
 void testHashedString();
 void testInteractiveTerminal();
-void testLinkedList(bool light);
 void testList(bool light);
 void testMath();
 void testMatrix();
-void testMatrixStack(bool light);
-void testNew();
 void testPlane();
 void testQuaternion();
 void testQueue();
 void testRandom(bool light);
 void testReadLine();
-void testRingBuffer();
-void testStack(bool light);
 void testTerminal(bool tty);
 void testTest();
 void testThread();