WPILibC++ 2025.3.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 <stdexcept>
8/**
9 * Throw an exception in Python.
10 */
11#define Assert(condition) \
12 do { \
13 if (!(condition)) { \
14 throw std::invalid_argument( \
15 std::format("{}:{}: {}: Assertion `{}' failed.", __FILE__, __LINE__, \
16 __func__, #condition)); \
17 } \
18 } while (0);
19#else
20#include <cassert>
21/**
22 * Abort in C++.
23 */
24#define Assert(condition) assert(condition)
25#endif