aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-07-24 13:57:06 -0500
committerluigi1111 <luigi1111w@gmail.com>2019-07-24 13:57:06 -0500
commite3de4aa68bedf7a7adfaf53cc2c132a74dc7fb08 (patch)
tree134d499069659c6bbbfd372d32d45a93ea718184 /tests
parentMerge pull request #5473 (diff)
parentremove unused code (diff)
downloadmonero-e3de4aa68bedf7a7adfaf53cc2c132a74dc7fb08.tar.xz
Merge pull request #5502
25a7cfd add a few checks where it seems appropriate (moneromooo-monero) 1a66a86 remove unused code (moneromooo-monero)
Diffstat (limited to 'tests')
-rw-r--r--tests/core_tests/chaingen.cpp1
-rw-r--r--tests/core_tests/wallet_tools.cpp1
-rw-r--r--tests/unit_tests/test_protocol_pack.cpp1
-rw-r--r--tests/unit_tests/varint.cpp1
4 files changed, 3 insertions, 1 deletions
diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp
index 614585349..8dde1f475 100644
--- a/tests/core_tests/chaingen.cpp
+++ b/tests/core_tests/chaingen.cpp
@@ -546,6 +546,7 @@ void block_tracker::global_indices(const cryptonote::transaction *tx, std::vecto
void block_tracker::get_fake_outs(size_t num_outs, uint64_t amount, uint64_t global_index, uint64_t cur_height, std::vector<get_outs_entry> &outs){
auto & vct = m_outs[amount];
const size_t n_outs = vct.size();
+ CHECK_AND_ASSERT_THROW_MES(n_outs > 0, "n_outs is 0");
std::set<size_t> used;
std::vector<size_t> choices;
diff --git a/tests/core_tests/wallet_tools.cpp b/tests/core_tests/wallet_tools.cpp
index d9cee34c1..21a9455c0 100644
--- a/tests/core_tests/wallet_tools.cpp
+++ b/tests/core_tests/wallet_tools.cpp
@@ -163,6 +163,7 @@ bool wallet_tools::fill_tx_sources(tools::wallet2 * wallet, std::vector<cryptono
void wallet_tools::gen_tx_src(size_t mixin, uint64_t cur_height, const tools::wallet2::transfer_details & td, cryptonote::tx_source_entry & src, block_tracker &bt)
{
+ CHECK_AND_ASSERT_THROW_MES(mixin != 0, "mixin is zero");
src.amount = td.amount();
src.rct = td.is_rct();
diff --git a/tests/unit_tests/test_protocol_pack.cpp b/tests/unit_tests/test_protocol_pack.cpp
index 7329c0d23..0ae2e9c68 100644
--- a/tests/unit_tests/test_protocol_pack.cpp
+++ b/tests/unit_tests/test_protocol_pack.cpp
@@ -48,6 +48,7 @@ TEST(protocol_pack, protocol_pack_command)
cryptonote::NOTIFY_RESPONSE_CHAIN_ENTRY::request r2;
res = epee::serialization::load_t_from_binary(r2, buff);
+ ASSERT_TRUE(res);
ASSERT_TRUE(r.m_block_ids.size() == i);
ASSERT_TRUE(r.start_height == 1);
ASSERT_TRUE(r.total_height == 3);
diff --git a/tests/unit_tests/varint.cpp b/tests/unit_tests/varint.cpp
index ca0900682..72691d722 100644
--- a/tests/unit_tests/varint.cpp
+++ b/tests/unit_tests/varint.cpp
@@ -56,7 +56,6 @@ TEST(varint, equal)
ASSERT_TRUE (bytes > 0 && bytes <= sizeof(buf));
uint64_t idx2;
- bufptr = buf;
std::string s(buf, bytes);
int read = tools::read_varint(s.begin(), s.end(), idx2);
ASSERT_EQ (read, bytes);