xtd 0.2.0
Loading...
Searching...
No Matches
base_assert.h
Go to the documentation of this file.
1
4#pragma once
5#include "../tunit_export.h"
6#define __XTD_TUNIT_INTERNAL__
7#include "__default_insert_basic_ostream_operator.h"
8#include "__tunit_join__items.h"
9#define __XTD_TUNIT_INTERNAL__
10#include "abort_error.h"
11#include "assert_error.h"
12#include "ignore_error.h"
13#include <xtd/static>
14#include <xtd/types>
15#include <xtd/typeof>
16#include <xtd/ustring>
17#include <xtd/diagnostics/stack_frame>
18
20namespace xtd {
22 namespace tunit {
30 public:
32
39 static void abort();
47 static void abort(const xtd::diagnostics::stack_frame& stack_frame);
54 static void abort(const xtd::ustring& message);
55
63 static void abort(const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame);
64
71 static void fail();
79 static void fail(const xtd::diagnostics::stack_frame& stack_frame);
87 static void fail(const xtd::ustring& message);
96 static void fail(const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame);
97
103 static void ignore();
111 static void ignore(const xtd::diagnostics::stack_frame& stack_frame);
118 static void ignore(const xtd::ustring& message);
126 static void ignore(const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame);
127
133 static void succeed();
140 static void succeed(const xtd::diagnostics::stack_frame& stack_frame);
147 static void succeed(const xtd::ustring& message);
155 static void succeed(const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame);
157
158 protected:
160
168 static void error();
175 static void error(const xtd::ustring& message);
182 static void error(const xtd::ustring& actual, const xtd::ustring& expected, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame);
183
190 static void fail(const xtd::ustring& actual, const xtd::ustring& expected, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame);
191
195 template <typename value_t>
196 static xtd::ustring to_string(const value_t& value) {return __tunit_to_string(value);}
200 template <typename value_t>
201 static xtd::ustring to_string(const value_t* value) {return __tunit_to_string(value);}
202
206 template<typename collection_t>
207 static xtd::ustring join_items(const collection_t& collection) {return __tunit_join__items(collection);}
213
214 private:
215 static bool is_debug() noexcept;
216 };
217 }
218}
Contains xtd::tunit::abort_error exception.
Contains xtd::tunit::assert_error exception.
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:37
The base class for assert.
Definition base_assert.h:29
static void abort()
Abort current test. This is used by the other assert functions.
static void fail(const xtd::ustring &message)
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void abort(const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Abort current test. This is used by the other assert functions.
static void ignore(const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Ignore current test. This is used by the other assert functions.
static xtd::ustring to_string(const value_t &value)
Convert specified value to xtd::ustring.
Definition base_assert.h:196
static void succeed(const xtd::ustring &message)
Generates a success with a generic message. This is used by the other assert functions.
static void ignore()
Ignore current test. This is used by the other assert functions.
static xtd::ustring to_string(const value_t *value)
Convert specified value to xtd::ustring.
Definition base_assert.h:201
static void error()
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void succeed(const xtd::diagnostics::stack_frame &stack_frame)
Generates a success with a generic message. This is used by the other assert functions.
static void error(const xtd::ustring &actual, const xtd::ustring &expected, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void abort(const xtd::diagnostics::stack_frame &stack_frame)
Abort current test. This is used by the other assert functions.
static void ignore(const xtd::diagnostics::stack_frame &stack_frame)
Ignore current test. This is used by the other assert functions.
static void error(const xtd::ustring &message)
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static xtd::ustring join_items(const collection_t &collection)
Join specified collection into xtd::ustring.
Definition base_assert.h:207
static xtd::ustring join_items(const xtd::ustring &str)
Join specified string into xtd::ustring.
static void fail(const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void succeed(const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Generates a success with a generic message. This is used by the other assert functions.
static void fail()
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void abort(const xtd::ustring &message)
Abort current test. This is used by the other assert functions.
static void fail(const xtd::ustring &actual, const xtd::ustring &expected, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void fail(const xtd::diagnostics::stack_frame &stack_frame)
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void succeed()
Generates a success with a generic message. This is used by the other assert functions.
static void ignore(const xtd::ustring &message)
Ignore current test. This is used by the other assert functions.
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.h:37
#define tunit_export_
Define shared library export.
Definition tunit_export.h:13
Contains xtd::tunit::ignore_error exception.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10