4#include <gtest/gtest.h>
6#include <protocol_autogen/TestHelpers.h>
8#include <xrpl/protocol/SecretKey.h>
9#include <xrpl/protocol/Seed.h>
10#include <xrpl/protocol/STTx.h>
11#include <xrpl/protocol_autogen/transactions/LoanDelete.h>
12#include <xrpl/protocol_autogen/transactions/AccountSet.h>
20TEST(TransactionsLoanDeleteTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
43 auto tx = builder.build(publicKey, secretKey);
46 EXPECT_TRUE(tx.validate(reason)) << reason;
49 EXPECT_FALSE(tx.getSigningPubKey().empty());
50 EXPECT_TRUE(tx.hasTxnSignature());
53 EXPECT_EQ(tx.getAccount(), accountValue);
54 EXPECT_EQ(tx.getSequence(), sequenceValue);
55 EXPECT_EQ(tx.getFee(), feeValue);
59 auto const& expected = loanIDValue;
60 auto const actual = tx.getLoanID();
69TEST(TransactionsLoanDeleteTests, BuilderFromStTxRoundTrip)
72 auto const [publicKey, secretKey] =
92 auto initialTx = initialBuilder.build(publicKey, secretKey);
97 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
100 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
103 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
104 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
105 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
109 auto const& expected = loanIDValue;
110 auto const actual = rebuiltTx.getLoanID();
118TEST(TransactionsLoanDeleteTests, WrapperThrowsOnWrongTxType)
121 auto const [pk, sk] =
126 auto wrongTx = wrongBuilder.build(pk, sk);
132TEST(TransactionsLoanDeleteTests, BuilderThrowsOnWrongTxType)
135 auto const [pk, sk] =
140 auto wrongTx = wrongBuilder.build(pk, sk);
Builder for AccountSet transactions.
Builder for LoanDelete transactions.
LoanDelete build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the LoanDelete wrapper.
std::shared_ptr< STTx const > getSTTx() const
Get the underlying STTx object.
TEST(TransactionsAccountDeleteTests, BuilderSettersRoundTrip)
Seed generateSeed(std::string const &passPhrase)
Generate a seed deterministically.
std::pair< PublicKey, SecretKey > generateKeyPair(KeyType type, Seed const &seed)
Generate a key pair deterministically.
AmountValue canonical_AMOUNT()
AccountID calcAccountID(PublicKey const &pk)
Uint256Value canonical_UINT256()
void expectEqualField(T const &expected, T const &actual, char const *fieldName)