#include "barretenberg/common/bb_bench.hpp"
#include "barretenberg/common/compiler_hints.hpp"
#include "barretenberg/common/throw_or_abort.hpp"
#include <cstdint>
#include <regex>
#include <sstream>
#include "barretenberg/common/log.hpp"
#include <cassert>
#include <cstdlib>
#include <iostream>
#include <string>
Go to the source code of this file.
|
| namespace | bb |
| | Entry point for Barretenberg command-line interface.
|
| |
|
| #define | BB_BENCH_ASSERT(x) |
| |
| #define | BB_DISABLE_ASSERTS() bb::AssertGuard __bb_assert_guard(bb::AssertMode::WARN) |
| |
| #define | DONT_EVALUATE(expression) |
| |
| #define | BB_ASSERT_DEBUG(expression, ...) BB_ASSERT(expression, __VA_ARGS__) |
| |
| #define | BB_ASSERT(expression, ...) |
| |
| #define | BB_ASSERT_EQ(actual, expected, ...) |
| |
| #define | BB_ASSERT_NEQ(actual, expected, ...) |
| |
| #define | BB_ASSERT_GT(left, right, ...) |
| |
| #define | BB_ASSERT_GTE(left, right, ...) |
| |
| #define | BB_ASSERT_LT(left, right, ...) |
| |
| #define | BB_ASSERT_LTE(left, right, ...) |
| |
| #define | ASSERT_THROW_OR_ABORT(statement, matcher) ASSERT_THROW(statement, std::runtime_error) |
| |
| #define | EXPECT_THROW_OR_ABORT(statement, matcher) EXPECT_THROW(statement, std::runtime_error) |
| |
| #define | EXPECT_THROW_WITH_MESSAGE(code, expectedMessageRegex) |
| |
◆ ASSERT_THROW_OR_ABORT
| #define ASSERT_THROW_OR_ABORT |
( |
|
statement, |
|
|
|
matcher |
|
) |
| ASSERT_THROW(statement, std::runtime_error) |
◆ BB_ASSERT
| #define BB_ASSERT |
( |
|
expression, |
|
|
|
... |
|
) |
| |
Value: do { \
BB_BENCH_ASSERT("BB_ASSERT" #expression); \
std::ostringstream oss; \
oss << "Assertion failed: (" #expression ")"; \
__VA_OPT__(oss << "\nReason : " << __VA_ARGS__;) \
bb::assert_failure(oss.str()); \
} \
} while (0)
Definition at line 80 of file assert.hpp.
◆ BB_ASSERT_DEBUG
| #define BB_ASSERT_DEBUG |
( |
|
expression, |
|
|
|
... |
|
) |
| BB_ASSERT(expression, __VA_ARGS__) |
◆ BB_ASSERT_EQ
| #define BB_ASSERT_EQ |
( |
|
actual, |
|
|
|
expected, |
|
|
|
... |
|
) |
| |
Value: do { \
BB_BENCH_ASSERT("BB_ASSERT_EQ" #actual " == " #expected); \
const auto& _actual = (actual); \
const auto& _expected = (expected); \
std::ostringstream oss; \
oss << "Assertion failed: (" #actual " == " #expected ")\n"; \
oss << " Actual : " << _actual << "\n"; \
oss << " Expected: " << _expected; \
__VA_OPT__(oss << "\n Reason : " << __VA_ARGS__;) \
} \
} while (0)
void assert_failure(std::string const &err)
- Examples
- /opt/build/repo/barretenberg/cpp/src/barretenberg/common/zip_view.hpp.
Definition at line 93 of file assert.hpp.
◆ BB_ASSERT_GT
| #define BB_ASSERT_GT |
( |
|
left, |
|
|
|
right, |
|
|
|
... |
|
) |
| |
Value: do { \
BB_BENCH_ASSERT("BB_ASSERT_GT" #left " > " #right); \
const auto& _left = (left); \
const auto& _right = (right); \
std::ostringstream oss; \
oss << "Assertion failed: (" #left " > " #right ")\n"; \
oss << " Left : " << _left << "\n"; \
oss << " Right : " << _right; \
__VA_OPT__(oss << "\n Reason : " << __VA_ARGS__;) \
} \
} while (0)
Definition at line 123 of file assert.hpp.
◆ BB_ASSERT_GTE
| #define BB_ASSERT_GTE |
( |
|
left, |
|
|
|
right, |
|
|
|
... |
|
) |
| |
Value: do { \
BB_BENCH_ASSERT("BB_ASSERT_GTE" #left " >= " #right); \
const auto& _left = (left); \
const auto& _right = (right); \
std::ostringstream oss; \
oss << "Assertion failed: (" #left " >= " #right ")\n"; \
oss << " Left : " << _left << "\n"; \
oss << " Right : " << _right; \
__VA_OPT__(oss << "\n Reason : " << __VA_ARGS__;) \
} \
} while (0)
Definition at line 138 of file assert.hpp.
◆ BB_ASSERT_LT
| #define BB_ASSERT_LT |
( |
|
left, |
|
|
|
right, |
|
|
|
... |
|
) |
| |
Value: do { \
BB_BENCH_ASSERT("BB_ASSERT_LT" #left " < " #right); \
const auto& _left = (left); \
const auto& _right = (right); \
std::ostringstream oss; \
oss << "Assertion failed: (" #left " < " #right ")\n"; \
oss << " Left : " << _left << "\n"; \
oss << " Right : " << _right; \
__VA_OPT__(oss << "\n Reason : " << __VA_ARGS__;) \
} \
} while (0)
Definition at line 153 of file assert.hpp.
◆ BB_ASSERT_LTE
| #define BB_ASSERT_LTE |
( |
|
left, |
|
|
|
right, |
|
|
|
... |
|
) |
| |
Value: do { \
BB_BENCH_ASSERT("BB_ASSERT_LTE" #left " <= " #right); \
const auto& _left = (left); \
const auto& _right = (right); \
std::ostringstream oss; \
oss << "Assertion failed: (" #left " <= " #right ")\n"; \
oss << " Left : " << _left << "\n"; \
oss << " Right : " << _right; \
__VA_OPT__(oss << "\n Reason : " << __VA_ARGS__;) \
} \
} while (0)
Definition at line 168 of file assert.hpp.
◆ BB_ASSERT_NEQ
| #define BB_ASSERT_NEQ |
( |
|
actual, |
|
|
|
expected, |
|
|
|
... |
|
) |
| |
Value: do { \
BB_BENCH_ASSERT("BB_ASSERT_NEQ" #actual " != " #expected); \
const auto& _actual = (actual); \
const auto& _expected = (expected); \
std::ostringstream oss; \
oss << "Assertion failed: (" #actual " != " #expected ")\n"; \
oss << " Actual : " << _actual << "\n"; \
oss << " Not expected: " << _expected; \
__VA_OPT__(oss << "\n Reason : " << __VA_ARGS__;) \
} \
} while (0)
Definition at line 108 of file assert.hpp.
◆ BB_BENCH_ASSERT
| #define BB_BENCH_ASSERT |
( |
|
x | ) |
|
◆ BB_DISABLE_ASSERTS
◆ DONT_EVALUATE
| #define DONT_EVALUATE |
( |
|
expression | ) |
|
Value: { \
true ? static_cast<void>(0) : static_cast<void>((expression)); \
}
Definition at line 37 of file assert.hpp.
◆ EXPECT_THROW_OR_ABORT
| #define EXPECT_THROW_OR_ABORT |
( |
|
statement, |
|
|
|
matcher |
|
) |
| EXPECT_THROW(statement, std::runtime_error) |
◆ EXPECT_THROW_WITH_MESSAGE
| #define EXPECT_THROW_WITH_MESSAGE |
( |
|
code, |
|
|
|
expectedMessageRegex |
|
) |
| |
Value: try { \
code; \
FAIL() << "Expected exception with message matching: " << expectedMessageRegex; \
} catch (const std::exception& e) { \
<< "Exception message: " << e.what() << "\nExpected to match regex: " << expectedMessageRegex; \
}
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition at line 192 of file assert.hpp.