Halide 22.0.0 Halide compiler and libraries

test.h
Go to the documentation of this file.
1#ifndef TEST_H
2#define TEST_H
3
4#define HALIDE_KEEP_MACROS
5#include "Halide.h"
6
7 namespace Halide {
8 namespace Internal {
9 namespace Autoscheduler {
10
11#define EXPECT_EQ(expected, actual) expect_eq(__LINE__, expected, actual)
12#define APPROX_EQ(expected, actual, epsilon) approx_eq(__LINE__, expected, actual, epsilon)
13#define EXPECT(expected) expect(__LINE__, expected)
14
15 template<typename A, typename B>
16 void expect_eq(int line, const A &expected, const B &actual) {
17 user_assert(expected == actual)
18 << "Assert failed on line " << line << "."
19 << "\nExpected value = " << expected
20 << "\nActual value = " << actual;
21}
22
23 template<typename A, typename B>
24 void approx_eq(int line, const A &expected, const B &actual, float epsilon) {
25 user_assert(std::abs(expected - actual) < epsilon)
26 << "Assert failed on line " << line << "."
27 << "\nExpected value = " << expected
28 << "\nActual value = " << actual;
29}
30
31 template<typename A>
32 void expect(int line, const A &expected) {
33 user_assert(expected)
34 << "Assert failed on line " << line << "."
35 << "\nExpected value to be true\n";
36}
37
38} // namespace Autoscheduler
39} // namespace Internal
40} // namespace Halide
41
42#endif // TEST_H
user_assert
#define user_assert(c)
Definition: Error.h:233
Halide::Internal::Autoscheduler::expect
void expect(int line, const A &expected)
Definition: test.h:32
Halide::Internal::Autoscheduler::approx_eq
void approx_eq(int line, const A &expected, const B &actual, float epsilon)
Definition: test.h:24
Halide::Internal::Autoscheduler::expect_eq
void expect_eq(int line, const A &expected, const B &actual)
Definition: test.h:16
Halide::Internal::abs
ConstantInterval abs(const ConstantInterval &a)
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AbstractGenerator.h:19