CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
test_tools_ext.h
1
2#ifndef _aspose_system_test_tools_ext_h_
3#define _aspose_system_test_tools_ext_h_
4
5#include "fwd.h"
6
7#include "system/string.h"
8
9#include <unordered_set>
10
11
12namespace System {
13
16{
19 {
24 TestMethodInfo(const char* name_space, const char* class_name, const char* method_name)
25 {
26 Namespace = name_space;
27 ClassName = class_name;
28 MethodName = method_name;
29 }
31 std::string Namespace;
33 std::string ClassName;
35 std::string MethodName;
36 };
37
43 static bool IsTest(const char* name_space, const char* class_name, const char* method_name)
44 {
45 for (auto& info : MethodList())
46 {
47 if (info.Namespace == name_space && info.ClassName == class_name && info.MethodName == method_name)
48 return true;
49 }
50 return false;
51 }
56 static bool IsTest(const char* class_name, const char* method_name)
57 {
58 for (auto& info : MethodList())
59 {
60 if (info.ClassName == class_name && info.MethodName == method_name)
61 return true;
62 }
63 return false;
64 }
65
71 static bool GetNamespace(const char* class_name, const char* method_name, std::string& name_space)
72 {
73 for (auto& info : MethodList())
74 {
75 if (info.ClassName == class_name && info.MethodName == method_name)
76 {
77 name_space = info.Namespace;
78 return true;
79 }
80 }
81 return false;
82 }
83
88 static void RegisterTest(const char* name_space, const char* class_name, const char* method_name)
89 {
90 auto &list = MethodList();
91 list.push_back(TestMethodInfo(name_space, class_name, method_name));
92 }
93
94private:
97 static std::list<TestMethodInfo> & MethodList()
98 {
99 static std::list<TestMethodInfo> value;
100 return value;
101 }
102};
103
104} // namespace System
105
106#endif // _aspose_system_test_tools_ext_h_
Definition: db_command.h:9
Information on test method.
Definition: test_tools_ext.h:19
std::string ClassName
Class name.
Definition: test_tools_ext.h:33
std::string MethodName
Method name.
Definition: test_tools_ext.h:35
TestMethodInfo(const char *name_space, const char *class_name, const char *method_name)
Constructor.
Definition: test_tools_ext.h:24
std::string Namespace
Namespace name.
Definition: test_tools_ext.h:31
Common functions to be used by testing translation.
Definition: test_tools_ext.h:16
static void RegisterTest(const char *name_space, const char *class_name, const char *method_name)
Adds test information to registry.
Definition: test_tools_ext.h:88
static bool GetNamespace(const char *class_name, const char *method_name, std::string &name_space)
Retrieves namespace of specified test.
Definition: test_tools_ext.h:71
static bool IsTest(const char *class_name, const char *method_name)
Checks if test method exists.
Definition: test_tools_ext.h:56
static bool IsTest(const char *name_space, const char *class_name, const char *method_name)
Checks if test method exists.
Definition: test_tools_ext.h:43