1/*******************************************************************************
2 Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
3 The use of this software is governed by the LICENSE file.
4*******************************************************************************/
5
6#pragma once
7
8#define BENCHMARK CATCH_BENCHMARK
9#include <catch.hpp>
10#undef BENCHMARK
11
12namespace taichi {
13
14#define TI_CHECK_EQUAL(A, B, tolerance) \
15 { \
16 if (!taichi::math::equal(A, B, tolerance)) { \
17 std::cout << A << std::endl << B << std::endl; \
18 } \
19 CHECK(taichi::math::equal(A, B, tolerance)); \
20 }
21
22#define TI_ASSERT_EQUAL(A, B, tolerance) \
23 { \
24 if (!taichi::math::equal(A, B, tolerance)) { \
25 std::cout << A << std::endl << B << std::endl; \
26 TI_ERROR(#A " != " #B); \
27 } \
28 }
29
30#define TI_TEST(x) TEST_CASE(x, ("[" x "]"))
31#define TI_CHECK(x) CHECK(x)
32#define TI_TEST_PROGRAM \
33 auto prog_ = std::make_unique<Program>(); \
34 prog_->materialize_runtime();
35
36int run_tests(std::vector<std::string> argv);
37
38} // namespace taichi
39