Skip to content

Commit 692b5c8

Browse files
Fix alert boost test cases
1 parent 93b5d4f commit 692b5c8

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

src/omnicore/test/create_payload_tests.cpp

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,19 +381,37 @@ BOOST_AUTO_TEST_CASE(payload_feature_activation)
381381
BOOST_CHECK_EQUAL(HexStr(vch), "fffffffe00010005a550000003e7");
382382
}
383383

384-
/*
385-
BOOST_AUTO_TEST_CASE(payload_omnicore_alert)
384+
BOOST_AUTO_TEST_CASE(payload_omnicore_alert_block)
385+
{
386+
// Omni Core client notification [type 65535, version 65535]
387+
std::vector<unsigned char> vch = CreatePayload_OmniCoreAlert(
388+
static_cast<int32_t>(1), // alert target: by block number
389+
static_cast<uint64_t>(300000), // expiry value: 300000
390+
static_cast<std::string>("test")); // alert message: test
391+
392+
BOOST_CHECK_EQUAL(HexStr(vch), "ffffffff0001000493e07465737400");
393+
}
394+
395+
BOOST_AUTO_TEST_CASE(payload_omnicore_alert_blockexpiry)
396+
{
397+
// Omni Core client notification [type 65535, version 65535]
398+
std::vector<unsigned char> vch = CreatePayload_OmniCoreAlert(
399+
static_cast<int32_t>(2), // alert target: by block time
400+
static_cast<uint64_t>(1439528630), // expiry value: 1439528630
401+
static_cast<std::string>("test")); // alert message: test
402+
403+
BOOST_CHECK_EQUAL(HexStr(vch), "ffffffff000255cd76b67465737400");
404+
}
405+
406+
BOOST_AUTO_TEST_CASE(payload_omnicore_alert_minclient)
386407
{
387408
// Omni Core client notification [type 65535, version 65535]
388409
std::vector<unsigned char> vch = CreatePayload_OmniCoreAlert(
389410
static_cast<int32_t>(3), // alert target: by client version
390411
static_cast<uint64_t>(900100), // expiry value: v0.0.9.1
391-
static_cast<uint16_t>(0), // transaction type: none
392-
static_cast<uint16_t>(0), // transaction version: none
393412
static_cast<std::string>("test")); // alert message: test
394413

395-
BOOST_CHECK_EQUAL(HexStr(vch), "ffffffff333a3930303130303a303a303a7465737400");
414+
BOOST_CHECK_EQUAL(HexStr(vch), "ffffffff0003000dbc047465737400");
396415
}
397-
*/
398416

399417
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)