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
18
namespace
hmap
19
{
20
21
struct
AssertResults
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
38
bool
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
array.hpp
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
hmap
Definition
algebra.hpp:28
hmap::assert_almost_equal
bool assert_almost_equal(const Array &a, const Array &b, float tolerance, const std::string &fname="", AssertResults *p_results=nullptr)
Definition
assert.cpp:14
hmap::AssertResults
Definition
assert.hpp:22
hmap::AssertResults::count
float count
Definition
assert.hpp:26
hmap::AssertResults::print
void print() const
Definition
assert.hpp:29
hmap::AssertResults::msg
std::string msg
Definition
assert.hpp:23
hmap::AssertResults::diff
float diff
Definition
assert.hpp:24
hmap::AssertResults::ret
bool ret
Definition
assert.hpp:27
hmap::AssertResults::tolerance
float tolerance
Definition
assert.hpp:25
HighMap
include
highmap
dbg
assert.hpp
Generated by
1.9.8