rippled
Loading...
Searching...
No Matches
tests/libxrpl/basics/contract.cpp
1#include <xrpl/basics/contract.h>
2
3#include <doctest/doctest.h>
4
5#include <stdexcept>
6#include <string>
7
8using namespace ripple;
9
10TEST_CASE("contract")
11{
12 try
13 {
14 Throw<std::runtime_error>("Throw test");
15 }
16 catch (std::runtime_error const& e1)
17 {
18 CHECK(std::string(e1.what()) == "Throw test");
19
20 try
21 {
22 Rethrow();
23 }
24 catch (std::runtime_error const& e2)
25 {
26 CHECK(std::string(e2.what()) == "Throw test");
27 }
28 catch (...)
29 {
30 CHECK(false);
31 }
32 }
33 catch (...)
34 {
35 CHECK(false);
36 }
37}
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
void Rethrow()
Rethrow the exception currently being handled.
Definition contract.h:29
T what(T... args)