Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Pierre Kim
manateecoin
Commits
62366f21
Commit
62366f21
authored
Nov 20, 2017
by
Pierre Kim
Browse files
fix test build
parent
64ae583e
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/TestGenerator/TestGenerator.cpp
View file @
62366f21
...
...
@@ -61,7 +61,7 @@ void test_generator::addBlock(const CryptoNote::Block& blk, size_t tsxSize, uint
const
size_t
blockSize
=
tsxSize
+
getObjectBinarySize
(
blk
.
baseTransaction
);
int64_t
emissionChange
;
uint64_t
blockReward
;
m_currency
.
getBlockReward
(
Common
::
medianValue
(
blockSizes
),
blockSize
,
alreadyGeneratedCoins
,
fee
,
m_currency
.
getBlockReward
(
100000
,
Common
::
medianValue
(
blockSizes
),
blockSize
,
alreadyGeneratedCoins
,
fee
,
blockReward
,
emissionChange
);
m_blocksInfo
[
get_block_hash
(
blk
)]
=
BlockInfo
(
blk
.
previousBlockHash
,
alreadyGeneratedCoins
+
emissionChange
,
blockSize
);
}
...
...
@@ -262,7 +262,7 @@ bool constructMinerTxManually(const CryptoNote::Currency& currency, uint32_t hei
// This will work, until size of constructed block is less then currency.blockGrantedFullRewardZone()
int64_t
emissionChange
;
uint64_t
blockReward
;
if
(
!
currency
.
getBlockReward
(
0
,
0
,
alreadyGeneratedCoins
,
fee
,
blockReward
,
emissionChange
))
{
if
(
!
currency
.
getBlockReward
(
100000
,
0
,
0
,
alreadyGeneratedCoins
,
fee
,
blockReward
,
emissionChange
))
{
std
::
cerr
<<
"Block is too big"
<<
std
::
endl
;
return
false
;
}
...
...
tests/UnitTests/BlockReward.cpp
View file @
62366f21
...
...
@@ -39,7 +39,7 @@ namespace
};
#define TEST_ALREADY_GENERATED_COINS(alreadyGeneratedCoins, expectedReward) \
m_blockTooBig = !m_currency.getBlockReward(0, currentBlockSize, alreadyGeneratedCoins, 0, \
m_blockTooBig = !m_currency.getBlockReward(
100000,
0, currentBlockSize, alreadyGeneratedCoins, 0, \
m_blockReward, m_emissionChange); \
ASSERT_FALSE(m_blockTooBig); \
ASSERT_EQ(UINT64_C(expectedReward), m_blockReward); \
...
...
@@ -81,14 +81,14 @@ namespace
static
const
uint64_t
alreadyGeneratedCoins
=
0
;
virtual
void
SetUp
()
override
{
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
0
,
0
,
alreadyGeneratedCoins
,
0
,
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
100000
,
0
,
0
,
alreadyGeneratedCoins
,
0
,
m_standardBlockReward
,
m_emissionChange
);
ASSERT_FALSE
(
m_blockTooBig
);
ASSERT_EQ
(
UINT64_C
(
70368744177663
),
m_standardBlockReward
);
}
void
do_test
(
size_t
medianBlockSize
,
size_t
currentBlockSize
)
{
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
medianBlockSize
,
currentBlockSize
,
alreadyGeneratedCoins
,
0
,
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
100000
,
medianBlockSize
,
currentBlockSize
,
alreadyGeneratedCoins
,
0
,
m_blockReward
,
m_emissionChange
);
}
...
...
@@ -178,7 +178,7 @@ namespace
static
const
uint64_t
alreadyGeneratedCoins
=
0
;
virtual
void
SetUp
()
override
{
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
testMedian
,
0
,
alreadyGeneratedCoins
,
0
,
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
100000
,
testMedian
,
0
,
alreadyGeneratedCoins
,
0
,
m_standardBlockReward
,
m_emissionChange
);
ASSERT_FALSE
(
m_blockTooBig
);
...
...
@@ -186,7 +186,7 @@ namespace
}
void
do_test
(
size_t
currentBlockSize
)
{
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
testMedian
,
currentBlockSize
,
alreadyGeneratedCoins
,
0
,
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
100000
,
testMedian
,
currentBlockSize
,
alreadyGeneratedCoins
,
0
,
m_blockReward
,
m_emissionChange
);
}
...
...
@@ -284,7 +284,7 @@ namespace
uint64_t
blockReward
;
int64_t
emissionChange
;
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
testMedian
,
testBlockSize
,
0
,
0
,
blockReward
,
emissionChange
);
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
100000
,
testMedian
,
testBlockSize
,
0
,
0
,
blockReward
,
emissionChange
);
ASSERT_FALSE
(
m_blockTooBig
);
ASSERT_EQ
(
expectedBlockReward
,
blockReward
);
...
...
@@ -292,7 +292,7 @@ namespace
}
void
do_test
(
uint64_t
alreadyGeneratedCoins
,
uint64_t
fee
)
{
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
testMedian
,
testBlockSize
,
alreadyGeneratedCoins
,
fee
,
m_blockTooBig
=
!
m_currency
.
getBlockReward
(
100000
,
testMedian
,
testBlockSize
,
alreadyGeneratedCoins
,
fee
,
m_blockReward
,
m_emissionChange
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment