HighMap library (C++)
Loading...
Searching...
No Matches
assert.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 Public License. The full license is in the file LICENSE, distributed with
3 this software. */
4
13#pragma once
14#include <iostream>
15
16#include "highmap/array.hpp"
17
18namespace hmap
19{
20
22{
23 std::string msg = "";
24 float diff = 0.f;
25 float tolerance = 0.f;
26 float count = 0.f;
27 bool ret = true;
28
29 void print() const
30 {
31 std::string prefix = ret ? "ok - " : "NOK - ";
32 std::cout << prefix << "diff: " << std::to_string(diff)
33 << ", tolerance:" << std::to_string(tolerance)
34 << ", count:" << std::to_string(count) << "\n";
35 }
36};
37
38bool assert_almost_equal(const Array &a,
39 const Array &b,
40 float tolerance,
41 const std::string &fname = "",
42 AssertResults *p_results = nullptr);
43
44} // namespace hmap
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Definition algebra.hpp:28
bool assert_almost_equal(const Array &a, const Array &b, float tolerance, const std::string &fname="", AssertResults *p_results=nullptr)
Definition assert.cpp:14
Definition assert.hpp:22
float count
Definition assert.hpp:26
void print() const
Definition assert.hpp:29
std::string msg
Definition assert.hpp:23
float diff
Definition assert.hpp:24
bool ret
Definition assert.hpp:27
float tolerance
Definition assert.hpp:25