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_skipped_exception.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 <stdexcept>
18 #include <string>
19 #include <iostream>
20 #include <sstream>
21 #include <vector>
22 
23 // External includes
24 
25 // Project includes
26 #include "includes/exception.h"
27 
28 namespace Kratos
29 {
32 
35 
37 class KRATOS_API(KRATOS_CORE) TestSkippedException : public Exception
38 {
39 public:
42 
46 
49 
50  explicit TestSkippedException(const std::string &rWhat);
51 
52  TestSkippedException(const std::string &rWhat, const CodeLocation &Location);
53 
56 
58  ~TestSkippedException() noexcept override;
59 
63 
65  TestSkippedException& operator << (CodeLocation const& TheLocation);
66 
68  template<class StreamValueType>
69  TestSkippedException& operator << (StreamValueType const& rValue)
70  {
72  return *this;
73  }
74 
76  TestSkippedException& operator << (std::ostream& (*pf)(std::ostream&));
77 
79  TestSkippedException& operator << (const char * rString);
80 
84 
86  std::string Info() const override;
87 
89  void PrintInfo(std::ostream &rOStream) const override;
90 
92  void PrintData(std::ostream &rOStream) const override;
93 
95 
96 }; // Class TestSkippedException
97 
99 
102 
103 #define KRATOS_SKIP_TEST throw TestSkippedException("Test Skipped: ", KRATOS_CODE_LOCATION)
104 
105 #define KRATOS_SKIP_TEST_IF(conditional) \
106  if (conditional) \
107  throw TestSkippedException("Test Skipped: ", KRATOS_CODE_LOCATION)
108 
109 #define KRATOS_SKIP_TEST_IF_NOT(conditional) \
110  if (!(conditional)) \
111  throw TestSkippedException("Test Skipped: ", KRATOS_CODE_LOCATION)
112 
116 
118 std::istream &operator>>(std::istream &rIStream,
119  TestSkippedException &rThis);
120 
122 KRATOS_API(KRATOS_CORE)
123 std::ostream &operator<<(std::ostream &rOStream, const TestSkippedException &rThis);
124 
126 
128 
129 } // namespace Kratos.
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Definition: code_location.h:31
Extends the std::exception class with more information about error location.
Definition: exception.h:49
Exception & operator<<(CodeLocation const &TheLocation)
Code Location stream function to add callers to call stack.
Definition: exception.cpp:115
Exception type used to signal that a test should be skipped.
Definition: test_skipped_exception.h:38
#define KRATOS_API(...)
Definition: kratos_export_api.h:40
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432