ViennaLS
Loading...
Searching...
No Matches
lsTestAsserts.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <lsCheck.hpp>
4
5// Fix for builds on Windows since MSVC does not expose __PRETTY_FUNCTION__
6#ifdef _MSC_VER
7#define __PRETTY_FUNCTION__ __FUNCSIG__
8#endif
9
10#define LSTEST_ASSERT(condition) \
11 { \
12 if (!(condition)) { \
13 throw std::runtime_error(std::string(__FILE__) + std::string(":") + \
14 std::to_string(__LINE__) + \
15 std::string(" in ") + \
16 std::string(__PRETTY_FUNCTION__)); \
17 } \
18 }
19
20#define LSTEST_ASSERT_VALID_LS(levelSet, NumericType, D) \
21 { \
22 auto check = viennals::Check<NumericType, D>(levelSet); \
23 check.apply(); \
24 if (check.isValid()) { \
25 std::cout << "SUCCESS" << std::endl; \
26 } else { \
27 throw std::runtime_error( \
28 std::string(__FILE__) + std::string(":") + \
29 std::to_string(__LINE__) + std::string(" in ") + \
30 std::string(__PRETTY_FUNCTION__) + "\n" + check.what()); \
31 } \
32 }