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
30namespace anch::ut {
31
38 void assertTrue(bool check, const std::string& message = "");
39
46 void assertFalse(bool check, const std::string& message = "");
47
53 void fail(const std::string& message = "");
54
64 template<typename... T>
65 void assert(bool check, std::string_view message, const T&... args);
66
79 template<typename T>
80 bool equals(const char* const field, const std::set<T>& expected, const std::set<T>& value, std::ostream& out = std::cout);
81
94 template<typename T>
95 bool equals(const char* const field, const std::list<T>& expected, const std::list<T>& value, std::ostream& out = std::cout);
96
109 template<typename T>
110 bool equals(const char* const field, const std::vector<T>& expected, const std::vector<T>& value, std::ostream& out = std::cout);
111
124 template<typename T>
125 bool equals(const char* const field, const std::optional<T>& expected, const std::optional<T>& value, std::ostream& out = std::cout);
126
139 template<typename T>
140 bool equalsPtr(const char* const field, const T* const expected, const T* const value, std::ostream& out = std::cout);
141
154 template<typename T>
155 bool equals(const char* const field, const T& expected, const T& value, std::ostream& out = std::cout);
156
157} // anch::ut
158
159#include "ut/impl/assert.hpp"