rippled
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 <ripple/protocol/Quality.h>
21 #include <ripple/protocol/SField.h>
22 #include <test/jtx/quality.h>
23 
24 namespace ripple {
25 namespace test {
26 namespace jtx {
27 
29  : qIn_(static_cast<std::uint32_t>((percent / 100) * QUALITY_ONE))
30 {
31  assert(percent <= 400 && percent >= 0);
32 }
33 
35  : qOut_(static_cast<std::uint32_t>((percent / 100) * QUALITY_ONE))
36 {
37  assert(percent <= 400 && percent >= 0);
38 }
39 
40 static void
41 insertQualityIntoJtx(SField const& field, std::uint32_t value, JTx& jt)
42 {
43  jt.jv[field.jsonName] = value;
44 }
45 
46 void
48 {
50 }
51 
52 void
54 {
56 }
57 
58 void
60 {
62 }
63 
64 void
66 {
68 }
69 
70 } // namespace jtx
71 } // namespace test
72 } // namespace ripple
ripple::test::jtx::insertQualityIntoJtx
static void insertQualityIntoJtx(SField const &field, std::uint32_t value, JTx &jt)
Definition: quality2.cpp:41
ripple::test::jtx::qualityOutPercent::qOut_
std::uint32_t qOut_
Definition: quality.h:76
ripple::sfQualityOut
const SF_UINT32 sfQualityOut
ripple::sfQualityIn
const SF_UINT32 sfQualityIn
ripple::test::jtx::qualityInPercent::qualityInPercent
qualityInPercent(double percent)
Definition: quality2.cpp:28
ripple::test::jtx::qualityInPercent::operator()
void operator()(Env &, JTx &jtx) const
Definition: quality2.cpp:53
ripple::test::jtx::JTx
Execution context for applying a JSON transaction.
Definition: JTx.h:42
ripple::test::jtx::JTx::jv
Json::Value jv
Definition: JTx.h:44
ripple::test::jtx::qualityIn::operator()
void operator()(Env &, JTx &jtx) const
Definition: quality2.cpp:47
ripple::test::jtx::qualityIn::qIn_
std::uint32_t qIn_
Definition: quality.h:33
std::uint32_t
ripple::test::jtx::qualityOutPercent::operator()
void operator()(Env &, JTx &jtx) const
Definition: quality2.cpp:65
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::test::jtx::qualityOut::operator()
void operator()(Env &, JTx &jtx) const
Definition: quality2.cpp:59
ripple::SField
Identifies fields.
Definition: SField.h:112
std
STL namespace.
ripple::test::jtx::qualityOut::qOut_
std::uint32_t qOut_
Definition: quality.h:61
ripple::test::jtx::qualityOutPercent::qualityOutPercent
qualityOutPercent(double percent)
Definition: quality2.cpp:34
ripple::test::jtx::qualityInPercent::qIn_
std::uint32_t qIn_
Definition: quality.h:48
ripple::test::jtx::Env
A transaction testing environment.
Definition: Env.h:116