diff --git a/storm/array/TSBaseArray.hpp b/storm/array/TSBaseArray.hpp index 67efd09..c09f52b 100644 --- a/storm/array/TSBaseArray.hpp +++ b/storm/array/TSBaseArray.hpp @@ -2,6 +2,7 @@ #define STORM_ARRAY_TS_BASE_ARRAY_HPP #include +#include template class TSBaseArray { @@ -10,6 +11,8 @@ class TSBaseArray { uint32_t m_count = 0; T* m_data = nullptr; + virtual const char* MemFileName() const; + T& operator[](uint32_t i); uint32_t Count(void); void Clear(void); @@ -31,4 +34,9 @@ void TSBaseArray::Clear() { TSBaseArray(); } +template +const char* TSBaseArray::MemFileName() const { + return typeid(T).name(); +} + #endif diff --git a/test/Array.cpp b/test/Array.cpp index fa2e1e2..0c849a3 100644 --- a/test/Array.cpp +++ b/test/Array.cpp @@ -1,4 +1,5 @@ #include "storm/Array.hpp" +#include "storm/String.hpp" #include "test/Test.hpp" TEST_CASE("TSBaseArray", "[list]") { @@ -8,6 +9,13 @@ TEST_CASE("TSBaseArray", "[list]") { } } +TEST_CASE("TSBaseArray::MemFileName", "[array]") { + SECTION("returns a non-empty string") { + TSBaseArray array; + REQUIRE(SStrLen(array.MemFileName()) > 0); + } +} + TEST_CASE("TSFixedArray", "[list]") { SECTION("constructs correctly") { TSFixedArray array;