mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +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
|
#define STORM_ARRAY_TS_BASE_ARRAY_HPP
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class TSBaseArray {
|
class TSBaseArray {
|
||||||
|
|
@ -10,6 +11,8 @@ class TSBaseArray {
|
||||||
uint32_t m_count = 0;
|
uint32_t m_count = 0;
|
||||||
T* m_data = nullptr;
|
T* m_data = nullptr;
|
||||||
|
|
||||||
|
virtual const char* MemFileName() const;
|
||||||
|
|
||||||
T& operator[](uint32_t i);
|
T& operator[](uint32_t i);
|
||||||
uint32_t Count(void);
|
uint32_t Count(void);
|
||||||
void Clear(void);
|
void Clear(void);
|
||||||
|
|
@ -31,4 +34,9 @@ void TSBaseArray<T>::Clear() {
|
||||||
TSBaseArray<T>();
|
TSBaseArray<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
const char* TSBaseArray<T>::MemFileName() const {
|
||||||
|
return typeid(T).name();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "storm/Array.hpp"
|
#include "storm/Array.hpp"
|
||||||
|
#include "storm/String.hpp"
|
||||||
#include "test/Test.hpp"
|
#include "test/Test.hpp"
|
||||||
|
|
||||||
TEST_CASE("TSBaseArray", "[list]") {
|
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]") {
|
TEST_CASE("TSFixedArray", "[list]") {
|
||||||
SECTION("constructs correctly") {
|
SECTION("constructs correctly") {
|
||||||
TSFixedArray<uint32_t> array;
|
TSFixedArray<uint32_t> array;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue