rippled
Loading...
Searching...
No Matches
quality2.cpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2016 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 <test/jtx/quality.h>
21
22#include <xrpl/protocol/Quality.h>
23#include <xrpl/protocol/SField.h>
24
25namespace ripple {
26namespace test {
27namespace jtx {
28
30 : qIn_(static_cast<std::uint32_t>((percent / 100) * QUALITY_ONE))
31{
32 assert(percent <= 400 && percent >= 0);
33}
34
36 : qOut_(static_cast<std::uint32_t>((percent / 100) * QUALITY_ONE))
37{
38 assert(percent <= 400 && percent >= 0);
39}
40
41static void
43{
44 jt.jv[field.jsonName] = value;
45}
46
47void
49{
50 insertQualityIntoJtx(sfQualityIn, qIn_, jt);
51}
52
53void
55{
56 insertQualityIntoJtx(sfQualityIn, qIn_, jt);
57}
58
59void
61{
62 insertQualityIntoJtx(sfQualityOut, qOut_, jt);
63}
64
65void
67{
68 insertQualityIntoJtx(sfQualityOut, qOut_, jt);
69}
70
71} // namespace jtx
72} // namespace test
73} // namespace ripple
Identifies fields.
Definition: SField.h:143
A transaction testing environment.
Definition: Env.h:121
void operator()(Env &, JTx &jtx) const
Definition: quality2.cpp:54
void operator()(Env &, JTx &jtx) const
Definition: quality2.cpp:48
void operator()(Env &, JTx &jtx) const
Definition: quality2.cpp:66
void operator()(Env &, JTx &jtx) const
Definition: quality2.cpp:60
static void insertQualityIntoJtx(SField const &field, std::uint32_t value, JTx &jt)
Definition: quality2.cpp:42
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
STL namespace.
Execution context for applying a JSON transaction.
Definition: JTx.h:45
Json::Value jv
Definition: JTx.h:46