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__
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/string>
17#include <xtd/diagnostics/stack_frame>
18
20namespace xtd {
22 namespace tunit {
30 public:
32
50
67 static void fail(const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
68
85
102
103 protected:
105
113 static void error();
120 static void error(const xtd::string& message);
127 static void error(const xtd::string& actual, const xtd::string& expected, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
128
135 static void fail(const xtd::string& actual, const xtd::string& expected, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
136
140 template <typename value_t>
141 static xtd::string to_string(const value_t& value) {return __tunit_to_string(value);}
145 template <typename value_t>
146 static xtd::string to_string(const value_t* value) {return __tunit_to_string(value);}
147
151 template<typename collection_t>
152 static xtd::string join_items(const collection_t& collection) {return __tunit_join__items(collection);}
158
159 private:
160 static bool is_debug() noexcept;
161 };
162 }
163}
Contains std::basic_ostream<char_t, char_traits_t>& operator <<(std::basic_ostream<char_t,...
Contains__tunit_join__items functions.
Contains xtd::tunit::abort_error exception.
Contains xtd::tunit::assert_error exception.
Represents text as a sequence of character units.
Definition basic_string.h:79
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:47
static stack_frame current(const xtd::source_location &value=xtd::source_location::current()) noexcept
Crates a new xtd::diagnostics::stack_frame object corresponding to the location of the call site.
The base class for assert.
Definition base_assert.h:29
static xtd::string join_items(const collection_t &collection)
Join specified collection into xtd::string.
Definition base_assert.h:152
static xtd::string join_items(const xtd::string &str)
Join specified string into xtd::string.
static void ignore(const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Ignore current test. This is used by the other assert functions.
static void succeed(const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Generates a success with a generic message. This is used by the other assert functions.
static void fail(const xtd::string &actual, const xtd::string &expected, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void ignore(const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Ignore current test. This is used by the other assert functions.
static xtd::string to_string(const value_t *value)
Convert specified value to xtd::string.
Definition base_assert.h:146
static void error()
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void error(const xtd::string &message)
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void error(const xtd::string &actual, const xtd::string &expected, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void fail(const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
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=xtd::diagnostics::stack_frame::current())
Abort current test. This is used by the other assert functions.
static void fail(const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
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=xtd::diagnostics::stack_frame::current())
Generates a success with a generic message. This is used by the other assert functions.
static xtd::string to_string(const value_t &value)
Convert specified value to xtd::string.
Definition base_assert.h:141
static void abort(const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Abort current test. This is used by the other assert functions.
#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