diff --git a/storm/Array.hpp b/storm/Array.hpp new file mode 100644 index 0000000..a9ef2b0 --- /dev/null +++ b/storm/Array.hpp @@ -0,0 +1,6 @@ +#ifndef STORM_ARRAY_HPP +#define STORM_ARRAY_HPP + +#include "array/TSBaseArray.hpp" + +#endif diff --git a/storm/array/TSBaseArray.hpp b/storm/array/TSBaseArray.hpp new file mode 100644 index 0000000..1eddb20 --- /dev/null +++ b/storm/array/TSBaseArray.hpp @@ -0,0 +1,34 @@ +#ifndef STORM_ARRAY_TS_BASE_ARRAY_HPP +#define STORM_ARRAY_TS_BASE_ARRAY_HPP + +#include + +template +class TSBaseArray { + public: + uint32_t m_alloc = 0; + uint32_t m_count = 0; + T* m_data = nullptr; + + T& operator[](uint32_t i); + uint32_t Count(void); + void Clear(void); +}; + +template +T& TSBaseArray::operator[](uint32_t i) { + return this->m_data[i]; +} + +template +uint32_t TSBaseArray::Count() { + return this->m_count; +} + +template +void TSBaseArray::Clear() { + delete[] this->m_data; + TSBaseArray(); +} + +#endif diff --git a/test/Array.cpp b/test/Array.cpp new file mode 100644 index 0000000..2b91ed8 --- /dev/null +++ b/test/Array.cpp @@ -0,0 +1,9 @@ +#include "Array.hpp" +#include "Test.hpp" + +TEST_CASE("TSBaseArray", "[list]") { + SECTION("constructs correctly") { + TSBaseArray array; + REQUIRE(array.Count() == 0); + } +}