Added get_aux_slot
This commit is contained in:
@@ -272,7 +272,7 @@ for line in lines:
|
||||
count += 1
|
||||
api = line[29:].strip()
|
||||
if api not in allowedAPIs:
|
||||
print('API call "{}" is not checked for Windows 7 compatibility. Check it and then add it to the list in tests/src/check_imports.py'.format(api))
|
||||
print('API call "{}" is not checked for Windows 7 compatibility. Check it and then add it to the list in tests/src/check_win7.py'.format(api))
|
||||
exit_code = 1
|
||||
|
||||
if exit_code == 0:
|
||||
|
||||
@@ -224,4 +224,23 @@ TEST(merkle, tree)
|
||||
check_full_tree();
|
||||
}
|
||||
|
||||
TEST(merkle, aux_slot)
|
||||
{
|
||||
hash id;
|
||||
|
||||
ASSERT_EQ(get_aux_slot(id, 0, 0), 0U);
|
||||
ASSERT_EQ(get_aux_slot(id, 0, 1), 0U);
|
||||
ASSERT_EQ(get_aux_slot(id, 0, 2), 0U);
|
||||
ASSERT_EQ(get_aux_slot(id, 0, 3), 0U);
|
||||
ASSERT_EQ(get_aux_slot(id, 0, 4), 0U);
|
||||
ASSERT_EQ(get_aux_slot(id, 0, 5), 1U);
|
||||
ASSERT_EQ(get_aux_slot(id, 0, 6), 0U);
|
||||
ASSERT_EQ(get_aux_slot(id, 0, 7), 5U);
|
||||
ASSERT_EQ(get_aux_slot(id, 0, 8), 0U);
|
||||
ASSERT_EQ(get_aux_slot(id, 0, 9), 6U);
|
||||
|
||||
ASSERT_EQ(get_aux_slot(id, 0, std::numeric_limits<uint32_t>::max()), 2389612776U);
|
||||
ASSERT_EQ(get_aux_slot(id, 1, std::numeric_limits<uint32_t>::max()), 1080669337U);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
extern "C" {
|
||||
#include "sha256.h"
|
||||
}
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
@@ -28,7 +25,7 @@ TEST(sha256, hashing)
|
||||
{
|
||||
auto check = [](const char* input, const char* output) {
|
||||
hash h;
|
||||
sha256(input, strlen(input), h.h);
|
||||
sha256(input, static_cast<uint32_t>(strlen(input)), h.h);
|
||||
|
||||
char buf[128];
|
||||
log::Stream s(buf);
|
||||
|
||||
Reference in New Issue
Block a user