WPILibC++
2027.0.0-alpha-2
Loading...
Searching...
No Matches
assert.hpp
Go to the documentation of this file.
1
// Copyright (c) Sleipnir contributors
2
3
#pragma once
4
5
#ifdef JORMUNGANDR
6
#include <format>
7
#include <source_location>
8
#include <stdexcept>
9
/**
10
* Throw an exception in Python.
11
*/
12
#define slp_assert(condition) \
13
do { \
14
if (!(condition)) { \
15
auto location = std::source_location::current(); \
16
throw std::invalid_argument(std::format( \
17
"{}:{}: {}: Assertion `{}' failed.", location.file_name(), \
18
location.line(), location.function_name(), #condition)); \
19
} \
20
} while (0);
21
#else
22
#include <cassert>
23
/**
24
* Abort in C++.
25
*/
26
#define slp_assert(condition) assert(condition)
27
#endif
thirdparty
sleipnir
include
sleipnir
util
assert.hpp
Generated on Wed Jul 23 2025 00:48:18 for WPILibC++ by
1.12.0