2
3
4
5
8#include <gmock/gmock.h>
9#include <Core/Container/RuntimeMemoryBlock.h>
15
16
22
23
24
26 m0.add_element(
"1",
"float");
27 m0.add_element(
"2",
"float2");
28 m0.add_element(
"3",
"float3");
29 m0.add_element(
"4",
"float4");
33
34
41
42
48
49
50 EXPECT_EQ(m0.size(), 4);
53
54
55 EXPECT_EQ(m0.get_bytes(), 40);
58
59
60 EXPECT_EQ(m0.get_addr(),
nullptr);
63
64
65 EXPECT_EQ(m0.item_location(
"1"), 0);
66 EXPECT_EQ(m0.item_location(
"2"), 4);
67 EXPECT_EQ(m0.item_location(
"3"), 12);
68 EXPECT_EQ(m0.item_location(
"4"), 24);
72
73
79
80
81 m0.add_element(
"5",
"float");
82 m0.add_element(
"6",
"float2");
85
86
87 EXPECT_EQ(m0.size(), 6);
90
91
92 EXPECT_EQ(m0.get_bytes(), 52);
95
96
97 EXPECT_EQ(m0.get_addr(),
nullptr);
100
101
102 EXPECT_EQ(m0.item_location(
"5"), 40);
103 EXPECT_EQ(m0.item_location(
"6"), 44);
107
108
114
115
118 EXPECT_EQ(m0.get_addr(),
nullptr);
128 EXPECT_NE(m0.get_addr(),
nullptr);
133
134
140
141
145
146
147 EXPECT_NE(m0.get_value<
float>(
"1"), 1.0f);
148 EXPECT_NE(m0.get_value<glm::vec2>(
"2"), glm::vec2(2.0f));
149 EXPECT_NE(m0.get_value<glm::vec3>(
"3"), glm::vec3(3.0f));
150 EXPECT_NE(m0.get_value<glm::vec4>(
"4"), glm::vec4(4.0f));
153
154
155 m0.explain_element<
float>(
"1", 1.0f);
156 EXPECT_EQ(m0.get_value<
float>(
"1"), 1.0f);
159
160
161 m0.explain_element<glm::vec2>(
"2", glm::vec2(2.0f));
162 EXPECT_EQ(m0.get_value<glm::vec2>(
"2"), glm::vec2(2.0f));
165
166
167 m0.explain_element<glm::vec3>(
"3", glm::vec3(3.0f));
168 EXPECT_EQ(m0.get_value<glm::vec3>(
"3"), glm::vec3(3.0f));
171
172
173 m0.explain_element<glm::vec4>(
"4", glm::vec4(4.0f));
174 EXPECT_EQ(m0.get_value<glm::vec4>(
"4"), glm::vec4(4.0f));
178
179
185
186
190
191
194 m1->explain_element<glm::vec3>(
"1", glm::vec3(3.0f));
196 EXPECT_EQ(m1->get_value<glm::vec3>(
"1"), glm::vec3(3.0f));
199
200
201
203 EXPECT_NE(addr,
nullptr);
206 EXPECT_NE(addr,
nullptr);
210
211
217
218
219 EXPECT_EQ(m0.item_location(
"1"), 0 );
220 EXPECT_EQ(m0.item_location(
"2"), 4 );
221 EXPECT_EQ(m0.item_location(
"3"), 12);
222 EXPECT_EQ(m0.item_location(
"4"), 24);
225
226
227 EXPECT_EQ(m0.item_location(
"5"), UINT32_MAX);
228 EXPECT_EQ(m0.item_location(
"6"), UINT32_MAX);
229 EXPECT_EQ(m0.item_location(
"7"), UINT32_MAX);
230 EXPECT_EQ(m0.item_location(
"8"), UINT32_MAX);
234
235
241
242
243 EXPECT_EQ(m0.has_value(
"1"),
true);
244 EXPECT_EQ(m0.has_value(
"2"),
true);
245 EXPECT_EQ(m0.has_value(
"3"),
true);
246 EXPECT_EQ(m0.has_value(
"4"),
true);
249
250
251 EXPECT_EQ(m0.has_value(
"5"),
false);
252 EXPECT_EQ(m0.has_value(
"6"),
false);
253 EXPECT_EQ(m0.has_value(
"7"),
false);
254 EXPECT_EQ(m0.has_value(
"8"),
false);
#define SPICESTEST_PROFILE_SCOPE_LINE2(name, line)
#define SPICESTEST_PROFILE_SCOPE(name)
#define SPICESTEST_PROFILE_END_SESSION()
#define SPICESTEST_PROFILE_BEGIN_SESSION(name, filepath)
#define SPICESTEST_PROFILE_SCOPE_LINE(name, line)
#define SPICESTEST_PROFILE_FUNCTION()
InstrumentationTimer(const char *name)
std::chrono::time_point< std::chrono::steady_clock > m_StartTimepoint
Instrumentor(Instrumentor &&)=delete
static Instrumentor & Get()
void BeginSession(const std::string &name, const std::string &filepath="results.json")
void WriteProfile(const ProfileResult &result)
InstrumentationSession * m_CurrentSession
std::ofstream m_OutputStream
Instrumentor(const Instrumentor &)=delete
void InternalEndSession()
void Test(float f)
Basic Override Class Function.
static void Test1()
Static Class Function.
void Test()
Basic Override Class Function.
void TearDown() override
Testing class TearDown function.
std::vector< scl::directed_acyclic_node > m_Nodes
void SetUp() override
Testing class initialize function.
scl::directed_acyclic_graph m_DAG
The interface is inherited from testing::Test. Registy on Initialize.
scl::kd_tree< 2 > m_KDTree
Create a KDTree with 2 dimensions.
void TearDown() override
Testing class TearDown function.
void SetUp() override
Testing class initialize function.
The interface is inherited from testing::Test. Registry on Initialize.
scl::linked_unordered_map< int, std::string > c1
scl::linked_unordered_map< float, std::string > c2
scl::linked_unordered_map< std::string, std::string > c0
void SetUp() override
Testing class initialize function.
void TearDown() override
Testing class TearDown function.
The interface is inherited from testing::Test. Registry on Initialize.
void SetUp() override
The interface is inherited from testing::Test. Registry on Initialize.
void TearDown() override
Testing class TearDown function.
scl::runtime_memory_block m0
Unit Test for RuntimeMemoryBlock.
The kd_tree with K dimensions container Class. K the number of dimensions. Every node in the tree is ...
The container combines hashmap and list together. Used in the case that we want iter a hashmap in ord...
void build()
Malloc a memory to begin_.
void add_element(const std::string &name, const std::string &type)
Add a element to object_, means a memory block will be occupied with given param type.
runtime_memory_block()=default
Constructor Function.
void * get_addr() const
Get the begin_.
The container is wrapper of a continue memory block. Used in Material::BuildMaterial(),...
int main(int argc, char **argv)
The Entry of SpicesTest.
constexpr auto CleanupOutputString(const char(&expr)[N], const char(&remove)[K])
TEST_F(runtime_memory_block_test, Initialize)
Testing if initialize successfully.
TEST_F(directed_acyclic_graph_test, Addnode)
Testing if add node successfully.
TEST_F(linked_unordered_map_test, Initialize)
Testing if initialize successfully.
TEST_F(kd_tree_test, Insert)
Testing if Insert successfully.
std::chrono::microseconds ElapsedTime
FloatingPointMicroseconds Start