Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

//

// Created by alex.zed on 2020/12/16.


//

#include <gtest/gtest.h>

#include "libpool/difficulty/DiffController.h"
#include "libpool/bitcoin/arith_uint256.h"

TEST(DiffController, Normal) {
DiffController diff_controller_{};
ASSERT_EQ(diff_controller_.getCurrentIndex(), 18);
ASSERT_EQ(diff_controller_.getCurrentDifficulty(), 262144);
ASSERT_EQ(diff_controller_.getCurrentBits(), 440401856);
ASSERT_EQ(diff_controller_.getCurrentTarget(),
arith_uint256("0000000000003fffc00000000000000000000000000000000000000000000000"));

uint32_t job_bits;
ASSERT_EQ(diff_controller_.getBitsByIndex(&job_bits, 18), true);
ASSERT_EQ(job_bits, 440401856);
uint64_t job_diff;
ASSERT_EQ(diff_controller_.getDifficultyByIndex(&job_diff, 18), true);
ASSERT_EQ(job_diff, 262144);
arith_uint256 target;
ASSERT_EQ(diff_controller_.getTargetByIndex(&target, 18), true);
ASSERT_EQ(target,
arith_uint256("0000000000003fffc00000000000000000000000000000000000000000000000"));
}

You might also like