rippled
Loading...
Searching...
No Matches
ApiVersion_test.cpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/XRPLF/rippled/
4 Copyright (c) 2023 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#include <xrpl/beast/unit_test.h>
21#include <xrpl/beast/unit_test/suite.h>
22#include <xrpl/protocol/ApiVersion.h>
23
24#include <array>
25#include <cstdint>
26#include <limits>
27#include <optional>
28#include <type_traits>
29#include <utility>
30
31namespace ripple {
32namespace test {
34{
35 void
36 run() override
37 {
38 {
39 testcase("API versions invariants");
40
41 static_assert(
44 static_assert(
46 static_assert(
49
50 BEAST_EXPECT(true);
51 }
52
53 {
54 // Update when we change versions
55 testcase("API versions");
56
57 static_assert(RPC::apiMinimumSupportedVersion >= 1);
58 static_assert(RPC::apiMinimumSupportedVersion < 2);
59 static_assert(RPC::apiMaximumSupportedVersion >= 2);
60 static_assert(RPC::apiMaximumSupportedVersion < 3);
61 static_assert(RPC::apiMaximumValidVersion >= 3);
62 static_assert(RPC::apiMaximumValidVersion < 4);
63 static_assert(RPC::apiBetaVersion >= 3);
64 static_assert(RPC::apiBetaVersion < 4);
65
66 BEAST_EXPECT(true);
67 }
68 }
69};
70
71BEAST_DEFINE_TESTSUITE(ApiVersion, protocol, ripple);
72
73} // namespace test
74} // namespace ripple
A testsuite class.
Definition suite.h:55
testcase_t testcase
Memberspace for declaring test cases.
Definition suite.h:155
static constexpr auto apiMaximumSupportedVersion
Definition ApiVersion.h:57
static constexpr auto apiMaximumValidVersion
Definition ApiVersion.h:62
static constexpr auto apiBetaVersion
Definition ApiVersion.h:61
static constexpr auto apiMinimumSupportedVersion
Definition ApiVersion.h:56
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
void run() override
Runs the suite.