mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 10:32:29 +00:00
feat(array): add TSBaseArray<T>::MemFileName
This commit is contained in:
parent
2e82693829
commit
787618142c
2 changed files with 16 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#define STORM_ARRAY_TS_BASE_ARRAY_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <typeinfo>
|
||||
|
||||
template <class T>
|
||||
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<T>::Clear() {
|
|||
TSBaseArray<T>();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const char* TSBaseArray<T>::MemFileName() const {
|
||||
return typeid(T).name();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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<uint32_t> array;
|
||||
REQUIRE(SStrLen(array.MemFileName()) > 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("TSFixedArray", "[list]") {
|
||||
SECTION("constructs correctly") {
|
||||
TSFixedArray<uint32_t> array;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue