xtd 0.2.0
Loading...
Searching...
No Matches
is_not_value.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "operator_value.hpp"
6#include "../assert.hpp"
7#include "../assume.hpp"
11#include "../string_assert.hpp"
12#include "../string_assume.hpp"
13#include "../string_valid.hpp"
14#include "../valid.hpp"
15
17namespace xtd {
19 namespace tunit {
21 namespace constraints {
23 template<class actual_t> class is_value;
25
26 template<class actual_t>
27 class is_not_value : public actual_value<actual_t> {
28 public:
30
43 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::is_not_empty(actual_value<actual_t>::actual(), stack_frame);
44 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::is_not_empty(actual_value<actual_t>::actual(), stack_frame);
45 else xtd::tunit::assume::is_not_empty(actual_value<actual_t>::actual(), stack_frame);
47 }
48
60 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::is_not_empty(actual_value<actual_t>::actual(), stack_frame);
61 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::is_not_empty(actual_value<actual_t>::actual(), stack_frame);
62 else xtd::tunit::assume::is_not_empty(actual_value<actual_t>::actual(), stack_frame);
64 }
65
76 template<class expected_t>
77 auto equal_to(const expected_t& expected, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
78 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::are_not_equal(expected, actual_value<actual_t>::actual(), stack_frame);
79 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::are_not_equal(expected, actual_value<actual_t>::actual(), stack_frame);
80 else xtd::tunit::assume::are_not_equal(expected, actual_value<actual_t>::actual(), stack_frame);
82 }
83
94 template<class expected_t>
95 auto equal_to(const expected_t& expected, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
96 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::are_not_equal(expected, actual_value<actual_t>::actual(), message, stack_frame);
97 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::are_not_equal(expected, actual_value<actual_t>::actual(), message, stack_frame);
98 else xtd::tunit::assume::are_not_equal(expected, actual_value<actual_t>::actual(), message, stack_frame);
100 }
101
113 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::is_false(actual_value<actual_t>::actual(), stack_frame);
114 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::is_false(actual_value<actual_t>::actual(), stack_frame);
115 else xtd::tunit::assume::is_false(actual_value<actual_t>::actual(), stack_frame);
117 }
118
130 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::is_false(actual_value<actual_t>::actual(), stack_frame);
131 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::is_false(actual_value<actual_t>::actual(), stack_frame);
132 else xtd::tunit::assume::is_false(actual_value<actual_t>::actual(), stack_frame);
134 }
135
148 template<class expected_t>
149 auto same_as(const expected_t& expected, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
150 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::are_not_same(expected, actual_value<actual_t>::actual(), stack_frame);
151 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::are_not_same(expected, actual_value<actual_t>::actual(), stack_frame);
152 else xtd::tunit::assume::are_not_same(expected, actual_value<actual_t>::actual(), stack_frame);
154 }
155
168 template<class expected_t>
169 auto same_as(const expected_t& expected, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
170 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::are_not_same(expected, actual_value<actual_t>::actual(), message, stack_frame);
171 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::are_not_same(expected, actual_value<actual_t>::actual(), message, stack_frame);
172 else xtd::tunit::assume::are_not_same(expected, actual_value<actual_t>::actual(), message, stack_frame);
174 }
175
187 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::is_true(actual_value<actual_t>::actual(), stack_frame);
188 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::is_true(actual_value<actual_t>::actual(), stack_frame);
189 else xtd::tunit::assume::is_true(actual_value<actual_t>::actual(), stack_frame);
191 }
192
204 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::is_true(actual_value<actual_t>::actual(), stack_frame);
205 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::is_true(actual_value<actual_t>::actual(), stack_frame);
206 else xtd::tunit::assume::is_true(actual_value<actual_t>::actual(), stack_frame);
208 }
209
210
211 protected:
213
215 is_not_value() = default;
216 is_not_value(actual_value<actual_t>&& v) : actual_value<actual_t> {std::move(v)} {}
217 is_not_value(const actual_value<actual_t>& v) : actual_value<actual_t> {v} {}
219
220 private:
221 template<class value_t> friend class is_value;
222 };
223 }
224 }
225}
Contains xtd::tunit::assume class.
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.hpp:48
static auto current(const xtd::diagnostics::source_location &value=xtd::diagnostics::source_location::current()) noexcept -> xtd::diagnostics::stack_frame
Crates a new xtd::diagnostics::stack_frame object corresponding to the location of the call site.
static void is_not_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that collection does not contain any item.
Definition assert.hpp:712
static void is_true(bool condition, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that a condition is true.
static void are_not_same(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that two objects do refer to differents objects.
Definition assert.hpp:211
static void are_not_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that two type are not equal.
Definition assert.hpp:171
static void is_false(bool condition, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that a condition is false.
static void is_not_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that collection does not contain any item.
Definition assume.hpp:744
static void is_true(bool condition, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that a condition is true.
static void are_not_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two type are not equal.
Definition assume.hpp:166
static void are_not_same(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two objects do refer to differents objects.
Definition assume.hpp:210
static void is_false(bool condition, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that a condition is false.
Definition actual_value.hpp:18
Definition is_not_value.hpp:27
auto true_(const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that value is not true.
Definition is_not_value.hpp:186
auto true_(const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that value is not true and specified user message.
Definition is_not_value.hpp:203
auto same_as(const expected_t &expected, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that value is not same as specified expected.
Definition is_not_value.hpp:149
auto equal_to(const expected_t &expected, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that value not is equal to specified expected.
Definition is_not_value.hpp:77
auto empty(const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that value is empty.
Definition is_not_value.hpp:42
auto equal_to(const expected_t &expected, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that value is not equal to specified expected with specified user message.
Definition is_not_value.hpp:95
auto false_(const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that value is not false.
Definition is_not_value.hpp:112
auto same_as(const expected_t &expected, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that value is not same as specified expected with specified user message.
Definition is_not_value.hpp:169
auto false_(const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that value is not false and specified user message.
Definition is_not_value.hpp:129
auto empty(const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that value is empty.
Definition is_not_value.hpp:59
Definition is_value.hpp:28
Definition operator_value.hpp:21
static void are_not_same(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that two objects do refer to different objects.
Definition valid.hpp:199
static void is_false(bool condition, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that a condition is false.
static void is_true(bool condition, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that a condition is true.
static void are_not_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that two type are not equal.
Definition valid.hpp:158
static void is_not_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that collection does not contain any item.
Definition valid.hpp:705
Contains xtd::tunit::collection_assert class.
Contains xtd::tunit::collection_assume class.
Contains xtd::tunit::collection_valid class.
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition self.hpp:20
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
@ v
The V key.
Definition console_key.hpp:130
The constraints namespace contains the constraint-based assert model.
Definition actual_value.hpp:12
The tunit namespace contains a unit test library.
Definition abort_error.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::tunit::constraints::operator_value class.
Contains xtd::tunit::string_assert class.
Contains xtd::tunit::string_assume class.
Contains xtd::tunit::string_valid class.
Contains xtd::tunit::valid class.
Contains xtd::tunit::assert class.