Files
rippled/src/test/jtx/impl/quality2.cpp
Bart 1d42c4f6de refactor: Remove unnecessary copyright notices already covered by LICENSE.md (#5929)
Per XLS-0095, we are taking steps to rename ripple(d) to xrpl(d).

This change specifically removes all copyright notices referencing Ripple, XRPLF, and certain affiliated contributors upon mutual agreement, so the notice in the LICENSE.md file applies throughout. Copyright notices referencing external contributions remain as-is. Duplicate verbiage is also removed.
2025-11-04 08:33:42 +00:00

55 lines
1.1 KiB
C++

#include <test/jtx/quality.h>
#include <xrpl/protocol/Quality.h>
#include <xrpl/protocol/SField.h>
namespace ripple {
namespace test {
namespace jtx {
qualityInPercent::qualityInPercent(double percent)
: qIn_(static_cast<std::uint32_t>((percent / 100) * QUALITY_ONE))
{
assert(percent <= 400 && percent >= 0);
}
qualityOutPercent::qualityOutPercent(double percent)
: qOut_(static_cast<std::uint32_t>((percent / 100) * QUALITY_ONE))
{
assert(percent <= 400 && percent >= 0);
}
static void
insertQualityIntoJtx(SField const& field, std::uint32_t value, JTx& jt)
{
jt.jv[field.jsonName] = value;
}
void
qualityIn::operator()(Env&, JTx& jt) const
{
insertQualityIntoJtx(sfQualityIn, qIn_, jt);
}
void
qualityInPercent::operator()(Env&, JTx& jt) const
{
insertQualityIntoJtx(sfQualityIn, qIn_, jt);
}
void
qualityOut::operator()(Env&, JTx& jt) const
{
insertQualityIntoJtx(sfQualityOut, qOut_, jt);
}
void
qualityOutPercent::operator()(Env&, JTx& jt) const
{
insertQualityIntoJtx(sfQualityOut, qOut_, jt);
}
} // namespace jtx
} // namespace test
} // namespace ripple