CI: added more tests

This commit is contained in:
SChernykh
2025-06-22 21:58:57 +02:00
parent e69f5722df
commit e5d487aa50
6 changed files with 37 additions and 1 deletions

View File

@@ -236,6 +236,7 @@ TEST(block_template, submit_sidechain_block)
ASSERT_EQ(sidechain.difficulty(), 219467);
ASSERT_EQ(sidechain.blocksById().size(), 4487);
ASSERT_TRUE(sidechain.precalcFinished());
const PoolBlock* tip = sidechain.chainTip();

View File

@@ -28,6 +28,7 @@ using namespace p2pool;
int main(int argc, char** argv)
{
set_main_thread();
p2pool_usage();
PoolBlock::s_precalculatedSharesLock = new ReadWriteLock();

View File

@@ -168,6 +168,17 @@ TEST(merkle, tree)
}
};
// 0 leaves
uint32_t path_monero;
ASSERT_FALSE(tree_path(0, 0, &path_monero));
merkle_hash(std::vector<hash>(), root);
ASSERT_TRUE(root.empty());
std::vector<std::vector<hash>> tree;
merkle_hash_full_tree(std::vector<hash>(), tree);
ASSERT_TRUE(tree.empty());
// 1 leaf
merkle_hash(hashes, root);
ASSERT_EQ(root, input[0]);

View File

@@ -80,6 +80,16 @@ TEST(util, varint)
// Invalid value 2
uint8_t buf2[1] = { 0x80 };
ASSERT_EQ(readVarint(buf2, buf2 + 1, check), nullptr);
// Invalid value 3
uint8_t buf3[16];
memset(buf3, 128, sizeof(buf3));
ASSERT_EQ(readVarint(buf3, buf3 + sizeof(buf3), check), nullptr);
// Invalid value 4
uint32_t check2;
uint8_t buf4[] = {255, 255, 255, 255, 127};
ASSERT_EQ(readVarint(buf4, buf4 + sizeof(buf4), check2), nullptr);
}
TEST(util, bsr)