rippled
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#include <string>
7
8using namespace xrpl;
9
10TEST(contract, contract)
11{
12 try
13 {
14 Throw<std::runtime_error>("Throw test");
15 }
16 catch (std::runtime_error const& e1)
17 {
18 EXPECT_STREQ(e1.what(), "Throw test");
19
20 try
21 {
22 Rethrow();
23 }
24 catch (std::runtime_error const& e2)
25 {
26 EXPECT_STREQ(e2.what(), "Throw test");
27 }
28 catch (...)
29 {
30 FAIL() << "std::runtime_error should have been re-caught";
31 }
32 }
33 catch (...)
34 {
35 FAIL() << "std::runtime_error should have been caught the first time";
36 }
37}
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
void Rethrow()
Rethrow the exception currently being handled.
Definition contract.h:28
T what(T... args)