SpiecsEngine
 
Loading...
Searching...
No Matches
DirectedAcyclicGraph_test.h
Go to the documentation of this file.
1/**
2* @file DirectedAcyclicGraph_test.h.
3* @brief The DirectedAcyclicGraph_test Definitions.
4* @author Spices.
5*/
6
7#pragma once
8#include <gmock/gmock.h>
9#include <Core/Container/DirectedAcyclicGraph.h>
10#include "Instrumentor.h"
11
12namespace SpicesTest {
13
14 /**
15 * @brief Test Function Class.
16 */
18 {
19 public:
20
21 /**
22 * @brief Basic Override Class Function.
23 */
24 void Test()
25 {
26 std::cout << "Hello directed_acyclic_graphFuncTest::Test 2" << std::endl;
27 }
28
29 /**
30 * @brief Basic Override Class Function.
31 * @param[in] f In float.
32 */
33 void Test(float f)
34 {
35 std::cout << "Hello directed_acyclic_graphFuncTest::Test(float) 3" << std::endl;
36 }
37
38 /**
39 * @brief Static Class Function.
40 */
41 static void Test1()
42 {
43 std::cout << "Hello directed_acyclic_graphFuncTest::Test1 1 " << std::endl;
44 }
45 };
46
47 /**
48 * @brief The interface is inherited from testing::Test.
49 * Registy on Initialize.
50 */
52 {
53 protected:
54
55 /**
56 * @brief Testing class initialize function.
57 */
58 void SetUp() override {}
59
60 /**
61 * @brief Testing class TearDown function.
62 */
64
66
68 };
69
70 /**
71 * @brief Testing if add node successfully.
72 */
74
76
78
79 m_Nodes.push_back({ "A", {"C"}, std::bind((void(directed_acyclic_graphFuncTest::*)()) & directed_acyclic_graphFuncTest::Test, &funcTestClass)}); /* @brief Override Class Function. */
80 m_Nodes.push_back({ "B", {"A"}, std::bind((void(directed_acyclic_graphFuncTest::*)(float)) & directed_acyclic_graphFuncTest::Test, &funcTestClass, 1.0f)}); /* @brief Override Class Function. */
81 m_Nodes.push_back({ "C", {}, std::bind(&directed_acyclic_graphFuncTest::Test1)}); /* @brief Static Class Function. */
82
83 for (int i = 0; i < m_Nodes.size(); i++)
84 {
85 m_DAG.add_node(&m_Nodes[i]);
86 }
87
88 /**
89 * @brief Testing initialized container's size.
90 */
91 EXPECT_EQ(m_Nodes.size(), 3);
92 EXPECT_EQ(m_DAG.size(), 3);
93 }
94
95 /**
96 * @brief Testing if Execute successfully.
97 */
99
101
102 directed_acyclic_graphFuncTest funcTestClass;
103
104 m_Nodes.push_back({ "A", {"C"}, std::bind((void(directed_acyclic_graphFuncTest::*)()) & directed_acyclic_graphFuncTest::Test, &funcTestClass) }); /* @brief Override Class Function. */
105 m_Nodes.push_back({ "B", {"A"}, std::bind((void(directed_acyclic_graphFuncTest::*)(float)) & directed_acyclic_graphFuncTest::Test, &funcTestClass, 1.0f) }); /* @brief Override Class Function. */
106 m_Nodes.push_back({ "C", {}, std::bind(&directed_acyclic_graphFuncTest::Test1) }); /* @brief Static Class Function. */
107
108 for (int i = 0; i < m_Nodes.size(); i++)
109 {
110 m_DAG.add_node(&m_Nodes[i]);
111 }
112
113 m_DAG.execute();
114
115 /**
116 * @brief Testing initialized container's size.
117 */
118 EXPECT_EQ(m_Nodes.size(), 3);
119 }
120}
#define SPICES_FUNC_SIG
#define SPICESTEST_PROFILE_SCOPE_LINE2(name, line)
#define SPICESTEST_PROFILE_SCOPE(name)
#define SPICES_PROFILE
#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 Test(float f)
Basic Override 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.
The interface is inherited from testing::Test. Registy on Initialize.
int main(int argc, char **argv)
The Entry of SpicesTest.
Definition main.cpp:76
constexpr auto CleanupOutputString(const char(&expr)[N], const char(&remove)[K])
TEST_F(directed_acyclic_graph_test, Addnode)
Testing if add node successfully.
std::thread::id ThreadID
std::chrono::microseconds ElapsedTime
FloatingPointMicroseconds Start