xrpld
Loading...
Searching...
No Matches
tests/libxrpl/basics/contract.cpp
1#include <xrpl/basics/contract.h>
2
3#include <gtest/gtest.h>
4
5#include <stdexcept>
6
7using namespace xrpl;
8
9TEST(contract, contract)
10{
11 try
12 {
13 Throw<std::runtime_error>("Throw test");
14 }
15 catch (std::runtime_error const& e1)
16 {
17 EXPECT_STREQ(e1.what(), "Throw test");
18
19 try
20 {
21 rethrow();
22 }
23 catch (std::runtime_error const& e2)
24 {
25 EXPECT_STREQ(e2.what(), "Throw test");
26 }
27 catch (...)
28 {
29 FAIL() << "std::runtime_error should have been re-caught";
30 }
31 }
32 catch (...)
33 {
34 FAIL() << "std::runtime_error should have been caught the first time";
35 }
36}
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
XRPL_NO_SANITIZE_ADDRESS void rethrow()
Rethrow the exception currently being handled.
Definition contract.h:33
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)
Definition contract.h:49
T what(T... args)