Преглед изворни кода

String overflow is no error any more

Kajetan Johannes Hammerle пре 2 недеља
родитељ
комит
e178d46eff

+ 2 - 3
include/core/data/Array.hpp

@@ -49,9 +49,8 @@ namespace Core {
             return N;
         }
 
-        template<typename String>
-        CError toString(String& s) const {
-            return Core::toString(s, *this);
+        void toString(BufferString& s) const {
+            Core::toString(s, *this);
         }
     };
 }

+ 11 - 13
include/core/data/ArrayList.hpp

@@ -63,18 +63,17 @@ namespace Core {
         }
 
         template<typename... Args>
-        CError put(T*& t, Args&&... args) {
-            if(length >= N) {
-                return ErrorCode::CAPACITY_REACHED;
+        T* put(Args&&... args) {
+            if(length < N) {
+                return new(begin() + length++) T(Core::forward<Args>(args)...);
             }
-            t = new(begin() + length++) T(Core::forward<Args>(args)...);
-            return ErrorCode::NONE;
+            return nullptr;
         }
 
         template<typename... Args>
-        CError add(Args&&... args) {
-            T* t = nullptr;
-            return put(t, Core::forward<Args>(args)...);
+        ArrayList& add(Args&&... args) {
+            put(Core::forward<Args>(args)...);
+            return *this;
         }
 
         T& operator[](size_t index) {
@@ -109,21 +108,20 @@ namespace Core {
             removeBySwap(length - 1);
         }
 
-        template<typename String>
-        CError toString(String& s) const {
-            return Core::toString(s, *this);
+        void toString(BufferString& s) const {
+            Core::toString(s, *this);
         }
 
     private:
         void copy(const ArrayList& other) {
             for(size_t i = 0; i < other.length; i++) {
-                (void)add(other[i]);
+                add(other[i]);
             }
         }
 
         void move(ArrayList&& other) {
             for(size_t i = 0; i < other.length; i++) {
-                (void)add(Core::move(other[i]));
+                add(Core::move(other[i]));
             }
         }
     };

+ 17 - 26
include/core/data/BitArray.hpp

@@ -10,40 +10,31 @@ namespace Core {
 
     public:
         BitArray();
-        BitArray(const BitArray& other) = delete;
+        BitArray(const BitArray& other);
         BitArray(BitArray&& other);
         ~BitArray();
-        BitArray& operator=(const BitArray& other) = delete;
-        BitArray& operator=(BitArray&& other);
-
-        CError copyFrom(const BitArray& other);
-
-        BitArray& set(u64 index, u64 value);
-        u64 get(u64 index) const;
-
-        u64 getLength() const;
-        u64 getBits() const;
-        u64 getInternalByteSize() const;
-
-        i64 select(u64 index) const;
-
-        CError resize(u64 newLength, u64 newBits);
-
+        BitArray& operator=(BitArray other);
+
+        BitArray& set(size_t index, u64 value);
+        u64 get(size_t index) const;
+        size_t getLength() const;
+        size_t getBits() const;
+        size_t getInternalByteSize() const;
+        i64 select(size_t index) const;
+        CError resize(size_t newLength, size_t newBits);
         void fill(u64 value);
 
-        template<typename String>
-        CError toString(String& s) const {
-            CORE_RETURN_ERROR(s.append("["));
-            u64 length = getLength();
+        void toString(BufferString& s) const {
+            s.append("[");
+            size_t length = getLength();
             if(length > 0) {
                 length--;
-                for(u64 i = 0; i < length; i++) {
-                    CORE_RETURN_ERROR(s.append(get(i)));
-                    CORE_RETURN_ERROR(s.append(", "));
+                for(size_t i = 0; i < length; i++) {
+                    s.append(get(i)).append(", ");
                 }
-                CORE_RETURN_ERROR(s.append(get(length)));
+                s.append(get(length));
             }
-            return s.append("]");
+            s.append("]");
         }
 
         void swap(BitArray& other);

+ 0 - 1
include/core/data/Components.hpp

@@ -2,7 +2,6 @@
 #define CORE_COMPONENTS_HPP
 
 #include "core/data/HashMap.hpp"
-#include "core/utils/Error.hpp"
 
 namespace Core {
     using Entity = int;

+ 5 - 8
include/core/data/HashMap.hpp

@@ -3,6 +3,7 @@
 
 #include "core/data/LinkedList.hpp"
 #include "core/data/List.hpp"
+#include "core/utils/ArrayString.hpp"
 #include "core/utils/HashCode.hpp"
 #include "core/utils/Meta.hpp"
 
@@ -22,11 +23,8 @@ namespace Core {
                 return key;
             }
 
-            template<typename String>
-            CError toString(String& s) const {
-                CORE_RETURN_ERROR(s.append(key));
-                CORE_RETURN_ERROR(s.append(" = "));
-                return s.append(value);
+            void toString(BufferString& s) const {
+                s.append(key).append(" = ").append(value);
             }
 
         private:
@@ -251,9 +249,8 @@ namespace Core {
             Core::swap(nodePointers, other.nodePointers);
         }
 
-        template<typename String>
-        CError toString(String& s) const {
-            return Core::toString(s, *this);
+        void toString(BufferString& s) const {
+            Core::toString(s, *this);
         }
 
     private:

+ 2 - 3
include/core/data/LinkedList.hpp

@@ -126,9 +126,8 @@ namespace Core {
             last = nullptr;
         }
 
-        template<typename String>
-        CError toString(String& s) const {
-            return Core::toString(s, *this);
+        void toString(BufferString& s) const {
+            Core::toString(s, *this);
         }
 
         void remove(Node*& n) {

+ 2 - 3
include/core/data/List.hpp

@@ -158,9 +158,8 @@ namespace Core {
             removeBySwap(length - 1);
         }
 
-        template<typename String>
-        CError toString(String& s) const {
-            return Core::toString(s, *this);
+        void toString(BufferString& s) const {
+            Core::toString(s, *this);
         }
 
         void swap(List& other) {

+ 4 - 9
include/core/data/ProbingHashMap.hpp

@@ -3,7 +3,6 @@
 
 #include "core/data/List.hpp"
 #include "core/utils/ArrayString.hpp"
-#include "core/utils/Error.hpp"
 #include "core/utils/HashCode.hpp"
 #include "core/utils/New.hpp"
 #include "core/utils/Types.hpp"
@@ -24,11 +23,8 @@ namespace Core {
                 return key;
             }
 
-            template<typename String>
-            CError toString(String& s) const {
-                CORE_RETURN_ERROR(s.append(key));
-                CORE_RETURN_ERROR(s.append(" = "));
-                return s.append(value);
+            void toString(BufferString& s) const {
+                s.append(key).append(" = ").append(value);
             }
 
         private:
@@ -263,9 +259,8 @@ namespace Core {
             return {keys.end(), keys.end(), nullptr};
         }
 
-        template<typename String>
-        CError toString(String& s) const {
-            return Core::toString(s, *this);
+        void toString(BufferString& s) const {
+            Core::toString(s, *this);
         }
 
         void swap(ProbingHashMap& o) {

+ 24 - 28
include/core/data/RingBuffer.hpp

@@ -1,6 +1,8 @@
 #ifndef CORE_RINGBUFFER_HPP
 #define CORE_RINGBUFFER_HPP
 
+#include <assert.h>
+
 #include "core/utils/AlignedData.hpp"
 #include "core/utils/ArrayString.hpp"
 
@@ -8,19 +10,18 @@ namespace Core {
     template<typename T, size_t N>
     class RingBuffer final {
         AlignedType<T> data[N];
-        size_t writeIndex;
-        size_t readIndex;
-        size_t values;
+        size_t writeIndex = 0;
+        size_t readIndex = 0;
+        size_t values = 0;
 
     public:
-        RingBuffer() : writeIndex(0), readIndex(0), values(0) {
-        }
+        RingBuffer() = default;
 
-        RingBuffer(const RingBuffer& other) : RingBuffer() {
+        RingBuffer(const RingBuffer& other) {
             copy(other);
         }
 
-        RingBuffer(RingBuffer&& other) : RingBuffer() {
+        RingBuffer(RingBuffer&& other) {
             move(Core::move(other));
             other.clear();
         }
@@ -47,20 +48,20 @@ namespace Core {
         }
 
         template<typename... Args>
-        CError put(T*& t, Args&&... args) {
+        T* put(Args&&... args) {
             if(getLength() >= N) {
-                return ErrorCode::CAPACITY_REACHED;
+                return nullptr;
             }
-            t = new(data + writeIndex) T(Core::forward<Args>(args)...);
+            T* t = new(data + writeIndex) T(Core::forward<Args>(args)...);
             writeIndex = (writeIndex + 1) % N;
             values++;
-            return ErrorCode::NONE;
+            return t;
         }
 
         template<typename... Args>
-        CError add(Args&&... args) {
-            T* t = nullptr;
-            return put(t, Core::forward<Args>(args)...);
+        RingBuffer& add(Args&&... args) {
+            put(Core::forward<Args>(args)...);
+            return *this;
         }
 
         T& operator[](size_t index) {
@@ -88,41 +89,36 @@ namespace Core {
             values = 0;
         }
 
-        CError remove() {
-            if(!canRemove()) {
-                return ErrorCode::INVALID_STATE;
-            }
+        void remove() {
+            assert(canRemove());
             values--;
             (*this)[0].~T();
             readIndex = (readIndex + 1) % N;
-            return ErrorCode::NONE;
         }
 
-        template<typename String>
-        CError toString(String& s) const {
-            CORE_RETURN_ERROR(s.append("["));
+        void toString(BufferString& s) const {
+            s.append("[");
             size_t end = getLength();
             if(end > 0) {
                 end--;
                 for(size_t i = 0; i < end; i++) {
-                    CORE_RETURN_ERROR(s.append((*this)[i]));
-                    CORE_RETURN_ERROR(s.append(", "));
+                    s.append((*this)[i]).append(", ");
                 }
-                CORE_RETURN_ERROR(s.append((*this)[end]));
+                s.append((*this)[end]);
             }
-            return s.append("]");
+            s.append("]");
         }
 
     private:
         void copy(const RingBuffer& other) {
             for(size_t i = 0; i < other.getLength(); i++) {
-                (void)add(other[i]);
+                add(other[i]);
             }
         }
 
         void move(RingBuffer&& other) {
             for(size_t i = 0; i < other.getLength(); i++) {
-                (void)add(Core::move(other[i]));
+                add(Core::move(other[i]));
             }
         }
     };

+ 5 - 11
include/core/data/Stack.hpp

@@ -4,7 +4,6 @@
 #include "core/data/ArrayList.hpp"
 #include "core/data/List.hpp"
 #include "core/utils/Error.hpp"
-#include "core/utils/Meta.hpp"
 
 namespace Core {
     namespace Internal {
@@ -14,13 +13,9 @@ namespace Core {
 
         public:
             template<typename... Args>
-            CError push(Args&&... args) {
-                if constexpr(Core::IsSame<S, List<T>>) {
-                    data.add(Core::forward<Args>(args)...);
-                    return ErrorCode::NONE;
-                } else {
-                    return data.add(Core::forward<Args>(args)...);
-                }
+            BaseStack& push(Args&&... args) {
+                data.add(Core::forward<Args>(args)...);
+                return *this;
             }
 
             void clear() {
@@ -46,9 +41,8 @@ namespace Core {
                 return data[data.getLength() - 1];
             }
 
-            template<typename String>
-            CError toString(String& s) const {
-                return s.append(data);
+            void toString(BufferString& s) const {
+                s.append(data);
             }
         };
     }

+ 2 - 2
include/core/io/File.hpp

@@ -6,7 +6,7 @@
 #include "core/utils/ArrayString.hpp"
 
 namespace Core {
-    using Path = String8<PATH_MAX>;
+    using Path = ArrayString<PATH_MAX>;
 }
 
-#endif
+#endif

+ 4 - 8
include/core/math/Box.hpp

@@ -22,14 +22,10 @@ namespace Core {
         const Vector3& getMin() const;
         const Vector3& getMax() const;
 
-        template<typename String>
-        check_return Error toString(String& s) const {
-            CORE_RETURN_ERROR(s.append("Box("));
-            CORE_RETURN_ERROR(s.append(min));
-            CORE_RETURN_ERROR(s.append(", "));
-            CORE_RETURN_ERROR(s.append(max));
-            CORE_RETURN_ERROR(s.append(")"));
-            return ErrorCode::NONE;
+        void toString(BufferString& s) const {
+            s.append("Box(");
+            s.append(min).append(", ");
+            s.append(max).append(")");
         }
     };
 }

+ 8 - 10
include/core/math/Frustum.hpp

@@ -24,16 +24,14 @@ namespace Core {
         bool isInside(const Vector3& pos) const;
         bool isInside(const Vector3& pos, float radius) const;
 
-        template<typename String>
-        check_return Error toString(String& s) const {
-            CORE_RETURN_ERROR(s.append("(tan = "));
-            CORE_RETURN_ERROR(s.append(tan));
-            CORE_RETURN_ERROR(s.append(", nearClip = "));
-            CORE_RETURN_ERROR(s.append(nearClip));
-            CORE_RETURN_ERROR(s.append(", farClip = "));
-            CORE_RETURN_ERROR(s.append(farClip));
-            CORE_RETURN_ERROR(s.append(')'));
-            return ErrorCode::NONE;
+        void toString(BufferString& s) const {
+            s.append("(tan = ");
+            s.append(tan);
+            s.append(", nearClip = ");
+            s.append(nearClip);
+            s.append(", farClip = ");
+            s.append(farClip);
+            s.append(')');
         }
     };
 }

+ 7 - 12
include/core/math/Matrix.hpp

@@ -37,18 +37,13 @@ namespace Core {
         Matrix& rotateZ(float degrees);
         Matrix& rotate(const Quaternion& q);
 
-        template<typename String>
-        check_return Error toString(String& s) const {
-            CORE_RETURN_ERROR(s.append('['));
-            CORE_RETURN_ERROR(s.append(data[0]));
-            CORE_RETURN_ERROR(s.append(", "));
-            CORE_RETURN_ERROR(s.append(data[1]));
-            CORE_RETURN_ERROR(s.append(", "));
-            CORE_RETURN_ERROR(s.append(data[2]));
-            CORE_RETURN_ERROR(s.append(", "));
-            CORE_RETURN_ERROR(s.append(data[3]));
-            CORE_RETURN_ERROR(s.append("]"));
-            return ErrorCode::NONE;
+        void toString(BufferString& s) const {
+            s.append('[');
+            s.append(data[0]).append(", ");
+            s.append(data[1]).append(", ");
+            s.append(data[2]).append(", ");
+            s.append(data[3]);
+            s.append("]");
         }
 
     private:

+ 7 - 8
include/core/math/MatrixStack.hpp

@@ -11,16 +11,16 @@ namespace Core {
 
     public:
         MatrixStack() : stack() {
-            (void)stack.add(Matrix());
+            stack.add(Matrix());
         }
 
         void pop() {
             assert(stack.getLength() > 0);
-            return stack.removeLast();
+            stack.removeLast();
         }
 
-        check_return Error push() {
-            return stack.add(peek());
+        void push() {
+            stack.add(peek());
         }
 
         Matrix& peek() {
@@ -35,12 +35,11 @@ namespace Core {
 
         void clear() {
             stack.clear();
-            (void)stack.add(Matrix());
+            stack.add(Matrix());
         }
 
-        template<typename String>
-        check_return Error toString(String& s) const {
-            return s.append(stack);
+        void toString(BufferString& s) const {
+            s.append(stack);
         }
     };
 }

+ 10 - 12
include/core/math/Plane.hpp

@@ -14,18 +14,16 @@ namespace Core {
         Plane(const Vector3& a, const Vector3& b, const Vector3& c);
         float getSignedDistance(const Vector3& v) const;
 
-        template<typename String>
-        check_return Error toString(String& s) const {
-            CORE_RETURN_ERROR(s.append("("));
-            CORE_RETURN_ERROR(s.append(abc[0]));
-            CORE_RETURN_ERROR(s.append(" x + "));
-            CORE_RETURN_ERROR(s.append(abc[1]));
-            CORE_RETURN_ERROR(s.append(" y + "));
-            CORE_RETURN_ERROR(s.append(abc[2]));
-            CORE_RETURN_ERROR(s.append(" z + "));
-            CORE_RETURN_ERROR(s.append(d));
-            CORE_RETURN_ERROR(s.append(')'));
-            return ErrorCode::NONE;
+        void toString(BufferString& s) const {
+            s.append("(");
+            s.append(abc[0]);
+            s.append(" x + ");
+            s.append(abc[1]);
+            s.append(" y + ");
+            s.append(abc[2]);
+            s.append(" z + ");
+            s.append(d);
+            s.append(')');
         }
     };
 }

+ 10 - 12
include/core/math/Quaternion.hpp

@@ -18,18 +18,16 @@ namespace Core {
         Quaternion operator*(const Quaternion& other) const;
         Vector3 operator*(const Vector3& v) const;
 
-        template<typename String>
-        check_return Error toString(String& s) const {
-            CORE_RETURN_ERROR(s.append("("));
-            CORE_RETURN_ERROR(s.append(xyz[0]));
-            CORE_RETURN_ERROR(s.append(" i + "));
-            CORE_RETURN_ERROR(s.append(xyz[1]));
-            CORE_RETURN_ERROR(s.append(" j + "));
-            CORE_RETURN_ERROR(s.append(xyz[2]));
-            CORE_RETURN_ERROR(s.append(" k + "));
-            CORE_RETURN_ERROR(s.append(w));
-            CORE_RETURN_ERROR(s.append(')'));
-            return ErrorCode::NONE;
+        void toString(BufferString& s) const {
+            s.append("(");
+            s.append(xyz[0]);
+            s.append(" i + ");
+            s.append(xyz[1]);
+            s.append(" j + ");
+            s.append(xyz[2]);
+            s.append(" k + ");
+            s.append(w);
+            s.append(')');
         }
     };
 }

+ 5 - 7
include/core/math/Vector.hpp

@@ -162,17 +162,15 @@ namespace Core {
             return cast;
         }
 
-        template<typename String>
-        check_return Error toString(String& s) const {
-            CORE_RETURN_ERROR(s.append("["));
+        void toString(BufferString& s) const {
+            s.append("[");
             for(size_t i = 0; i < N - 1; i++) {
-                CORE_RETURN_ERROR(s.append(values[i]));
-                CORE_RETURN_ERROR(s.append(", "));
+                s.append(values[i]).append(", ");
             }
             if(N > 0) {
-                CORE_RETURN_ERROR(s.append(values[N - 1]));
+                s.append(values[N - 1]);
             }
-            return s.append("]");
+            s.append("]");
         }
     };
 

+ 86 - 169
include/core/utils/ArrayString.hpp

@@ -9,242 +9,159 @@
 #include "core/utils/Utility.hpp"
 
 namespace Core {
-    namespace Internal {
-        template<typename String, typename T>
-        CError genericAppend(String& s, const T& t) {
-            if constexpr(requires { t.toString(s); }) {
-                return t.toString(s);
-            } else if constexpr(requires { static_cast<const char*>(t); }) {
-                return s.append(static_cast<const char*>(t));
-            } else {
-                char buffer[64];
-                toString(t, buffer, CORE_SIZE(buffer));
-                return s.append(static_cast<const char*>(buffer));
-            }
-        }
-
-        template<typename S, typename T, typename... Args>
-        CError formatR(const S& f, S& s, size_t index, const T& t,
-                       Args&&... args) {
-            size_t l = f.getLength();
-            while(index < l) {
-                auto u = f[index++];
-                if(u == '#') {
-                    if(index >= l || f[index] != '#') {
-                        break;
-                    }
-                    index++;
-                }
-                CORE_RETURN_ERROR(s.append(u));
-            }
-            CORE_RETURN_ERROR(s.append(t));
-            if constexpr(sizeof...(args) > 0) {
-                return formatR(f, s, index, forward<Args>(args)...);
-            }
-            while(index < f.getLength()) {
-                CORE_RETURN_ERROR(s.append(f[index++]));
-            }
-            return ErrorCode::NONE;
-        }
-    }
-
-    template<typename String, typename... Args>
-    CError copyFormat(String& result, String& s, Args&&... args) {
-        if constexpr(sizeof...(args) > 0) {
-            Error e = Internal::formatR(result, s, 0, forward<Args>(args)...);
-            return e | result.copyFrom(s);
-        }
-        return ErrorCode::NONE;
-    }
-
-    class Char32String;
-
-    class CharString {
+    class BufferString {
     protected:
         size_t length;
         size_t capacity;
         char* data;
 
     public:
-        CharString(char* buffer, size_t bufferSize);
-        CharString(const CharString&) = delete;
-        CharString& operator=(const CharString&) = delete;
-        CError copyFrom(const CharString& s);
+        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 CharString& other) const;
+        bool operator==(const BufferString& other) const;
         bool operator!=(const char* s) const;
-        bool operator!=(const CharString& other) const;
+        bool operator!=(const BufferString& other) const;
         char operator[](size_t index) const;
         size_t getLength() const;
         size_t getCapacity() const;
-        CError append(char c);
-        CError append(signed char c);
-        CError append(unsigned char c);
-        CError append(wchar_t c);
-        CError append(c32 c);
-        CError append(const char* s);
-        CError append(const c32* s);
-        CError append(const signed char* s);
-        CError append(const unsigned char* s);
-        CError append(bool b);
+        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>
-        CError append(const T& t) {
-            return Internal::genericAppend(*this, 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;
         }
 
-        CError toString(CharString& s) const;
-        CError toString(Char32String& s) const;
+        void toString(BufferString& s) const;
         void clear();
         void print() const;
         void printLine() const;
 
         template<typename... Args>
-        CError format(CharString& s, Args&&... args) {
-            return copyFormat(*this, s, Core::forward<Args>(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 CharString& other, size_t from = 0) const;
-        size_t search(const CharString& other, size_t from = 0) const;
-        bool contains(const CharString& other, size_t from = 0) const;
+        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;
-        CError substring(CharString& s, size_t from, size_t to) const;
-        CError substring(CharString& s, size_t from = 0) const;
-        CError replace(CharString& s, const CharString& search,
-                       const CharString& replace);
+        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;
-    };
-
-    class Char32String {
-    protected:
-        size_t length;
-        size_t capacity;
-        c32* data;
 
-    public:
-        Char32String(c32* buffer, size_t bufferSize);
-        Char32String(const Char32String&) = delete;
-        Char32String& operator=(const Char32String&) = delete;
-        Error copyFrom(const Char32String& s);
-        bool operator==(const c32* s) const;
-        bool operator==(const Char32String& other) const;
-        bool operator!=(const c32* s) const;
-        bool operator!=(const Char32String& other) const;
-        c32 operator[](size_t index) const;
-        size_t getLength() const;
-        size_t getCapacity() const;
-        CError append(char c);
-        CError append(signed char c);
-        CError append(unsigned char c);
-        CError append(wchar_t c);
-        CError append(c32 c);
-        CError append(const char* s);
-        CError append(const c32* s);
-        CError append(const signed char* s);
-        CError append(const unsigned char* s);
-        CError append(bool b);
-
-        template<typename T>
-        CError append(const T& t) {
-            return Internal::genericAppend(*this, t);
-        }
-
-        CError toString(CharString& s) const;
-        CError toString(Char32String& s) const;
-        void clear();
-        void print() const;
-        void printLine() const;
-
-        template<typename... Args>
-        CError format(Char32String& s, Args&&... args) {
-            return copyFormat(*this, s, Core::forward<Args>(args)...);
+    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++]);
+            }
         }
-
-        bool startsWith(const Char32String& other, size_t from = 0) const;
-        size_t search(const Char32String& other, size_t from = 0) const;
-        bool contains(const Char32String& other, size_t from = 0) const;
-        size_t search(c32 u, size_t from = 0) const;
-        bool contains(c32 u, size_t from = 0) const;
-        CError substring(Char32String& s, size_t from, size_t to) const;
-        CError substring(Char32String& s, size_t from = 0) const;
-        CError replace(Char32String& s, const Char32String& search,
-                       const Char32String& replace);
-        void replace(c32 search, c32 replace);
-        operator const c32*() const;
     };
 
-    template<size_t N, typename C, typename B>
-    class ArrayString final : public B {
-        C data[N];
+    template<size_t N>
+    class ArrayString final : public BufferString {
+        char data[N];
 
     public:
-        ArrayString() : B(data, N) {
+        ArrayString() : BufferString(data, N) {
         }
 
-        ArrayString(const ArrayString& other) : B(data, N) {
+        ArrayString(const ArrayString& other) : BufferString(data, N) {
             memcpy(data, other.data, sizeof(data));
-            B::length = other.length;
+            length = other.length;
         }
 
         ArrayString& operator=(const ArrayString& other) {
             if(this != &other) {
                 memcpy(data, other.data, sizeof(data));
-                B::length = other.length;
+                length = other.length;
             }
             return *this;
         }
 
         template<typename... Args>
-        CError format(Args&&... args) {
+        ArrayString& format(Args&&... args) {
             ArrayString s;
-            return B::format(s, Core::forward<Args>(args)...);
+            BufferString::format(s, Core::forward<Args>(args)...);
+            return *this;
         }
 
-        CError replace(const B& search, const B& replace) {
+        void replace(const BufferString& search, const BufferString& replace) {
             ArrayString s;
-            return B::replace(s, search, replace);
+            BufferString::replace(s, search, replace);
         }
 
-        using B::replace;
+        using BufferString::replace;
     };
 
     template<typename String, typename Iterable>
-    CError toString(String& s, const Iterable& i) {
-        CORE_RETURN_ERROR(s.append("["));
+    void toString(String& s, const Iterable& i) {
+        s.append("[");
         auto current = i.begin();
         auto end = i.end();
         while(current != end) {
-            CORE_RETURN_ERROR(s.append(*current));
+            s.append(*current);
             ++current;
             if(current != end) {
-                CORE_RETURN_ERROR(s.append(", "));
+                s.append(", ");
             }
         }
-        return s.append("]");
+        s.append("]");
     }
-
-    template<size_t N>
-    using String8 = ArrayString<N, char, CharString>;
-
-    template<size_t N>
-    using String32 = ArrayString<N, c32, Char32String>;
-}
-
-inline bool operator==(const c32* cs, const Core::Char32String& s) {
-    return s == cs;
-}
-
-inline bool operator!=(const c32* cs, const Core::Char32String& s) {
-    return s != cs;
 }
 
-inline bool operator==(const char* cs, const Core::CharString& s) {
+inline bool operator==(const char* cs, const Core::BufferString& s) {
     return s == cs;
 }
 
-inline bool operator!=(const char* cs, const Core::CharString& s) {
+inline bool operator!=(const char* cs, const Core::BufferString& s) {
     return s != cs;
 }
 

+ 10 - 19
include/core/utils/Logger.hpp

@@ -15,10 +15,6 @@ namespace Core::Logger {
 
     const char* getFileName(const char* path);
 
-    inline bool filterError(Error e) {
-        return e != ErrorCode::NONE && e != ErrorCode::CAPACITY_REACHED;
-    }
-
     // aborts on critical logging failure
     template<typename... Args>
     void log(Level l, const char* file, int line, const char* prefix,
@@ -27,26 +23,21 @@ namespace Core::Logger {
             return;
         }
         file = getFileName(file);
-        Core::String32<2048> s;
-        if(filterError(s.append(prefix)) || filterError(s.append(tag)) ||
-           filterError(s.append("#:# | ")) ||
-           filterError(s.format(file, line)) || filterError(s.append(format)) ||
-           filterError(s.format(Core::forward<Args>(args)...)) ||
-           filterError(s.append(COLOR_RESET))) {
-            CORE_EXIT(1); // CoverageIgnore
-        }
+        Core::ArrayString<2048> s;
+        s.append(prefix).append(tag).append("#:# | ");
+        s.format(file, line);
+        s.append(format);
+        s.format(Core::forward<Args>(args)...);
+        s.append(COLOR_RESET);
         s.printLine();
     }
 
     template<typename... Args>
     void log(const char* prefix, const char* format, Args&&... args) {
-        Core::String32<2048> s;
-        if(filterError(s.append(prefix)) || filterError(s.append(format)) ||
-           filterError(s.format(Core::forward<Args>(args)...)) ||
-           filterError(s.append(COLOR_RESET))) {
-            CORE_EXIT(1); // CoverageIgnore
-        }
-        s.printLine();
+        Core::ArrayString<2048> s;
+        s.append(prefix).append(format);
+        s.format(Core::forward<Args>(args)...);
+        s.append(COLOR_RESET).printLine();
     }
 }
 

+ 0 - 2
include/core/utils/Utility.hpp

@@ -5,8 +5,6 @@
 #include "core/utils/Error.hpp"
 #include "core/utils/Types.hpp"
 
-#define CORE_SIZE(t) static_cast<i64>(sizeof(t))
-
 namespace Core {
     template<typename T, typename C = int>
     C popCount(const T& t) {

+ 63 - 294
src/ArrayString.cpp

@@ -9,10 +9,8 @@
 #include "core/utils/Error.hpp"
 #include "core/utils/Utility.hpp"
 
-using CharString = Core::CharString;
-using Char32String = Core::Char32String;
+using BufferString = Core::BufferString;
 using Error = Core::Error;
-namespace ErrorCode = Core::ErrorCode;
 
 constexpr size_t stringLength(const c32* c) {
     const c32* i = c + 1;
@@ -20,419 +18,190 @@ constexpr size_t stringLength(const c32* c) {
     return static_cast<size_t>(c - i);
 }
 
-static Error readUnicode(c32& u, const char*& s) {
+[[maybe_unused]] static c32 readUnicode(const char*& s) {
     size_t limit = MB_CUR_MAX;
+    c32 u = '?';
     size_t n = mbrtoc32(&u, s, limit, nullptr);
-    if(n > limit) {
-        return ErrorCode::INVALID_CHAR;
-    }
-    s += n;
-    return ErrorCode::NONE;
+    s += n > limit ? 1 : n;
+    return u;
 }
 
 using C32Buffer = Core::Array<char, MB_LEN_MAX + 1>;
 
-static Error convertC32(C32Buffer& buffer, c32 c) {
+static C32Buffer convertC32(c32 c) {
+    C32Buffer buffer;
     size_t n = c32rtomb(buffer.begin(), c, nullptr);
     if(n >= buffer.getLength()) {
-        return ErrorCode::INVALID_CHAR;
+        buffer[0] = '?';
+        buffer[1] = '\0';
+    } else {
+        buffer[n] = '\0';
     }
-    buffer[n] = '\0';
-    return ErrorCode::NONE;
+    return buffer;
 }
 
-CharString::CharString(char* buffer, size_t bufferSize)
+BufferString::BufferString(char* buffer, size_t bufferSize)
     : length(0), capacity(bufferSize <= 0 ? 0 : bufferSize - 1), data(buffer) {
     data[0] = '\0';
 }
 
-Error CharString::copyFrom(const CharString& s) {
+BufferString& BufferString::operator=(const BufferString& other) {
     clear();
-    return s.toString(*this);
+    other.toString(*this);
+    return *this;
 }
 
-bool CharString::operator==(const char* s) const {
+bool BufferString::operator==(const char* s) const {
     return strcmp(data, s) == 0;
 }
 
-bool CharString::operator==(const CharString& other) const {
+bool BufferString::operator==(const BufferString& other) const {
     return length == other.length && strcmp(data, other.data) == 0;
 }
 
-bool CharString::operator!=(const char* s) const {
+bool BufferString::operator!=(const char* s) const {
     return !((*this) == s);
 }
 
-bool CharString::operator!=(const CharString& other) const {
+bool BufferString::operator!=(const BufferString& other) const {
     return !((*this) == other);
 }
 
-char CharString::operator[](size_t index) const {
+char BufferString::operator[](size_t index) const {
     return data[index];
 }
 
-size_t CharString::getLength() const {
+size_t BufferString::getLength() const {
     return length;
 }
 
-size_t CharString::getCapacity() const {
+size_t BufferString::getCapacity() const {
     return capacity;
 }
 
-Error CharString::append(char c) {
-    if(length >= capacity) {
-        return ErrorCode::CAPACITY_REACHED;
+BufferString& BufferString::append(char c) {
+    if(length < capacity) {
+        data[length++] = c;
+        data[length] = '\0';
     }
-    data[length++] = c;
-    data[length] = '\0';
-    return ErrorCode::NONE;
+    return *this;
 }
 
-Error CharString::append(signed char c) {
+BufferString& BufferString::append(signed char c) {
     return append(static_cast<char>(c));
 }
 
-Error CharString::append(unsigned char c) {
+BufferString& BufferString::append(unsigned char c) {
     return append(static_cast<char>(c));
 }
 
-Error CharString::append(wchar_t c) {
+BufferString& BufferString::append(wchar_t c) {
     return append(static_cast<c32>(c));
 }
 
-Error CharString::append(c32 c) {
-    C32Buffer buffer;
-    CORE_RETURN_ERROR(convertC32(buffer, c));
-    return append(static_cast<const char*>(buffer.begin()));
+BufferString& BufferString::append(c32 c) {
+    return append(static_cast<const char*>(convertC32(c).begin()));
 }
 
-Error CharString::append(const char* s) {
+BufferString& BufferString::append(const char* s) {
     // stringLength as s could be some part of data
     for(size_t i = strlen(s); i > 0; i--) {
-        CORE_RETURN_ERROR(append(*(s++)));
+        append(*(s++));
     }
-    return ErrorCode::NONE;
+    return *this;
 }
 
-Error CharString::append(const c32* s) {
+BufferString& BufferString::append(const c32* s) {
     // stringLength as s could be some part of data
     for(size_t i = stringLength(s); i > 0; i--) {
-        CORE_RETURN_ERROR(append(*(s++)));
+        append(*(s++));
     }
-    return ErrorCode::NONE;
+    return *this;
 }
 
-Error CharString::append(const signed char* s) {
+BufferString& BufferString::append(const signed char* s) {
     return append(reinterpret_cast<const char*>(s));
 }
 
-Error CharString::append(const unsigned char* s) {
+BufferString& BufferString::append(const unsigned char* s) {
     return append(reinterpret_cast<const char*>(s));
 }
 
-Error CharString::append(bool b) {
+BufferString& BufferString::append(bool b) {
     return b ? append("true") : append("false");
 }
 
-Error CharString::toString(CharString& s) const {
+void BufferString::toString(BufferString& s) const {
     size_t l = length; // length changes if &s == this
     for(size_t i = 0; i < l; i++) {
-        CORE_RETURN_ERROR(s.append(data[i]));
+        s.append(data[i]);
     }
-    return ErrorCode::NONE;
-}
-
-Error CharString::toString(Char32String& s) const {
-    return s.append(static_cast<const char*>(data));
 }
 
-void CharString::clear() {
+void BufferString::clear() {
     length = 0;
     data[0] = '\0';
 }
 
-void CharString::print() const {
+void BufferString::print() const {
     Core::print(data);
 }
 
-void CharString::printLine() const {
+void BufferString::printLine() const {
     Core::printLine(data);
 }
 
-bool CharString::startsWith(const CharString& other, size_t from) const {
+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 CharString::search(const CharString& other, size_t from) const {
+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 CharString::contains(const CharString& other, size_t from) const {
+bool BufferString::contains(const BufferString& other, size_t from) const {
     return search(other, from) != SIZE_MAX;
 }
 
-size_t CharString::search(char u, size_t from) const {
+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 CharString::contains(char u, size_t from) const {
-    return search(u, from) != SIZE_MAX;
-}
-
-Error CharString::substring(CharString& s, size_t from, size_t to) const {
-    s.clear();
-    to = Math::min(to + 1, length);
-    for(size_t i = from; i < to; i++) {
-        CORE_RETURN_ERROR(s.append(data[i]));
-    }
-    return ErrorCode::NONE;
-}
-
-Error CharString::substring(CharString& s, size_t from) const {
-    return substring(s, from, length - 1);
-}
-
-Error CharString::replace(CharString& s, const CharString& search,
-                          const CharString& replace) {
-    size_t i = 0;
-    while(i < length) {
-        if(startsWith(search, i)) {
-            CORE_RETURN_ERROR(s.append(replace));
-            i += search.getLength();
-        } else {
-            CORE_RETURN_ERROR(s.append(data[i]));
-            i++;
-        }
-    }
-    return copyFrom(s);
-}
-
-void CharString::replace(char search, char replace) {
-    for(size_t i = 0; i < length; i++) {
-        if(data[i] == search) {
-            data[i] = replace;
-        }
-    }
-}
-
-CharString::operator const char*() const {
-    return data;
-}
-
-Char32String::Char32String(c32* buffer, size_t bufferSize)
-    : length(0), capacity(bufferSize <= 0 ? 0 : bufferSize - 1), data(buffer) {
-    data[0] = '\0';
-}
-
-Error Char32String::copyFrom(const Char32String& s) {
-    clear();
-    return s.toString(*this);
-}
-
-bool Char32String::operator==(const c32* s) const {
-    const c32* p = data;
-    while(*s == *p && *s != '\0') {
-        s++;
-        p++;
-    }
-    return *s == *p;
-}
-
-bool Char32String::operator==(const Char32String& other) const {
-    if(length != other.getLength()) {
-        return false;
-    }
-    for(size_t i = 0; i < length; i++) {
-        if(data[i] != other[i]) {
-            return false;
-        }
-    }
-    return true;
-}
-
-bool Char32String::operator!=(const c32* s) const {
-    return !((*this) == s);
-}
-
-bool Char32String::operator!=(const Char32String& other) const {
-    return !((*this) == other);
-}
-
-c32 Char32String::operator[](size_t index) const {
-    return data[index];
-}
-
-size_t Char32String::getLength() const {
-    return length;
-}
-
-size_t Char32String::getCapacity() const {
-    return capacity;
-}
-
-Error Char32String::append(char c) {
-    return append(static_cast<c32>(c));
-}
-
-Error Char32String::append(signed char c) {
-    return append(static_cast<char>(c));
-}
-
-Error Char32String::append(unsigned char c) {
-    return append(static_cast<char>(c));
-}
-
-Error Char32String::append(wchar_t c) {
-    return append(static_cast<c32>(c));
-}
-
-Error Char32String::append(c32 c) {
-    if(length >= capacity) {
-        return ErrorCode::CAPACITY_REACHED;
-    }
-    data[length++] = c;
-    data[length] = '\0';
-    return ErrorCode::NONE;
-}
-
-Error Char32String::append(const char* s) {
-    while(true) {
-        c32 u = 0;
-        CORE_RETURN_ERROR(readUnicode(u, s));
-        if(u == 0) {
-            return ErrorCode::NONE;
-        }
-        CORE_RETURN_ERROR(append(u));
-    }
-}
-
-Error Char32String::append(const c32* s) {
-    // stringLength as s could be some part of data
-    for(size_t i = stringLength(s); i > 0; i--) {
-        CORE_RETURN_ERROR(append(*(s++)));
-    }
-    return ErrorCode::NONE;
-}
-
-Error Char32String::append(const signed char* s) {
-    return append(reinterpret_cast<const char*>(s));
-}
-
-Error Char32String::append(const unsigned char* s) {
-    return append(reinterpret_cast<const char*>(s));
-}
-
-Error Char32String::append(bool b) {
-    return b ? append("true") : append("false");
-}
-
-Error Char32String::toString(CharString& s) const {
-    size_t l = length; // length changes if &s == this
-    for(size_t i = 0; i < l; i++) {
-        CORE_RETURN_ERROR(s.append(data[i]));
-    }
-    return ErrorCode::NONE;
-}
-
-Error Char32String::toString(Char32String& s) const {
-    size_t l = length; // length changes if &s == this
-    for(size_t i = 0; i < l; i++) {
-        CORE_RETURN_ERROR(s.append(data[i]));
-    }
-    return ErrorCode::NONE;
-}
-
-void Char32String::clear() {
-    length = 0;
-    data[0] = '\0';
-}
-
-void Char32String::print() const {
-    for(size_t i = 0; i < length; i++) {
-        C32Buffer buffer;
-        if(convertC32(buffer, data[i]).check()) {
-            Core::print('?');
-        } else {
-            Core::print(buffer.begin());
-        }
-    }
-}
-
-void Char32String::printLine() const {
-    print();
-    Core::print('\n');
-}
-
-bool Char32String::startsWith(const Char32String& other, size_t from) const {
-    if(from + other.getLength() > length) {
-        return false;
-    }
-    for(size_t i = 0; i < other.getLength(); i++) {
-        if(data[from + i] != other[i]) {
-            return false;
-        }
-    }
-    return true;
-}
-
-size_t Char32String::search(const Char32String& other, size_t from) const {
-    for(size_t i = from; i < length; i++) {
-        if(startsWith(other, i)) {
-            return i;
-        }
-    }
-    return SIZE_MAX;
-}
-
-bool Char32String::contains(const Char32String& other, size_t from) const {
-    return search(other, from) != SIZE_MAX;
-}
-
-size_t Char32String::search(c32 u, size_t from) const {
-    for(size_t i = from; i < length; i++) {
-        if(data[i] == u) {
-            return i;
-        }
-    }
-    return SIZE_MAX;
-}
-
-bool Char32String::contains(c32 u, size_t from) const {
+bool BufferString::contains(char u, size_t from) const {
     return search(u, from) != SIZE_MAX;
 }
 
-Error Char32String::substring(Char32String& s, size_t from, size_t to) const {
+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++) {
-        CORE_RETURN_ERROR(s.append(data[i]));
+        s.append(data[i]);
     }
-    return ErrorCode::NONE;
 }
 
-Error Char32String::substring(Char32String& s, size_t from) const {
-    return substring(s, from, length - 1);
+void BufferString::substring(BufferString& s, size_t from) const {
+    substring(s, from, length - 1);
 }
 
-Error Char32String::replace(Char32String& s, const Char32String& search,
-                            const Char32String& replace) {
+void BufferString::replace(BufferString& s, const BufferString& search,
+                           const BufferString& replace) {
     size_t i = 0;
     while(i < length) {
         if(startsWith(search, i)) {
-            CORE_RETURN_ERROR(s.append(replace));
+            s.append(replace);
             i += search.getLength();
         } else {
-            CORE_RETURN_ERROR(s.append(data[i]));
+            s.append(data[i]);
             i++;
         }
     }
-    return copyFrom(s);
+    *this = s;
 }
 
-void Char32String::replace(c32 search, c32 replace) {
+void BufferString::replace(char search, char replace) {
     for(size_t i = 0; i < length; i++) {
         if(data[i] == search) {
             data[i] = replace;
@@ -440,6 +209,6 @@ void Char32String::replace(c32 search, c32 replace) {
     }
 }
 
-Char32String::operator const c32*() const {
+BufferString::operator const char*() const {
     return data;
 }

+ 24 - 25
src/BitArray.cpp

@@ -16,9 +16,9 @@ static constexpr u64 U64_BITS = 64;
 static constexpr u64 DIVIDE_BITS = Core::Math::roundUpLog2(U64_BITS);
 static constexpr u64 LENGTH_MASK = 0x01FF'FFFF'FFFF'FFFF;
 static constexpr u64 LENGTH_BITS = Core::Math::roundUpLog2(LENGTH_MASK);
-static_assert(LENGTH_BITS == 57, "wusi");
+static_assert(LENGTH_BITS == 57, "bit array calculation error");
 
-static u64 readBits(const u64* data, u64 index, u64 bits) {
+static u64 readBits(const u64* data, size_t index, u64 bits) {
     u64 dataIndexA = (index * bits) >> DIVIDE_BITS;
     u64 dataIndexB = ((index * bits) + (bits - 1lu)) >> DIVIDE_BITS;
     u64 shifts = (index * bits) & (U64_BITS - 1lu);
@@ -31,7 +31,7 @@ static u64 readBits(const u64* data, u64 index, u64 bits) {
     return r;
 }
 
-static void setBits(u64* data, u64 index, u64 bits, u64 value) {
+static void setBits(u64* data, size_t index, size_t bits, u64 value) {
     u64 mask = (1lu << bits) - 1lu;
     value &= mask;
     u64 dataIndexA = (index * bits) >> DIVIDE_BITS;
@@ -46,20 +46,19 @@ static void setBits(u64* data, u64 index, u64 bits, u64 value) {
     }
 }
 
-static u64 getArrayLength(u64 length, u64 bits) {
+static size_t getArrayLength(size_t length, size_t bits) {
     return roundUpDivide(length * bits, U64_BITS);
 }
 
 Core::BitArray::BitArray() : lengthBits(0), data(nullptr) {
 }
 
-CError Core::BitArray::copyFrom(const BitArray& other) {
-    CORE_RETURN_ERROR(resize(other.getLength(), other.getBits()));
-    u64 length = getLength();
-    for(u64 i = 0; i < length; i++) {
+Core::BitArray::BitArray(const BitArray& other) : BitArray() {
+    (void)resize(other.getLength(), other.getBits());
+    size_t length = getLength();
+    for(size_t i = 0; i < length; i++) {
         set(i, other.get(i));
     }
-    return ErrorCode::NONE;
 }
 
 Core::BitArray::BitArray(BitArray&& other) : BitArray() {
@@ -70,12 +69,12 @@ Core::BitArray::~BitArray() {
     delete[] data;
 }
 
-Core::BitArray& Core::BitArray::operator=(BitArray&& other) {
+Core::BitArray& Core::BitArray::operator=(BitArray other) {
     swap(other);
     return *this;
 }
 
-Core::BitArray& Core::BitArray::set(u64 index, u64 value) {
+Core::BitArray& Core::BitArray::set(size_t index, u64 value) {
     if(data == nullptr || index >= getLength()) {
         return *this;
     }
@@ -83,26 +82,26 @@ Core::BitArray& Core::BitArray::set(u64 index, u64 value) {
     return *this;
 }
 
-u64 Core::BitArray::get(u64 index) const {
+u64 Core::BitArray::get(size_t index) const {
     if(data == nullptr || index >= getLength()) {
         return 0;
     }
     return readBits(data, index, getBits());
 }
 
-u64 Core::BitArray::getLength() const {
+size_t Core::BitArray::getLength() const {
     return lengthBits & LENGTH_MASK;
 }
 
-u64 Core::BitArray::getBits() const {
+size_t Core::BitArray::getBits() const {
     return (lengthBits & ~LENGTH_MASK) >> LENGTH_BITS;
 }
 
-u64 Core::BitArray::getInternalByteSize() const {
+size_t Core::BitArray::getInternalByteSize() const {
     if(getLength() <= 0 || getBits() <= 0) {
         return 0;
     }
-    return getArrayLength(getLength(), getBits()) * CORE_SIZE(u64);
+    return getArrayLength(getLength(), getBits()) * sizeof(u64);
 }
 
 i64 Core::BitArray::select(u64 index) const {
@@ -110,8 +109,8 @@ i64 Core::BitArray::select(u64 index) const {
         return -1;
     }
     u64 found = 0;
-    u64 end = getArrayLength(getLength(), getBits());
-    for(u64 i = 0; i < end; i++) {
+    size_t end = getArrayLength(getLength(), getBits());
+    for(size_t i = 0; i < end; i++) {
         u64 ones = Core::popCount<u64, u64>(data[i]);
         found += ones;
         if(found >= index) {
@@ -130,25 +129,25 @@ i64 Core::BitArray::select(u64 index) const {
 }
 
 void Core::BitArray::fill(u64 value) {
-    u64 length = getLength();
-    for(u64 i = 0; i < length; i++) {
+    size_t length = getLength();
+    for(size_t i = 0; i < length; i++) {
         set(i, value);
     }
 }
 
-CError Core::BitArray::resize(u64 newLength, u64 newBits) {
+CError Core::BitArray::resize(size_t newLength, size_t newBits) {
     if(newLength == 0 || newBits == 0 || newBits > 64) {
         return ErrorCode::INVALID_ARGUMENT;
     }
-    u64 arrayLength = getArrayLength(newLength, newBits);
+    size_t arrayLength = getArrayLength(newLength, newBits);
     u64* newData = new(noThrow) u64[arrayLength];
     memset(newData, 0, arrayLength * sizeof(int));
 
-    u64 end = Math::min(getLength(), newLength);
-    for(u64 i = 0; i < end; i++) {
+    size_t end = Math::min(getLength(), newLength);
+    for(size_t i = 0; i < end; i++) {
         setBits(newData, i, newBits, get(i));
     }
-    for(u64 i = end; i < newLength; i++) {
+    for(size_t i = end; i < newLength; i++) {
         setBits(newData, i, newBits, 0);
     }
     delete[] data;

+ 1 - 1
src/FileReader.cpp

@@ -44,7 +44,7 @@ Core::Error Core::FileReader::open(const char* p) {
     if(file != nullptr) {
         return ErrorCode::INVALID_STATE;
     }
-    CORE_RETURN_ERROR(path.append(p));
+    path.append(p);
     file = fopen(path, "rb");
     return file != nullptr ? ErrorCode::NONE : ErrorCode::CANNOT_OPEN_FILE;
 }

+ 5 - 9
test/Main.cpp

@@ -6,15 +6,13 @@
 #include "Tests.hpp"
 #include "core/utils/ArrayString.hpp"
 #include "core/utils/Utility.hpp"
+
 static void onExit(int code, void* data) {
     unsigned int i = *static_cast<unsigned int*>(data);
-    Core::String32<1024> s;
-    CORE_TEST_ERROR(s.append("Hello from exit #: #"));
-    CORE_TEST_ERROR(s.format(code, i));
+    Core::ArrayString<1024> s;
+    s.append("Hello from exit #: #");
+    s.format(code, i);
     s.printLine();
-    Core::String8<64> s8;
-    CORE_TEST_ERROR(s8.append("Hello from exit"));
-    s8.printLine();
     Core::Test::finalize();
 }
 
@@ -65,8 +63,6 @@ int main(int argAmount, const char** args) {
     unsigned int data = 123456789;
     Core::setExitHandler(onExit, &data);
 
-    char buffer[] = {-100, 0};
-    CORE_LOG_ERROR(buffer);
-
+    CORE_EXIT(1);
     return 0;
 }

+ 4 - 11
test/Test.hpp

@@ -48,17 +48,10 @@ namespace Core::Test {
         template<typename A, typename B>
         bool checkString(const char* file, int line, const A& wanted,
                          const B& actual) {
-            Error e = ErrorCode::NONE;
-            String32<2048> a;
-            if(checkError(e, a.append(wanted))) {
-                warn(file, line, e);
-                return false;
-            }
-            String32<2048> b;
-            if(checkError(e, b.append(actual))) {
-                warn(file, line, e);
-                return false;
-            }
+            ArrayString<2048> a;
+            a.append(wanted);
+            ArrayString<2048> b;
+            b.append(actual);
             return checkEqual(file, line, a, b);
         }
 

+ 17 - 50
test/modules/ArrayListTests.cpp

@@ -6,17 +6,14 @@ using IntList = Core::ArrayList<size_t, 20>;
 
 static void testAdd() {
     IntList list;
-    CORE_TEST_ERROR(list.add(5u));
-
+    list.add(5u);
     CORE_TEST_EQUAL(5, list[0]);
     CORE_TEST_EQUAL(1, list.getLength());
 }
 
 static void testMultipleAdd() {
     IntList list;
-    CORE_TEST_ERROR(list.add(4u));
-    CORE_TEST_ERROR(list.add(3u));
-    CORE_TEST_ERROR(list.add(2u));
+    list.add(4u).add(3u).add(2u);
     CORE_TEST_EQUAL(4, list[0]);
     CORE_TEST_EQUAL(3, list[1]);
     CORE_TEST_EQUAL(2, list[2]);
@@ -25,15 +22,14 @@ static void testMultipleAdd() {
 
 static void testAddReplace() {
     IntList list;
-    CORE_TEST_ERROR(list.add(5u));
+    list.add(5u);
     list[0] = 3;
     CORE_TEST_EQUAL(3, list[0]);
 }
 
 static void testClear() {
     IntList list;
-    CORE_TEST_ERROR(list.add(5u));
-    CORE_TEST_ERROR(list.add(4u));
+    list.add(5u).add(4u);
     list.clear();
     CORE_TEST_EQUAL(0, list.getLength());
 }
@@ -41,11 +37,11 @@ static void testClear() {
 static void testOverflow(bool light) {
     IntList list;
     for(size_t i = 0; i < 20; i++) {
-        CORE_TEST_ERROR(list.add(i));
+        list.add(i);
     }
     size_t limit = light ? 1000 : 100000;
     for(size_t i = 0; i < limit; i++) {
-        CORE_TEST_EQUAL(Core::ErrorCode::CAPACITY_REACHED, list.add(i));
+        list.add(i);
     }
     for(size_t i = 0; i < list.getLength(); i++) {
         CORE_TEST_EQUAL(i, list[i]);
@@ -54,10 +50,7 @@ static void testOverflow(bool light) {
 
 static void testCopy() {
     IntList list;
-    CORE_TEST_ERROR(list.add(1u));
-    CORE_TEST_ERROR(list.add(2u));
-    CORE_TEST_ERROR(list.add(3u));
-
+    list.add(1u).add(2u).add(3u);
     IntList copy(list);
     CORE_TEST_EQUAL(list.getLength(), copy.getLength());
     for(size_t i = 0; i < copy.getLength() && i < list.getLength(); i++) {
@@ -67,10 +60,7 @@ static void testCopy() {
 
 static void testCopyAssignment() {
     IntList list;
-    CORE_TEST_ERROR(list.add(1u));
-    CORE_TEST_ERROR(list.add(2u));
-    CORE_TEST_ERROR(list.add(3u));
-
+    list.add(1u).add(2u).add(3u);
     IntList copy;
     copy = list;
     CORE_TEST_EQUAL(list.getLength(), copy.getLength());
@@ -81,10 +71,7 @@ static void testCopyAssignment() {
 
 static void testMove() {
     IntList list;
-    CORE_TEST_ERROR(list.add(1u));
-    CORE_TEST_ERROR(list.add(2u));
-    CORE_TEST_ERROR(list.add(3u));
-
+    list.add(1u).add(2u).add(3u);
     IntList move(Core::move(list));
     CORE_TEST_EQUAL(0, list.getLength());
     CORE_TEST_EQUAL(3, move.getLength());
@@ -95,10 +82,7 @@ static void testMove() {
 
 static void testMoveAssignment() {
     IntList list;
-    CORE_TEST_ERROR(list.add(1u));
-    CORE_TEST_ERROR(list.add(2u));
-    CORE_TEST_ERROR(list.add(3u));
-
+    list.add(1u).add(2u).add(3u);
     IntList move;
     move = Core::move(list);
     CORE_TEST_EQUAL(0, list.getLength());
@@ -108,30 +92,17 @@ static void testMoveAssignment() {
     CORE_TEST_EQUAL(3, move[2]);
 }
 
-static void testToString1() {
+static void testToString() {
     IntList list;
-    CORE_TEST_ERROR(list.add(1u));
-    CORE_TEST_ERROR(list.add(243u));
-    CORE_TEST_ERROR(list.add(423u));
+    list.add(1u).add(243u).add(423u);
     CORE_TEST_STRING("[1, 243, 423]", list);
-}
-
-static void testToString2() {
-    IntList list;
-    CORE_TEST_ERROR(list.add(1u));
-    CORE_TEST_STRING("[1]", list);
-}
-
-static void testToString3() {
-    IntList list;
-    CORE_TEST_STRING("[]", list);
+    CORE_TEST_STRING("[1]", IntList().add(1u));
+    CORE_TEST_STRING("[]", IntList());
 }
 
 static void testRemove() {
     IntList list;
-    CORE_TEST_ERROR(list.add(4u));
-    CORE_TEST_ERROR(list.add(3u));
-    CORE_TEST_ERROR(list.add(2u));
+    list.add(4u).add(3u).add(2u);
     list.removeBySwap(0);
     CORE_TEST_EQUAL(2, list[0]);
     CORE_TEST_EQUAL(3, list[1]);
@@ -145,9 +116,7 @@ static void testRemove() {
 
 static void testForRange() {
     IntList list;
-    CORE_TEST_ERROR(list.add(1u));
-    CORE_TEST_ERROR(list.add(2u));
-    CORE_TEST_ERROR(list.add(3u));
+    list.add(1u).add(2u).add(3u);
     for(size_t& i : list) {
         i++;
     }
@@ -166,9 +135,7 @@ void Core::testArrayList(bool light) {
     testCopyAssignment();
     testMove();
     testMoveAssignment();
-    testToString1();
-    testToString2();
-    testToString3();
+    testToString();
     testRemove();
     testForRange();
 }

+ 249 - 780
test/modules/ArrayStringTests.cpp

@@ -3,20 +3,18 @@
 #include "core/utils/ArrayString.hpp"
 #include "core/utils/Error.hpp"
 
-template class Core::ArrayString<128, char, Core::CharString>;
-template class Core::ArrayString<128, c32, Core::Char32String>;
+template class Core::ArrayString<128>;
 
-using String8 = Core::String8<128>;
-using String32 = Core::String32<128>;
+using String = Core::ArrayString<128>;
 
-static String8 build(const char* cs) {
-    String8 s;
-    CORE_TEST_ERROR(s.append(cs));
+static String build(const char* cs) {
+    String s;
+    s.append(cs);
     return s;
 }
 
-static void testEquality8() {
-    String8 s = build("test");
+static void testEquality() {
+    String s = build("test");
     CORE_TEST_TRUE(s == "test");
     CORE_TEST_TRUE(s == build("test"));
     CORE_TEST_TRUE("test" == s);
@@ -25,9 +23,9 @@ static void testEquality8() {
     CORE_TEST_TRUE(s == s);
 }
 
-static void testUnicodeEquality8() {
+static void testUnicodeEquality() {
     const char* cs = "\u0040\u0400\u8000\U00100000";
-    String8 s = build(cs);
+    String s = build(cs);
     CORE_TEST_TRUE(s == cs);
     CORE_TEST_TRUE(s == build(cs));
     CORE_TEST_TRUE(cs == s);
@@ -35,8 +33,8 @@ static void testUnicodeEquality8() {
     CORE_TEST_TRUE(s == s);
 }
 
-static void testInequality8() {
-    String8 s = build("test");
+static void testInequality() {
+    String s = build("test");
     CORE_TEST_FALSE(s != "test");
     CORE_TEST_FALSE(s != build("test"));
     CORE_TEST_FALSE("test" != s);
@@ -44,209 +42,202 @@ static void testInequality8() {
     CORE_TEST_FALSE(s != s);
 }
 
-static void testStringAppend8() {
-    String8 s = build("test");
-    CORE_TEST_ERROR(s.append("22"));
-    CORE_TEST_ERROR(s.append("333"));
-    CORE_TEST_ERROR(s.append("4444"));
+static void testStringAppend() {
+    String s = build("test");
+    s.append("22").append("333").append("4444");
     CORE_TEST_EQUAL(build("test223334444"), s);
 }
 
-static void testStringAppendOverflow8() {
-    Core::String8<6> s;
-    CORE_TEST_ERROR(s.append("te"));
-    CORE_TEST_EQUAL(Core::ErrorCode::CAPACITY_REACHED, s.append("23334444"));
+static void testStringAppendOverflow() {
+    Core::ArrayString<6> s;
+    s.append("te").append("23334444");
     CORE_TEST_TRUE(build("te23334444") != s);
 }
 
-static void testCharacters8() {
-    String8 s = build("test");
+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 testLength8() {
-    String8 s = build("test");
+static void testLength() {
+    String s = build("test");
     CORE_TEST_EQUAL(4, s.getLength());
-    CORE_TEST_ERROR(s.append("aaa"));
+    s.append("aaa");
     CORE_TEST_EQUAL(7, s.getLength());
 }
 
-static void testChar8() {
-    String8 s = build("test");
+static void testChar() {
+    String s = build("test");
     for(char i = 'a'; i < 'd'; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("testabc"), s);
 }
 
-static void testSignedChar8() {
-    String8 s = build("test");
+static void testSignedChar() {
+    String s = build("test");
     for(signed char i = 'b'; i < 'e'; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("testbcd"), s);
 }
 
-static void testUnsignedChar8() {
-    String8 s = build("test");
+static void testUnsignedChar() {
+    String s = build("test");
     for(unsigned char i = 'c'; i < 'f'; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("testcde"), s);
 }
 
-static void testSignedShort8() {
-    String8 s = build("test");
+static void testSignedShort() {
+    String s = build("test");
     for(signed short i = 100; i < 103; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("test100101102"), s);
 }
 
-static void testUnsignedShort8() {
-    String8 s = build("test");
+static void testUnsignedShort() {
+    String s = build("test");
     for(unsigned short i = 101; i < 104; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("test101102103"), s);
 }
 
-static void testSignedInt8() {
-    String8 s = build("test");
+static void testSignedInt() {
+    String s = build("test");
     for(signed int i = 102; i < 105; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("test102103104"), s);
 }
 
-static void testUnsignedInt8() {
-    String8 s = build("test");
+static void testUnsignedInt() {
+    String s = build("test");
     for(unsigned int i = 103; i < 106; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("test103104105"), s);
 }
 
-static void testSignedLong8() {
-    String8 s = build("test");
+static void testSignedLong() {
+    String s = build("test");
     for(signed long i = 104; i < 107; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("test104105106"), s);
 }
 
-static void testUnsignedLong8() {
-    String8 s = build("test");
+static void testUnsignedLong() {
+    String s = build("test");
     for(unsigned long i = 105; i < 108; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("test105106107"), s);
 }
 
-static void testSignedLongLong8() {
-    String8 s = build("test");
+static void testSignedLongLong() {
+    String s = build("test");
     for(signed long long i = 106; i < 109; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("test106107108"), s);
 }
 
-static void testUnsignedLongLong8() {
-    String8 s = build("test");
+static void testUnsignedLongLong() {
+    String s = build("test");
     for(unsigned long long i = 107; i < 110; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("test107108109"), s);
 }
 
-static void testFloat8() {
-    String8 s = build("test");
+static void testFloat() {
+    String s = build("test");
     for(float i = 108; i < 111; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("test108.00109.00110.00"), s);
 }
 
-static void testDouble8() {
-    String8 s = build("test");
+static void testDouble() {
+    String s = build("test");
     for(double i = 109; i < 112; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("test109.00110.00111.00"), s);
 }
 
-static void testLongDouble8() {
-    String8 s = build("test");
+static void testLongDouble() {
+    String s = build("test");
     for(long double i = 110; i < 113; i++) {
-        CORE_TEST_ERROR(s.append(i));
+        s.append(i);
     }
     CORE_TEST_EQUAL(build("test110.00111.00112.00"), s);
 }
 
-static void testBool8() {
-    String8 s = build("test");
-    CORE_TEST_ERROR(s.append(true));
-    CORE_TEST_ERROR(s.append(false));
-    CORE_TEST_ERROR(s.append(true));
+static void testBool() {
+    String s = build("test");
+    s.append(true).append(false).append(true);
     CORE_TEST_EQUAL(build("testtruefalsetrue"), s);
 }
 
-static void testIntOverflow8() {
-    Core::String8<4> s;
-    CORE_TEST_EQUAL(Core::ErrorCode::CAPACITY_REACHED, s.append(123456));
+static void testIntOverflow() {
+    Core::ArrayString<4> s;
+    s.append(123456);
 
-    String8 o;
+    String o;
     for(size_t i = 0; i < s.getCapacity(); i++) {
-        CORE_TEST_ERROR(o.append(i + 1));
+        o.append(i + 1);
     }
 
     CORE_TEST_TRUE(o == s);
 }
 
-static void testUnicode8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append('\u0040'));
-    CORE_TEST_ERROR(s.append(L'\u0400'));
-    CORE_TEST_ERROR(s.append(L'\u8000'));
-    CORE_TEST_ERROR(s.append(U'\U00100000'));
+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 testClear8() {
-    String8 s = build("test");
-    CORE_TEST_ERROR(s.append(1234));
+static void testClear() {
+    String s = build("test");
+    s.append(1234);
     s.clear();
-    CORE_TEST_ERROR(s.append("wusi"));
-    CORE_TEST_ERROR(s.append("1234"));
+    s.append("wusi");
+    s.append("1234");
     CORE_TEST_EQUAL(build("wusi1234"), s);
 }
 
-static void testAddSelf8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("test1"));
-    CORE_TEST_ERROR(s.append(s));
-    CORE_TEST_ERROR(s.append(s));
+static void testAddSelf() {
+    String s;
+    s.append("test1").append(s).append(s);
     CORE_TEST_EQUAL(build("test1test1test1test1"), s);
 }
 
-static void testStartsWith8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("0123456789"));
-
-    String8 s2;
-    CORE_TEST_ERROR(s2.append("123"));
-    String8 s3;
-    CORE_TEST_ERROR(s3.append("234"));
-    String8 s4;
-    CORE_TEST_ERROR(s4.append("789"));
-    String8 s5;
-    CORE_TEST_ERROR(s5.append("124"));
-    String8 s6;
-    String8 s7;
-    CORE_TEST_ERROR(s7.append("7891"));
+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));
@@ -267,21 +258,21 @@ static void testStartsWith8() {
     CORE_TEST_FALSE(s.startsWith(s7, 7));
 }
 
-static void testSearch8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("0123456789"));
-
-    String8 s2;
-    CORE_TEST_ERROR(s2.append("123"));
-    String8 s3;
-    CORE_TEST_ERROR(s3.append("234"));
-    String8 s4;
-    CORE_TEST_ERROR(s4.append("789"));
-    String8 s5;
-    CORE_TEST_ERROR(s5.append("124"));
-    String8 s6;
-    String8 s7;
-    CORE_TEST_ERROR(s7.append("7891"));
+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));
@@ -298,21 +289,21 @@ static void testSearch8() {
     CORE_TEST_EQUAL(SIZE_MAX, s.search(s7, 3));
 }
 
-static void testContains8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("0123456789"));
-
-    String8 s2;
-    CORE_TEST_ERROR(s2.append("123"));
-    String8 s3;
-    CORE_TEST_ERROR(s3.append("234"));
-    String8 s4;
-    CORE_TEST_ERROR(s4.append("789"));
-    String8 s5;
-    CORE_TEST_ERROR(s5.append("124"));
-    String8 s6;
-    String8 s7;
-    CORE_TEST_ERROR(s7.append("7891"));
+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));
@@ -322,68 +313,68 @@ static void testContains8() {
     CORE_TEST_FALSE(s.contains(s7));
 }
 
-static void testSearchChar8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("01üää3ä"));
+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 testContainsChar8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("01üää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 testSubString8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("01üää3ä"));
+static void testSubString() {
+    String s;
+    s.append("01üää3ä");
 
-    String8 sub;
-    CORE_TEST_ERROR(s.substring(sub, 0));
+    String sub;
+    s.substring(sub, 0);
     CORE_TEST_STRING("01üää3ä", sub);
-    CORE_TEST_ERROR(s.substring(sub, 2));
+    s.substring(sub, 2);
     CORE_TEST_STRING("üää3ä", sub);
-    CORE_TEST_ERROR(s.substring(sub, 4));
+    s.substring(sub, 4);
     CORE_TEST_STRING("ää3ä", sub);
-    CORE_TEST_ERROR(s.substring(sub, 6));
+    s.substring(sub, 6);
     CORE_TEST_STRING("ä3ä", sub);
 
-    CORE_TEST_ERROR(s.substring(sub, 0, 10));
+    s.substring(sub, 0, 10);
     CORE_TEST_STRING("01üää3ä", sub);
-    CORE_TEST_ERROR(s.substring(sub, 1, 8));
+    s.substring(sub, 1, 8);
     CORE_TEST_STRING("1üää3", sub);
-    CORE_TEST_ERROR(s.substring(sub, 2, 7));
+    s.substring(sub, 2, 7);
     CORE_TEST_STRING("üää", sub);
-    CORE_TEST_ERROR(s.substring(sub, 4, 5));
+    s.substring(sub, 4, 5);
     CORE_TEST_STRING("ä", sub);
-    CORE_TEST_ERROR(s.substring(sub, 4, 2));
+    s.substring(sub, 4, 2);
     CORE_TEST_STRING("", sub);
-    CORE_TEST_ERROR(s.substring(sub, 6, 23));
+    s.substring(sub, 6, 23);
     CORE_TEST_STRING("ä3ä", sub);
 }
 
-static void testReplace8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("0äääää1üää3ä"));
+static void testReplace() {
+    String s;
+    s.append("0äääää1üää3ä");
 
-    String8 search;
-    CORE_TEST_ERROR(search.append("ää"));
+    String search;
+    search.append("ää");
 
-    String8 replace;
-    CORE_TEST_ERROR(replace.append("ABCD"));
-    CORE_TEST_ERROR(s.replace(search, replace));
+    String replace;
+    replace.append("ABCD");
+    s.replace(search, replace);
     CORE_TEST_STRING("0ABCDABCDä1üABCD3ä", s);
 }
 
-static void testReplaceChar8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("01YXX3X"));
+static void testReplaceChar() {
+    String s;
+    s.append("01YXX3X");
     s.replace('0', 'A');
     CORE_TEST_STRING("A1YXX3X", s);
     s.replace('1', 'B');
@@ -396,654 +387,132 @@ static void testReplaceChar8() {
     CORE_TEST_STRING("ABCDDED", s);
 }
 
-static void testCastAppendSelf8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("abc"));
-    CORE_TEST_ERROR(s.append(s));
-    CORE_TEST_ERROR(s.append(static_cast<const char*>(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 testCompareWithShorter8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("abc"));
+static void testCompareWithShorter() {
+    String s;
+    s.append("abc");
     CORE_TEST_FALSE(s == "ab");
 }
 
-static void testAppendSignedChar8() {
+static void testAppendSignedChar() {
     const signed char buffer[] = {'a', 'b', 'c', '\0'};
-    String8 s;
-    CORE_TEST_ERROR(s.append(buffer));
+    String s;
+    s.append(buffer);
     CORE_TEST_TRUE(s == "abc");
 }
 
-static void testAppendUnsignedChar8() {
+static void testAppendUnsignedChar() {
     const unsigned char buffer[] = {'a', 'b', 'c', '\0'};
-    String8 s;
-    CORE_TEST_ERROR(s.append(buffer));
+    String s;
+    s.append(buffer);
     CORE_TEST_TRUE(s == "abc");
 }
 
-static void testAppendError8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append(Core::ErrorCode::NONE));
+static void testAppendError() {
+    String s;
+    s.append(Core::ErrorCode::NONE);
     CORE_TEST_STRING("0", s);
 }
 
-static void testPrint8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append('\u0040'));
-    CORE_TEST_ERROR(s.append(L'\u0400'));
-    CORE_TEST_ERROR(s.append(L'\u8000'));
-    CORE_TEST_ERROR(s.append(U'\U00100000'));
+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.print();
 }
 
-static void testKeepHash8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("a ## test #### #####"));
-    CORE_TEST_ERROR(s.format(1, 2, 3, 4, 5, 6, 7, 8, 9));
+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 testFormatWithoutArguments8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append("wusi"));
-    CORE_TEST_ERROR(s.format());
+static void testFormatWithoutArguments() {
+    String s;
+    s.append("wusi");
+    s.format();
     CORE_TEST_STRING("wusi", s);
 }
 
-static void testUnicodeString8() {
-    String8 s;
-    CORE_TEST_ERROR(s.append(U"_üö§äab"));
+static void testUnicodeString() {
+    String s;
+    s.append(U"_üö§äab");
     CORE_TEST_STRING("_üö§äab", s);
 }
 
-static void testInvalidUnicodeString8() {
-    String8 s;
-    CORE_TEST_EQUAL(Core::ErrorCode::INVALID_CHAR,
-                    s.append(static_cast<c32>(0xFFFFFFFF)));
-}
-
-static String32 build(const c32* cs) {
-    String32 s;
-    CORE_TEST_ERROR(s.append(cs));
-    return s;
-}
-
-static void testEquality32() {
-    String32 s = build(U"test");
-    CORE_TEST_TRUE(s == U"test");
-    CORE_TEST_TRUE(s == build(U"test"));
-    CORE_TEST_TRUE(U"test" == s);
-    CORE_TEST_TRUE(build(U"test") == s);
-    CORE_TEST_FALSE(build(U"tes2") == s);
-    CORE_TEST_TRUE(s == s);
-}
-
-static void testUnicodeEquality32() {
-    const c32* cs = U"\u0040\u0400\u8000\U00100000";
-    String32 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 testInequality32() {
-    String32 s = build(U"test");
-    CORE_TEST_FALSE(s != U"test");
-    CORE_TEST_FALSE(s != build(U"test"));
-    CORE_TEST_FALSE(U"test" != s);
-    CORE_TEST_FALSE(build(U"test") != s);
-    CORE_TEST_FALSE(s != s);
-}
-
-static void testStringAppend32() {
-    String32 s = build(U"test");
-    CORE_TEST_ERROR(s.append(U"22"));
-    CORE_TEST_ERROR(s.append(U"333"));
-    CORE_TEST_ERROR(s.append(U"4444"));
-    CORE_TEST_EQUAL(build(U"test223334444"), s);
-}
-
-static void testStringAppendOverflow32() {
-    Core::String32<6> s;
-    CORE_TEST_ERROR(s.append(U"te"));
-    CORE_TEST_EQUAL(Core::ErrorCode::CAPACITY_REACHED, s.append(U"23334444"));
-    CORE_TEST_TRUE(build(U"te23334444") != s);
-}
-
-static void testCharacters32() {
-    String32 s = build(U"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 testLength32() {
-    String32 s = build(U"test");
-    CORE_TEST_EQUAL(4, s.getLength());
-    CORE_TEST_ERROR(s.append(U"aaa"));
-    CORE_TEST_EQUAL(7, s.getLength());
-}
-
-static void testChar32() {
-    String32 s = build(U"test");
-    for(char i = 'a'; i < 'd'; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"testabc"), s);
-}
-
-static void testSignedChar32() {
-    String32 s = build(U"test");
-    for(signed char i = 'b'; i < 'e'; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"testbcd"), s);
-}
-
-static void testUnsignedChar32() {
-    String32 s = build(U"test");
-    for(unsigned char i = 'c'; i < 'f'; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"testcde"), s);
-}
-
-static void testSignedShort32() {
-    String32 s = build(U"test");
-    for(signed short i = 100; i < 103; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"test100101102"), s);
-}
-
-static void testUnsignedShort32() {
-    String32 s = build(U"test");
-    for(unsigned short i = 101; i < 104; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"test101102103"), s);
-}
-
-static void testSignedInt32() {
-    String32 s = build(U"test");
-    for(signed int i = 102; i < 105; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"test102103104"), s);
-}
-
-static void testUnsignedInt32() {
-    String32 s = build(U"test");
-    for(unsigned int i = 103; i < 106; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"test103104105"), s);
-}
-
-static void testSignedLong32() {
-    String32 s = build(U"test");
-    for(signed long i = 104; i < 107; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"test104105106"), s);
-}
-
-static void testUnsignedLong32() {
-    String32 s = build(U"test");
-    for(unsigned long i = 105; i < 108; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"test105106107"), s);
-}
-
-static void testSignedLongLong32() {
-    String32 s = build(U"test");
-    for(signed long long i = 106; i < 109; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"test106107108"), s);
-}
-
-static void testUnsignedLongLong32() {
-    String32 s = build(U"test");
-    for(unsigned long long i = 107; i < 110; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"test107108109"), s);
-}
-
-static void testFloat32() {
-    String32 s = build(U"test");
-    for(float i = 108; i < 111; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"test108.00109.00110.00"), s);
-}
-
-static void testDouble32() {
-    String32 s = build(U"test");
-    for(double i = 109; i < 112; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"test109.00110.00111.00"), s);
-}
-
-static void testLongDouble32() {
-    String32 s = build(U"test");
-    for(long double i = 110; i < 113; i++) {
-        CORE_TEST_ERROR(s.append(i));
-    }
-    CORE_TEST_EQUAL(build(U"test110.00111.00112.00"), s);
-}
-
-static void testBool32() {
-    String32 s = build(U"test");
-    CORE_TEST_ERROR(s.append(true));
-    CORE_TEST_ERROR(s.append(false));
-    CORE_TEST_ERROR(s.append(true));
-    CORE_TEST_EQUAL(build(U"testtruefalsetrue"), s);
-}
-
-static void testIntOverflow32() {
-    Core::String32<4> s;
-    CORE_TEST_EQUAL(Core::ErrorCode::CAPACITY_REACHED, s.append(123456));
-
-    String32 o;
-    for(size_t i = 0; i < s.getCapacity(); i++) {
-        CORE_TEST_ERROR(o.append(i + 1));
-    }
-
-    CORE_TEST_TRUE(o == s);
-}
-
-static void testUnicode32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append('\u0040'));
-    CORE_TEST_ERROR(s.append(L'\u0400'));
-    CORE_TEST_ERROR(s.append(L'\u8000'));
-    CORE_TEST_ERROR(s.append(U'\U00100000'));
-    CORE_TEST_EQUAL(build(U"\u0040\u0400\u8000\U00100000"), s);
-}
-
-static void testClear32() {
-    String32 s = build(U"test");
-    CORE_TEST_ERROR(s.append(1234));
-    s.clear();
-    CORE_TEST_ERROR(s.append(U"wusi"));
-    CORE_TEST_ERROR(s.append(U"1234"));
-    CORE_TEST_EQUAL(build(U"wusi1234"), s);
-}
-
-static void testAddSelf32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append(U"test1"));
-    CORE_TEST_ERROR(s.append(s));
-    CORE_TEST_ERROR(s.append(s));
-    CORE_TEST_EQUAL(build(U"test1test1test1test1"), s);
-}
-
-static void testStartsWith32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append(U"0123456789"));
-
-    String32 s2;
-    CORE_TEST_ERROR(s2.append(U"123"));
-    String32 s3;
-    CORE_TEST_ERROR(s3.append(U"234"));
-    String32 s4;
-    CORE_TEST_ERROR(s4.append(U"789"));
-    String32 s5;
-    CORE_TEST_ERROR(s5.append(U"124"));
-    String32 s6;
-    String32 s7;
-    CORE_TEST_ERROR(s7.append(U"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 testSearch32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append(U"0123456789"));
-
-    String32 s2;
-    CORE_TEST_ERROR(s2.append(U"123"));
-    String32 s3;
-    CORE_TEST_ERROR(s3.append(U"234"));
-    String32 s4;
-    CORE_TEST_ERROR(s4.append(U"789"));
-    String32 s5;
-    CORE_TEST_ERROR(s5.append(U"124"));
-    String32 s6;
-    String32 s7;
-    CORE_TEST_ERROR(s7.append(U"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 testContains32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append(U"0123456789"));
-
-    String32 s2;
-    CORE_TEST_ERROR(s2.append(U"123"));
-    String32 s3;
-    CORE_TEST_ERROR(s3.append(U"234"));
-    String32 s4;
-    CORE_TEST_ERROR(s4.append(U"789"));
-    String32 s5;
-    CORE_TEST_ERROR(s5.append(U"124"));
-    String32 s6;
-    String32 s7;
-    CORE_TEST_ERROR(s7.append(U"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 testSearchChar32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append(U"01üää3ä"));
-
-    CORE_TEST_EQUAL(0, s.search('0'));
-    CORE_TEST_EQUAL(1, s.search('1'));
-    CORE_TEST_EQUAL(5, s.search('3'));
-    CORE_TEST_EQUAL(2, s.search(U'ü'));
-    CORE_TEST_EQUAL(3, s.search(U'ä'));
-    CORE_TEST_EQUAL(4, s.search(U'ä', 4));
-    CORE_TEST_EQUAL(6, s.search(U'ä', 5));
-}
-
-static void testContainsChar32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append(U"01üää3ä"));
-    CORE_TEST_TRUE(s.contains(U'0'));
-    CORE_TEST_TRUE(s.contains(U'1'));
-    CORE_TEST_TRUE(s.contains(U'3'));
-    CORE_TEST_FALSE(s.contains(U'a'));
-    CORE_TEST_TRUE(s.contains(U'0'));
-    CORE_TEST_TRUE(s.contains(U'1'));
-    CORE_TEST_TRUE(s.contains(U'ü'));
-    CORE_TEST_TRUE(s.contains(U'ä'));
-    CORE_TEST_FALSE(s.contains(U'ö'));
-}
-
-static void testSubString32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append(U"01üää3ä"));
-
-    String32 sub;
-    CORE_TEST_ERROR(s.substring(sub, 0));
-    CORE_TEST_STRING(U"01üää3ä", sub);
-    CORE_TEST_ERROR(s.substring(sub, 1));
-    CORE_TEST_STRING(U"1üää3ä", sub);
-    CORE_TEST_ERROR(s.substring(sub, 2));
-    CORE_TEST_STRING(U"üää3ä", sub);
-    CORE_TEST_ERROR(s.substring(sub, 3));
-    CORE_TEST_STRING(U"ää3ä", sub);
-    CORE_TEST_ERROR(s.substring(sub, 4));
-    CORE_TEST_STRING(U"ä3ä", sub);
-
-    CORE_TEST_ERROR(s.substring(sub, 0, 6));
-    CORE_TEST_STRING(U"01üää3ä", sub);
-    CORE_TEST_ERROR(s.substring(sub, 1, 5));
-    CORE_TEST_STRING(U"1üää3", sub);
-    CORE_TEST_ERROR(s.substring(sub, 2, 4));
-    CORE_TEST_STRING(U"üää", sub);
-    CORE_TEST_ERROR(s.substring(sub, 3, 3));
-    CORE_TEST_STRING(U"ä", sub);
-    CORE_TEST_ERROR(s.substring(sub, 4, 2));
-    CORE_TEST_STRING(U"", sub);
-    CORE_TEST_ERROR(s.substring(sub, 4, 23));
-    CORE_TEST_STRING(U"ä3ä", sub);
-}
-
-static void testReplace32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append(U"0äääää1üää3ä"));
-
-    String32 search;
-    CORE_TEST_ERROR(search.append(U"ää"));
-
-    String32 replace;
-    CORE_TEST_ERROR(replace.append(U"ABCD"));
-    CORE_TEST_ERROR(s.replace(search, replace));
-    CORE_TEST_STRING(U"0ABCDABCDä1üABCD3ä", s);
-}
-
-static void testReplaceChar32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append(U"01üää3ä"));
-    s.replace(U'0', U'A');
-    CORE_TEST_STRING(U"A1üää3ä", s);
-    s.replace(U'1', U'B');
-    CORE_TEST_STRING(U"ABüää3ä", s);
-    s.replace(U'ü', U'C');
-    CORE_TEST_STRING(U"ABCää3ä", s);
-    s.replace(U'ä', U'D');
-    CORE_TEST_STRING(U"ABCDD3D", s);
-    s.replace(U'3', U'E');
-    CORE_TEST_STRING(U"ABCDDED", s);
-}
-
-static void testCastAppendSelf32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append("abc"));
-    CORE_TEST_ERROR(s.append(s));
-    CORE_TEST_ERROR(s.append(static_cast<const c32*>(s)));
-    CORE_TEST_STRING("abcabcabcabc", s);
-}
-
-static void testCompareWithShorter32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append("abc"));
-    CORE_TEST_FALSE(s == U"ab");
-}
-
-static void testAppendSignedChar32() {
-    const signed char buffer[] = {'a', 'b', 'c', '\0'};
-    String32 s;
-    CORE_TEST_ERROR(s.append(buffer));
-    CORE_TEST_TRUE(s == U"abc");
-}
-
-static void testAppendUnsignedChar32() {
-    const unsigned char buffer[] = {'a', 'b', 'c', '\0'};
-    String32 s;
-    CORE_TEST_ERROR(s.append(buffer));
-    CORE_TEST_TRUE(s == U"abc");
-}
-
-static void testAppendError32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append(Core::ErrorCode::NONE));
-    CORE_TEST_STRING(U"0", s);
-}
-
-static void testPrint32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append('\u0040'));
-    CORE_TEST_ERROR(s.append(L'\u0400'));
-    CORE_TEST_ERROR(s.append(L'\u8000'));
-    CORE_TEST_ERROR(s.append(U'\U00100000'));
-    CORE_TEST_EQUAL(build(U"\u0040\u0400\u8000\U00100000"), s);
-    s.print();
-}
-
-static void testVariousUnicode32() {
-    const unsigned char buffer[] = {0xC0, 0};
-    const unsigned char buffer2[] = {0xE0, 0};
-    const unsigned char buffer3[] = {0xC3, 0xA4, 0};
-    const unsigned char buffer4[] = {0xF0, 0};
-    const unsigned char buffer5[] = {0xF0, 0x9F, 0x8F, 0xA3, 0};
-    const unsigned char buffer6[] = {0xFF, 0};
-    String32 s;
-    CORE_TEST_EQUAL(Core::ErrorCode::INVALID_CHAR, s.append(buffer));
-    CORE_TEST_EQUAL(Core::ErrorCode::INVALID_CHAR, s.append(buffer2));
-    CORE_TEST_EQUAL(Core::ErrorCode::NONE, s.append(buffer3));
-    CORE_TEST_EQUAL(Core::ErrorCode::INVALID_CHAR, s.append(buffer4));
-    CORE_TEST_EQUAL(Core::ErrorCode::NONE, s.append(buffer5));
-    CORE_TEST_EQUAL(Core::ErrorCode::INVALID_CHAR, s.append(buffer6));
-}
-
-static void testKeepHash32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append("a ## test #### #####"));
-    CORE_TEST_ERROR(s.format(1, 2, 3, 4, 5, 6, 7, 8, 9));
-    CORE_TEST_STRING("a # test ## ##123456789", s);
-}
-
-static void testInvalidPrint32() {
-    String32 s;
-    CORE_TEST_ERROR(s.append(static_cast<c32>(0xFFFFFFFF)));
-    s.printLine();
+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";
 
-    String32 sa;
-    CORE_TEST_ERROR(sa.append(a));
-    String8 sb;
-    CORE_TEST_ERROR(sb.append(b));
+    String s;
+    s.append(a);
+    String s2;
+    s2.append(b);
 
-    String8 sa2;
-    CORE_TEST_ERROR(sa2.append(sa));
-    String32 sb2;
-    CORE_TEST_ERROR(sb2.append(sb));
-
-    CORE_TEST_STRING(a, sa2);
-    CORE_TEST_STRING(b, sb2);
+    CORE_TEST_STRING(s, s2);
 }
 
 void Core::testArrayString() {
-    testEquality8();
-    testUnicodeEquality8();
-    testInequality8();
-    testStringAppend8();
-    testStringAppendOverflow8();
-    testCharacters8();
-    testLength8();
-    testChar8();
-    testSignedChar8();
-    testUnsignedChar8();
-    testSignedShort8();
-    testUnsignedShort8();
-    testSignedInt8();
-    testUnsignedInt8();
-    testSignedLong8();
-    testUnsignedLong8();
-    testSignedLongLong8();
-    testUnsignedLongLong8();
-    testFloat8();
-    testDouble8();
-    testLongDouble8();
-    testBool8();
-    testIntOverflow8();
-    testUnicode8();
-    testClear8();
-    testAddSelf8();
-    testStartsWith8();
-    testSearch8();
-    testContains8();
-    testSearchChar8();
-    testContainsChar8();
-    testSubString8();
-    testReplace8();
-    testReplaceChar8();
-    testCastAppendSelf8();
-    testCompareWithShorter8();
-    testAppendSignedChar8();
-    testAppendUnsignedChar8();
-    testAppendError8();
-    testPrint8();
-    testKeepHash8();
-    testFormatWithoutArguments8();
-    testUnicodeString8();
-    testInvalidUnicodeString8();
-
-    testEquality32();
-    testUnicodeEquality32();
-    testInequality32();
-    testStringAppend32();
-    testStringAppendOverflow32();
-    testCharacters32();
-    testLength32();
-    testChar32();
-    testSignedChar32();
-    testUnsignedChar32();
-    testSignedShort32();
-    testUnsignedShort32();
-    testSignedInt32();
-    testUnsignedInt32();
-    testSignedLong32();
-    testUnsignedLong32();
-    testSignedLongLong32();
-    testUnsignedLongLong32();
-    testFloat32();
-    testDouble32();
-    testLongDouble32();
-    testBool32();
-    testIntOverflow32();
-    testUnicode32();
-    testClear32();
-    testAddSelf32();
-    testStartsWith32();
-    testSearch32();
-    testContains32();
-    testSearchChar32();
-    testContainsChar32();
-    testSubString32();
-    testReplace32();
-    testReplaceChar32();
-    testCastAppendSelf32();
-    testCompareWithShorter32();
-    testAppendSignedChar32();
-    testAppendUnsignedChar32();
-    testAppendError32();
-    testPrint32();
-    testVariousUnicode32();
-    testKeepHash32();
-    testInvalidPrint32();
-
+    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();
 }

+ 15 - 17
test/modules/BitArrayTests.cpp

@@ -24,10 +24,10 @@ static void testOutOfBoundsSetRead() {
 static void testBigSetRead() {
     Core::BitArray bits;
     CORE_TEST_ERROR(bits.resize(100, 13));
-    for(u64 i = 0; i < bits.getLength(); i++) {
+    for(size_t i = 0; i < bits.getLength(); i++) {
         bits.set(i, i);
     }
-    for(u64 i = 0; i < bits.getLength(); i++) {
+    for(size_t i = 0; i < bits.getLength(); i++) {
         CORE_TEST_EQUAL(i, bits.get(i));
     }
 }
@@ -45,13 +45,13 @@ static void testRandomSetReadResize() {
             data[i] = seed & (0x1FFF);
         }
     }
-    for(u64 i = 0; i < bits.getLength(); i++) {
+    for(size_t i = 0; i < bits.getLength(); i++) {
         CORE_TEST_EQUAL(data[i], bits.get(i));
     }
     CORE_TEST_ERROR(bits.resize(bits.getLength(), bits.getBits() + 1));
     CORE_TEST_EQUAL(14, bits.getBits());
     CORE_TEST_EQUAL(100, bits.getLength());
-    for(u64 i = 0; i < bits.getLength(); i++) {
+    for(size_t i = 0; i < bits.getLength(); i++) {
         CORE_TEST_EQUAL(data[i], bits.get(i));
     }
 }
@@ -60,13 +60,11 @@ static void testReadOnly() {
     Core::BitArray bits;
     CORE_TEST_ERROR(bits.resize(4, 3));
     bits.set(0, 1).set(1, 2).set(2, 3).set(3, 4);
-    Core::BitArray copy;
-    CORE_TEST_ERROR(copy.copyFrom(bits));
-    const Core::BitArray bits2 = Core::move(copy);
-    CORE_TEST_EQUAL(1, bits2.get(0));
-    CORE_TEST_EQUAL(2, bits2.get(1));
-    CORE_TEST_EQUAL(3, bits2.get(2));
-    CORE_TEST_EQUAL(4, bits2.get(3));
+    const Core::BitArray copy = bits;
+    CORE_TEST_EQUAL(1, copy.get(0));
+    CORE_TEST_EQUAL(2, copy.get(1));
+    CORE_TEST_EQUAL(3, copy.get(2));
+    CORE_TEST_EQUAL(4, copy.get(3));
 }
 
 static void testSelect() {
@@ -109,27 +107,27 @@ static void testResizeExact() {
     Core::BitArray bits;
     CORE_TEST_EQUAL(0, bits.getInternalByteSize());
     // the size in bytes matches the internal storage type
-    u64 elements = sizeof(u64);
+    size_t elements = sizeof(u64);
     CORE_TEST_ERROR(bits.resize(elements, 8));
-    for(u64 i = 0; i < elements; i++) {
+    for(size_t i = 0; i < elements; i++) {
         bits.set(i, i);
     }
-    for(u64 i = 0; i < elements; i++) {
+    for(size_t i = 0; i < elements; i++) {
         CORE_TEST_EQUAL(i, bits.get(i));
     }
-    CORE_TEST_EQUAL(CORE_SIZE(u64), bits.getInternalByteSize());
+    CORE_TEST_EQUAL(sizeof(u64), bits.getInternalByteSize());
 }
 
 static void testMoveAssignment() {
     Core::BitArray bits;
     CORE_TEST_ERROR(bits.resize(8, 8));
-    for(u64 i = 0; i < bits.getLength(); i++) {
+    for(size_t i = 0; i < bits.getLength(); i++) {
         bits.set(i, i);
     }
     Core::BitArray m;
     m = Core::move(bits);
     CORE_TEST_EQUAL(8, m.getLength());
-    for(u64 i = 0; i < m.getLength(); i++) {
+    for(size_t i = 0; i < m.getLength(); i++) {
         CORE_TEST_EQUAL(i, m.get(i));
     }
 }

+ 6 - 6
test/modules/FileReaderTests.cpp

@@ -7,13 +7,13 @@ static constexpr const char* TEST_FILE = "../test/modules/resources/test";
 static void testReadChar() {
     Core::FileReader r;
     CORE_TEST_ERROR(r.open(TEST_FILE));
-    Core::String8<128> s;
+    Core::ArrayString<128> s;
     while(true) {
         int c = 0;
         if(r.readChar(c) != Core::ErrorCode::NONE) {
             break;
         }
-        CORE_TEST_ERROR(s.append(static_cast<c32>(c)));
+        s.append(static_cast<c32>(c));
     }
     CORE_TEST_STRING("abc\nBaum\n", s);
 }
@@ -21,15 +21,15 @@ static void testReadChar() {
 static void testReadCharPath() {
     Core::FileReader r;
     Core::Path path;
-    CORE_TEST_ERROR(path.append(TEST_FILE));
+    path.append(TEST_FILE);
     CORE_TEST_ERROR(r.open(path));
-    Core::String8<128> s;
+    Core::ArrayString<128> s;
     while(true) {
         int c = 0;
         if(r.readChar(c) != Core::ErrorCode::NONE) {
             break;
         }
-        CORE_TEST_ERROR(s.append(static_cast<c32>(c)));
+        s.append(static_cast<c32>(c));
     }
     CORE_TEST_STRING("abc\nBaum\n", s);
 }
@@ -91,7 +91,7 @@ static void testInvalidAccess() {
 static void testInvalidAccessPath() {
     Core::FileReader r;
     Core::Path path;
-    CORE_TEST_ERROR(path.append(TEST_FILE));
+    path.append(TEST_FILE);
     CORE_TEST_ERROR(r.open(path));
     CORE_TEST_EQUAL(Core::ErrorCode::INVALID_STATE, r.open(path));
 }

+ 2 - 7
test/modules/HashMapTests.cpp

@@ -113,13 +113,8 @@ struct HashMapTest {
     }
 
     template<typename String>
-    check_return Core::Error toString(String& s) const {
-        CORE_RETURN_ERROR(s.append("A("));
-        CORE_RETURN_ERROR(s.append(a));
-        CORE_RETURN_ERROR(s.append(", "));
-        CORE_RETURN_ERROR(s.append(b));
-        CORE_RETURN_ERROR(s.append(")"));
-        return Core::ErrorCode::NONE;
+    void toString(String& s) const {
+        s.append("A(").append(a).append(", ").append(b).append(")");
     }
 };
 

+ 7 - 7
test/modules/MatrixStackTests.cpp

@@ -14,7 +14,7 @@ static void testInit() {
 
 static void testPop() {
     Matrices stack;
-    CORE_TEST_ERROR(stack.push());
+    stack.push();
     stack.peek().scale(2.0f);
     stack.pop();
     Core::Matrix m;
@@ -26,18 +26,18 @@ static void testPop() {
 static void testPush(bool light) {
     Matrices stack;
     for(int i = 0; i < 4; i++) {
-        CORE_TEST_ERROR(stack.push());
+        stack.push();
     }
     int limit = light ? 10000 : 1000000;
     for(int i = 0; i < limit; i++) {
-        CORE_TEST_EQUAL(Core::ErrorCode::CAPACITY_REACHED, stack.push());
+        stack.push();
     }
 }
 
 static void testClear() {
     Matrices stack;
     stack.peek().scale(2.0f);
-    CORE_TEST_ERROR(stack.push());
+    stack.push();
     stack.peek().scale(2.0f);
     stack.clear();
     Core::Matrix m;
@@ -49,9 +49,9 @@ static void testClear() {
 static void testToString1() {
     Matrices stack;
     stack.peek().scale(2.0f);
-    CORE_TEST_ERROR(stack.push());
+    stack.push();
     stack.peek().scale(3.0f);
-    CORE_TEST_ERROR(stack.push());
+    stack.push();
     stack.peek().scale(4.0f);
     CORE_TEST_STRING("["
                      "[[2.00, 0.00, 0.00, 0.00], "
@@ -73,7 +73,7 @@ static void testToString1() {
 static void testToString2() {
     Matrices stack;
     stack.peek().scale(2.0f);
-    CORE_TEST_ERROR(stack.push());
+    stack.push();
     stack.peek().scale(3.0f);
     CORE_TEST_STRING("["
                      "[[2.00, 0.00, 0.00, 0.00], "

+ 3 - 3
test/modules/MatrixTests.cpp

@@ -124,13 +124,13 @@ static void testRotateZ() {
 }
 
 static void testToString() {
-    Core::String32<1024> s;
+    Core::ArrayString<1024> s;
     Core::Matrix m;
     m.set(0, Core::Vector4(1.0f, 2.0f, 3.0f, 4.0f));
     m.set(1, Core::Vector4(5.0f, 6.0f, 7.0f, 8.0f));
     m.set(2, Core::Vector4(9.0f, 10.0f, 11.0f, 12.0f));
     m.set(3, Core::Vector4(13.0f, 14.0f, 15.0f, 16.0f));
-    CORE_TEST_ERROR(s.append(m));
+    s.append(m);
     CORE_TEST_STRING(
         "[[1.00, 2.00, 3.00, 4.00], [5.00, 6.00, 7.00, 8.00], "
         "[9.00, 10.00, 11.00, 12.00], [13.00, 14.00, 15.00, 16.00]]",
@@ -173,4 +173,4 @@ void Core::testMatrix() {
     testRotateZ();
     testToString();
     testQuaternionMatrix();
-}
+}

+ 40 - 60
test/modules/RingBufferTests.cpp

@@ -32,9 +32,8 @@ struct Tester final {
         sum -= id;
     }
 
-    template<typename String>
-    check_return Core::Error toString(String& s) const {
-        return s.append(id);
+    void toString(Core::BufferString& s) const {
+        s.append(id);
     }
 };
 
@@ -50,68 +49,58 @@ static void testReadAndWrite() {
     Core::RingBuffer<int, 5> buffer;
     CORE_TEST_FALSE(buffer.canRemove());
     CORE_TEST_EQUAL(0, buffer.getLength());
-    CORE_TEST_ERROR(buffer.add(4));
+    buffer.add(4);
     CORE_TEST_EQUAL(1, buffer.getLength());
     CORE_TEST_TRUE(buffer.canRemove());
     CORE_TEST_EQUAL(4, buffer[0]);
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_FALSE(buffer.canRemove());
     CORE_TEST_EQUAL(0, buffer.getLength());
 }
 
 static void testOverflow() {
     Core::RingBuffer<int, 3> buffer;
-    CORE_TEST_ERROR(buffer.add(1));
-    CORE_TEST_ERROR(buffer.add(2));
-    CORE_TEST_ERROR(buffer.add(3));
-    CORE_TEST_EQUAL(Core::ErrorCode::CAPACITY_REACHED, buffer.add(4));
-    CORE_TEST_EQUAL(Core::ErrorCode::CAPACITY_REACHED, buffer.add(5));
+    buffer.add(1).add(2).add(3).add(4).add(5);
     CORE_TEST_EQUAL(3, buffer.getLength());
     CORE_TEST_EQUAL(1, buffer[0]);
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_EQUAL(2, buffer.getLength());
     CORE_TEST_EQUAL(2, buffer[0]);
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_EQUAL(1, buffer.getLength());
     CORE_TEST_EQUAL(3, buffer[0]);
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_FALSE(buffer.canRemove());
     CORE_TEST_EQUAL(0, buffer.getLength());
 }
 
 static void testRefill() {
     Core::RingBuffer<int, 3> buffer;
-    CORE_TEST_ERROR(buffer.add(1));
-    CORE_TEST_ERROR(buffer.add(2));
-    CORE_TEST_ERROR(buffer.add(3));
-    CORE_TEST_EQUAL(Core::ErrorCode::CAPACITY_REACHED, buffer.add(4));
+    buffer.add(1).add(2).add(3).add(4);
     CORE_TEST_EQUAL(3, buffer.getLength());
     CORE_TEST_TRUE(buffer.canRemove());
     CORE_TEST_EQUAL(1, buffer[0]);
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_EQUAL(2, buffer[0]);
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_EQUAL(3, buffer[0]);
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_EQUAL(0, buffer.getLength());
-
     CORE_TEST_FALSE(buffer.canRemove());
-    CORE_TEST_ERROR(buffer.add(5));
-    CORE_TEST_ERROR(buffer.add(6));
+    buffer.add(5).add(6);
     CORE_TEST_EQUAL(2, buffer.getLength());
     CORE_TEST_TRUE(buffer.canRemove());
     CORE_TEST_EQUAL(5, buffer[0]);
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_EQUAL(6, buffer[0]);
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_FALSE(buffer.canRemove());
     CORE_TEST_EQUAL(0, buffer.getLength());
 }
 
 static void testClear() {
     Core::RingBuffer<int, 3> buffer;
-    CORE_TEST_ERROR(buffer.add(1));
-    CORE_TEST_ERROR(buffer.add(2));
+    buffer.add(1).add(2);
     CORE_TEST_EQUAL(2, buffer.getLength());
     buffer.clear();
     CORE_TEST_FALSE(buffer.canRemove());
@@ -121,18 +110,18 @@ static void testClear() {
 static void testConstructDestruct() {
     resetTester();
     Core::RingBuffer<Tester, 3> buffer;
-    CORE_TEST_ERROR(buffer.add());
+    buffer.add();
     CORE_TEST_EQUAL(1, Tester::sum);
-    CORE_TEST_ERROR(buffer.add());
+    buffer.add();
     CORE_TEST_EQUAL(3, Tester::sum);
-    CORE_TEST_ERROR(buffer.add());
+    buffer.add();
     CORE_TEST_EQUAL(6, Tester::sum);
 
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_EQUAL(5, Tester::sum);
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_EQUAL(3, Tester::sum);
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_EQUAL(0, Tester::sum);
 }
 
@@ -140,11 +129,11 @@ static void testCopyDestruct() {
     resetTester();
     {
         Core::RingBuffer<Tester, 3> buffer;
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(1, Tester::sum);
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(3, Tester::sum);
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(6, Tester::sum);
         {
             Core::RingBuffer<Tester, 3> copy = buffer;
@@ -159,11 +148,11 @@ static void testCopyAssignmentDestruct() {
     resetTester();
     {
         Core::RingBuffer<Tester, 3> buffer;
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(1, Tester::sum);
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(3, Tester::sum);
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(6, Tester::sum);
         {
             Core::RingBuffer<Tester, 3> copy;
@@ -179,11 +168,11 @@ static void testMoveDestruct() {
     resetTester();
     {
         Core::RingBuffer<Tester, 3> buffer;
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(1, Tester::sum);
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(3, Tester::sum);
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(6, Tester::sum);
         {
             Core::RingBuffer<Tester, 3> move = Core::move(buffer);
@@ -199,11 +188,11 @@ static void testMoveAssignmentDestruct() {
     resetTester();
     {
         Core::RingBuffer<Tester, 3> buffer;
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(1, Tester::sum);
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(3, Tester::sum);
-        CORE_TEST_ERROR(buffer.add());
+        buffer.add();
         CORE_TEST_EQUAL(6, Tester::sum);
         {
             Core::RingBuffer<Tester, 3> move;
@@ -219,35 +208,32 @@ static void testMoveAssignmentDestruct() {
 static void testOverall() {
     resetTester();
     Core::RingBuffer<Tester, 3> buffer;
-
-    CORE_TEST_ERROR(buffer.add());
-    CORE_TEST_ERROR(buffer.add());
-    CORE_TEST_ERROR(buffer.add());
+    buffer.add().add().add();
     CORE_TEST_STRING("[1, 2, 3]", buffer);
     CORE_TEST_EQUAL(3, buffer.getLength());
     CORE_TEST_EQUAL(6, Tester::sum);
 
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_STRING("[2, 3]", buffer);
     CORE_TEST_EQUAL(2, buffer.getLength());
     CORE_TEST_EQUAL(5, Tester::sum);
 
-    CORE_TEST_ERROR(buffer.add());
+    buffer.add();
     CORE_TEST_STRING("[2, 3, 4]", buffer);
     CORE_TEST_EQUAL(3, buffer.getLength());
     CORE_TEST_EQUAL(9, Tester::sum);
 
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_STRING("[3, 4]", buffer);
     CORE_TEST_EQUAL(2, buffer.getLength());
     CORE_TEST_EQUAL(7, Tester::sum);
 
-    CORE_TEST_ERROR(buffer.add());
+    buffer.add();
     CORE_TEST_STRING("[3, 4, 5]", buffer);
     CORE_TEST_EQUAL(3, buffer.getLength());
     CORE_TEST_EQUAL(12, Tester::sum);
 
-    CORE_TEST_ERROR(buffer.remove());
+    buffer.remove();
     CORE_TEST_STRING("[4, 5]", buffer);
     CORE_TEST_EQUAL(2, buffer.getLength());
     CORE_TEST_EQUAL(9, Tester::sum);
@@ -258,11 +244,6 @@ static void testOverall() {
     CORE_TEST_EQUAL(0, Tester::sum);
 }
 
-static void testInvalidRemove() {
-    Core::RingBuffer<int, 3> buffer;
-    CORE_TEST_EQUAL(Core::ErrorCode::INVALID_STATE, buffer.remove());
-}
-
 void Core::testRingBuffer() {
     testReadAndWrite();
     testOverflow();
@@ -274,5 +255,4 @@ void Core::testRingBuffer() {
     testMoveDestruct();
     testMoveAssignmentDestruct();
     testOverall();
-    testInvalidRemove();
 }

+ 8 - 27
test/modules/StackTests.cpp

@@ -7,9 +7,7 @@ template class Core::Internal::BaseStack<int, Core::ArrayList<int, 100>>;
 template<typename T>
 static void testPushPopPeek() {
     T stack;
-    CORE_TEST_ERROR(stack.push(1));
-    CORE_TEST_ERROR(stack.push(2));
-    CORE_TEST_ERROR(stack.push(3));
+    stack.push(1).push(2).push(3);
     CORE_TEST_EQUAL(3, stack.peek());
     CORE_TEST_EQUAL(3, static_cast<const T&>(stack).peek());
     stack.pop();
@@ -26,7 +24,7 @@ template<typename T>
 static void testBigPushPop(int amount) {
     T stack;
     for(int i = 0; i < amount; i++) {
-        CORE_TEST_ERROR(stack.push(i));
+        stack.push(i);
     }
     for(int i = 0; i < amount; i++) {
         stack.pop();
@@ -35,33 +33,18 @@ static void testBigPushPop(int amount) {
 }
 
 template<typename T>
-static void testToString1() {
+static void testToString() {
     T stack;
-    CORE_TEST_ERROR(stack.push(1));
-    CORE_TEST_ERROR(stack.push(243));
-    CORE_TEST_ERROR(stack.push(-423));
+    stack.push(1).push(243).push(-423);
     CORE_TEST_STRING("[1, 243, -423]", stack);
-}
-
-template<typename T>
-static void testToString2() {
-    T stack;
-    CORE_TEST_ERROR(stack.push(1));
-    CORE_TEST_STRING("[1]", stack);
-}
-
-template<typename T>
-static void testToString3() {
-    T stack;
-    CORE_TEST_STRING("[]", stack);
+    CORE_TEST_STRING("[1]", T().push(1));
+    CORE_TEST_STRING("[]", T());
 }
 
 template<typename T>
 static void testClear() {
     T stack;
-    CORE_TEST_ERROR(stack.push(1));
-    CORE_TEST_ERROR(stack.push(2));
-    CORE_TEST_ERROR(stack.push(3));
+    stack.push(1).push(2).push(3);
     stack.clear();
     CORE_TEST_TRUE(stack.isEmpty());
 }
@@ -70,9 +53,7 @@ template<typename T>
 static void testType(int amount) {
     testPushPopPeek<T>();
     testBigPushPop<T>(amount);
-    testToString1<T>();
-    testToString2<T>();
-    testToString3<T>();
+    testToString<T>();
     testClear<T>();
 }
 

+ 6 - 6
test/modules/VectorTests.cpp

@@ -188,12 +188,12 @@ static void testCast() {
 }
 
 static void testToString() {
-    Core::String32<200> s;
-    CORE_TEST_ERROR(s.append(Core::Vector<1, float>()));
-    CORE_TEST_ERROR(s.append(Core::Vector2(2.0f, 3.0f)));
-    CORE_TEST_ERROR(s.append(V3(4.0f, 5.0f, 6.0f)));
-    Core::String32<200> s2;
-    CORE_TEST_ERROR(s2.append("[0.00][2.00, 3.00][4.00, 5.00, 6.00]"));
+    Core::ArrayString<200> s;
+    s.append(Core::Vector<1, float>());
+    s.append(Core::Vector2(2.0f, 3.0f));
+    s.append(V3(4.0f, 5.0f, 6.0f));
+    Core::ArrayString<200> s2;
+    s2.append("[0.00][2.00, 3.00][4.00, 5.00, 6.00]");
     CORE_TEST_EQUAL(s2, s);
 }