xtd 0.2.0
Loading...
Searching...
No Matches
does_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<typename actual_t> class does_value;
25
26 template<typename actual_t>
27 class does_not_value : public actual_value<actual_t> {
28 public:
30
42 template<typename expected_t>
43 auto end_with(const expected_t& expected, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
44 if (actual_value<actual_t>::is_assert()) xtd::tunit::string_assert::does_not_end_with(expected, actual_value<actual_t>::actual(), stack_frame);
45 else if (actual_value<actual_t>::is_valid()) xtd::tunit::string_valid::does_not_end_with(expected, actual_value<actual_t>::actual(), stack_frame);
46 else xtd::tunit::string_assume::does_not_end_with(expected, actual_value<actual_t>::actual(), stack_frame);
48 }
49
60 template<typename expected_t>
61 auto end_with(const expected_t& expected, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
62 if (actual_value<actual_t>::is_assert()) xtd::tunit::string_assert::does_not_end_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
63 else if (actual_value<actual_t>::is_valid()) xtd::tunit::string_valid::does_not_end_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
64 else xtd::tunit::string_assume::does_not_end_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
66 }
67
78 template<typename expected_t>
79 auto start_with(const expected_t& expected, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
80 if (actual_value<actual_t>::is_assert()) xtd::tunit::string_assert::does_not_start_with(expected, actual_value<actual_t>::actual(), stack_frame);
81 else if (actual_value<actual_t>::is_valid()) xtd::tunit::string_valid::does_not_start_with(expected, actual_value<actual_t>::actual(), stack_frame);
82 else xtd::tunit::string_assume::does_not_start_with(expected, actual_value<actual_t>::actual(), stack_frame);
84 }
85
96 template<typename expected_t>
97 auto start_with(const expected_t& expected, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
98 if (actual_value<actual_t>::is_assert()) xtd::tunit::string_assert::does_not_start_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
99 else if (actual_value<actual_t>::is_valid()) xtd::tunit::string_valid::does_not_start_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
100 else xtd::tunit::string_assume::does_not_start_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
102 }
103
104
105 protected:
107
109 does_not_value() = default;
110 does_not_value(actual_value<actual_t>&& v) : actual_value<actual_t> {std::move(v)} {}
111 does_not_value(const actual_value<actual_t>& v) : actual_value<actual_t> {v} {}
112
113 private:
114 template<typename value_t> friend class does_value;
116 };
117 }
118 }
119}
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:46
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.
Definition actual_value.hpp:18
Definition does_not_value.hpp:27
auto end_with(const expected_t &expected, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that string ends with specified expected value.
Definition does_not_value.hpp:43
auto start_with(const expected_t &expected, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that string starts with specified item and specified user message.
Definition does_not_value.hpp:97
auto end_with(const expected_t &expected, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that string ends with specified expected value and specified user message.
Definition does_not_value.hpp:61
auto start_with(const expected_t &expected, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that string starts with specified item.
Definition does_not_value.hpp:79
Definition does_value.hpp:27
Definition operator_value.hpp:21
static void does_not_end_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that string ends with item.
static void does_not_start_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that string starts with item.
static void does_not_start_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that string starts with item.
static void does_not_end_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that string starts with item.
static void does_not_start_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that string starts with item.
static void does_not_end_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that string starts with item.
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.