AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
assert.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3 Copyright (C) 2020 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <string>
23#include <string_view>
24#include <iostream>
25#include <optional>
26#include <list>
27#include <set>
28#include <vector>
29#include <memory>
30
31namespace anch::ut {
32
39 void assertTrue(bool check, const std::string& message = "");
40
47 void assertFalse(bool check, const std::string& message = "");
48
54 void fail(const std::string& message = "");
55
65 template<typename... T>
66 void assert(bool check, std::string_view message, const T&... args);
67
80 template<typename T>
81 bool equals(const char* const field, const std::set<T>& expected, const std::set<T>& value, std::ostream& out = std::cout);
82
95 template<typename T>
96 bool equals(const char* const field, const std::list<T>& expected, const std::list<T>& value, std::ostream& out = std::cout);
97
110 template<typename T>
111 bool equals(const char* const field, const std::vector<T>& expected, const std::vector<T>& value, std::ostream& out = std::cout);
112
125 template<typename T>
126 bool equals(const char* const field, const std::optional<T>& expected, const std::optional<T>& value, std::ostream& out = std::cout);
127
140 template<typename T>
141 bool equals(const char* const field, const std::shared_ptr<T>& expected, const std::shared_ptr<T>& value, std::ostream& out = std::cout);
142
155 template<typename T>
156 bool equalsPtr(const char* const field, const T* const expected, const T* const value, std::ostream& out = std::cout);
157
170 template<typename T>
171 bool equals(const char* const field, const T& expected, const T& value, std::ostream& out = std::cout);
172
173} // anch::ut
174
175#include "ut/impl/assert.hpp"