mirror of
https://github.com/Xahau/xahaud.git
synced 2026-07-28 01:20:14 +00:00
Split unit tests to separate files
This commit is contained in:
@@ -307,50 +307,3 @@ std::string SerializedTransaction::getMetaSQL (Serializer rawTxn, uint32 inLedge
|
||||
% getTransactionID ().GetHex () % getTransactionType () % getSourceAccount ().humanAccountID ()
|
||||
% getSequence () % inLedger % status % rTxn % escapedMetaData);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE (SerializedTransactionTS)
|
||||
|
||||
BOOST_AUTO_TEST_CASE ( STrans_test )
|
||||
{
|
||||
RippleAddress seed;
|
||||
seed.setSeedRandom ();
|
||||
RippleAddress generator = RippleAddress::createGeneratorPublic (seed);
|
||||
RippleAddress publicAcct = RippleAddress::createAccountPublic (generator, 1);
|
||||
RippleAddress privateAcct = RippleAddress::createAccountPrivate (generator, seed, 1);
|
||||
|
||||
SerializedTransaction j (ttACCOUNT_SET);
|
||||
j.setSourceAccount (publicAcct);
|
||||
j.setSigningPubKey (publicAcct);
|
||||
j.setFieldVL (sfMessageKey, publicAcct.getAccountPublic ());
|
||||
j.sign (privateAcct);
|
||||
|
||||
if (!j.checkSign ()) BOOST_FAIL ("Transaction fails signature test");
|
||||
|
||||
Serializer rawTxn;
|
||||
j.add (rawTxn);
|
||||
SerializerIterator sit (rawTxn);
|
||||
SerializedTransaction copy (sit);
|
||||
|
||||
if (copy != j)
|
||||
{
|
||||
Log (lsFATAL) << j.getJson (0);
|
||||
Log (lsFATAL) << copy.getJson (0);
|
||||
BOOST_FAIL ("Transaction fails serialize/deserialize test");
|
||||
}
|
||||
|
||||
UPTR_T<STObject> new_obj = STObject::parseJson (j.getJson (0), sfGeneric);
|
||||
|
||||
if (new_obj.get () == NULL) BOOST_FAIL ("Unable to build object from json");
|
||||
|
||||
if (STObject (j) != *new_obj)
|
||||
{
|
||||
Log (lsINFO) << "ORIG: " << j.getJson (0);
|
||||
Log (lsINFO) << "BUILT " << new_obj->getJson (0);
|
||||
BOOST_FAIL ("Built a different transaction");
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END ();
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
Reference in New Issue
Block a user