KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
test_case_result.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Pooyan Dadvand
11 //
12 //
13 
14 #pragma once
15 
16 // System includes
17 #include <string>
18 #include <iostream>
19 
20 // External includes
21 
22 // Project includes
24 
25 namespace Kratos::Testing
26 {
29 
32 
34 
36 class KRATOS_API(KRATOS_CORE) TestCaseResult
37 {
38 public:
41 
45 
48 
50  TestCaseResult(TestCaseResult const& rOther);
51 
53  virtual ~TestCaseResult();
54 
55 
59 
61  TestCaseResult& operator=(TestCaseResult const& rOther);
62 
66 
68  virtual void Reset();
69 
70 
74 
75  void SetToSucceed();
76 
77  void SetToFailed();
78 
79  void SetToSkipped();
80 
81  void SetOutput(const std::string& TheOutput);
82 
83  const std::string& GetOutput() const;
84 
85  void SetErrorMessage(const std::string& TheMessage);
86 
87  const std::string& GetErrorMessage() const;
88 
89  void SetSetupElapsedTime(double ElapsedTime);
90 
91  double GetSetupElapsedTime() const;
92 
93  void SetRunElapsedTime(double ElapsedTime);
94 
95  double GetRunElapsedTime() const;
96 
97  void SetTearDownElapsedTime(double ElapsedTime);
98 
99  double GetTearDownElapsedTime() const;
100 
101  void SetElapsedTime(double ElapsedTime);
102 
103  double GetElapsedTime() const;
104 
105 
106 
110 
111  bool IsSucceed() const;
112 
113  bool IsFailed() const;
114 
115  bool IsSkipped() const;
116 
117  bool IsRun() const;
118 
122 
124  virtual std::string Info() const;
125 
127  virtual void PrintInfo(std::ostream& rOStream) const;
128 
130  virtual void PrintData(std::ostream& rOStream) const;
131 
132 
136 
137 
139 
140 
141 private:
142 
145 
146  enum class Result {
147  DidNotRun,
148  Passed,
149  Failed,
150  Skipped
151  };
152 
156 
157 
161 
162  Result mStatus;
163  std::string mOutput;
164  std::string mErrorMessage;
165  double mSetupElapsedTime;
166  double mRunElapsedTime;
167  double mTearDownElapsedTime;
168  double mElapsedTime;
169 
170 
172 
173 }; // Class TestCaseResult
174 
176 
179 
181 inline std::ostream& operator << (std::ostream& rOStream,
182  const TestCaseResult& rThis)
183 {
184  rThis.PrintInfo(rOStream);
185  rOStream << std::endl;
186  rThis.PrintData(rOStream);
187 
188  return rOStream;
189 }
191 
193 } // namespace Kratos::Testing.
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
The test case base class.
Definition: test_case_result.h:37
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: test_case_result.cpp:175
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: test_case_result.cpp:169
std::ostream & operator<<(std::ostream &rOStream, const TestCase &rThis)
output stream function
Definition: test_case.h:174
Definition: distributed_test_case.cpp:24