Files
rippled/src/test/rpc/LedgerClosed_test.cpp
seelabs e8d02c1333 Refactor FeatureBitset:
* Remove composite helper functions
* Add set difference and Bitset/uint256 operators
* Convert tests to use new feature bitset set difference operator
2017-12-01 14:15:05 -05:00

65 lines
2.4 KiB
C++

//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2016 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include <ripple/protocol/JsonFields.h>
#include <ripple/protocol/Feature.h>
#include <test/jtx.h>
namespace ripple {
class LedgerClosed_test : public beast::unit_test::suite
{
public:
void testMonitorRoot()
{
using namespace test::jtx;
Env env {*this, FeatureBitset{}};
Account const alice {"alice"};
env.fund(XRP(10000), alice);
auto lc_result = env.rpc("ledger_closed") [jss::result];
BEAST_EXPECT(lc_result[jss::ledger_hash] == "8AEDBB96643962F1D40F01E25632ABB3C56C9F04B0231EE4B18248B90173D189");
BEAST_EXPECT(lc_result[jss::ledger_index] == 2);
env.close();
auto const ar_master = env.le(env.master);
BEAST_EXPECT(ar_master->getAccountID(sfAccount) == env.master.id());
BEAST_EXPECT((*ar_master)[sfBalance] == drops( 99999989999999980 ));
auto const ar_alice = env.le(alice);
BEAST_EXPECT(ar_alice->getAccountID(sfAccount) == alice.id());
BEAST_EXPECT((*ar_alice)[sfBalance] == XRP( 10000 ));
lc_result = env.rpc("ledger_closed") [jss::result];
BEAST_EXPECT(lc_result[jss::ledger_hash] == "7C3EEDB3124D92E49E75D81A8826A2E65A75FD71FC3FD6F36FEB803C5F1D812D");
BEAST_EXPECT(lc_result[jss::ledger_index] == 3);
}
void run()
{
testMonitorRoot();
}
};
BEAST_DEFINE_TESTSUITE(LedgerClosed,app,ripple);
}