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
114 template<class expected_t>
115 auto same_as(const expected_t& expected, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
116 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::are_not_same(expected, actual_value<actual_t>::actual(), stack_frame);
117 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::are_not_same(expected, actual_value<actual_t>::actual(), stack_frame);
118 else xtd::tunit::assume::are_not_same(expected, actual_value<actual_t>::actual(), stack_frame);
120 }
121
134 template<class expected_t>
135 auto same_as(const expected_t& expected, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
136 if (actual_value<actual_t>::is_assert()) xtd::tunit::assert::are_not_same(expected, actual_value<actual_t>::actual(), message, stack_frame);
137 else if (actual_value<actual_t>::is_valid()) xtd::tunit::valid::are_not_same(expected, actual_value<actual_t>::actual(), message, stack_frame);
138 else xtd::tunit::assume::are_not_same(expected, actual_value<actual_t>::actual(), message, stack_frame);
140 }
141
142
143 protected:
145
147 is_not_value() = default;
148 is_not_value(actual_value<actual_t>&& v) : actual_value<actual_t> {std::move(v)} {}
149 is_not_value(const actual_value<actual_t>& v) : actual_value<actual_t> {v} {}
151
152 private:
153 template<class value_t> friend class is_value;
154 };
155 }
156 }
157}
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 stack_frame current(const xtd::diagnostics::source_location &value=xtd::diagnostics::source_location::current()) noexcept
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 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_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 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
Definition actual_value.hpp:18
Definition is_not_value.hpp:27
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:115
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 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:135
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 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.