mirror of
https://github.com/eosswedenorg/libantelope
synced 2026-06-20 17:58:18 +02:00
tests/base58/encode.cpp: add subcase and fix test structs.
This commit is contained in:
parent
3336f8d051
commit
000f45e1f4
1 changed files with 23 additions and 15 deletions
|
|
@ -3,24 +3,32 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <doctest.h>
|
#include <doctest.h>
|
||||||
|
|
||||||
typedef std::pair<std::string, std::string> testpair_t;
|
|
||||||
typedef std::vector<testpair_t> tests;
|
|
||||||
|
|
||||||
TEST_CASE("base58::base58_encode") {
|
TEST_CASE("base58::base58_encode") {
|
||||||
|
|
||||||
tests input = {
|
struct testcase {
|
||||||
testpair_t("",""),
|
const char* name;
|
||||||
testpair_t(
|
std::string in;
|
||||||
"Quisque ut ipsum lorem. Nullam ac justo elit. Sed gravida convallis mattis.",
|
std::string expected;
|
||||||
"2nPTv2DT874jRaYBN4uhM9mT2iRiwdJuCXuX5buUHyyvWUSu6cX62i8HYo8PsWqgs9DHbwhpSpV5SVUnCqyLcpxcuGanH68eXgzZTGq"
|
|
||||||
),
|
|
||||||
testpair_t(
|
|
||||||
"Cras fringilla, eros et imperdiet tincidunt",
|
|
||||||
"5yAgp6rBagDHQZ3GacZSeaEPF2jfuwVHM21aNfXETJgn3EkArxc5UWSq1RM"
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for(tests::const_iterator it = input.begin(); it != input.end(); it++) {
|
std::vector<struct testcase> tests = {
|
||||||
CHECK( libeosio::base58_encode(it->first) == it->second );
|
{"empty","",""},
|
||||||
|
{
|
||||||
|
"first",
|
||||||
|
"Quisque ut ipsum lorem. Nullam ac justo elit. Sed gravida convallis mattis.",
|
||||||
|
"2nPTv2DT874jRaYBN4uhM9mT2iRiwdJuCXuX5buUHyyvWUSu6cX62i8HYo8PsWqgs9DHbwhpSpV5SVUnCqyLcpxcuGanH68eXgzZTGq"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"second",
|
||||||
|
"Cras fringilla, eros et imperdiet tincidunt",
|
||||||
|
"5yAgp6rBagDHQZ3GacZSeaEPF2jfuwVHM21aNfXETJgn3EkArxc5UWSq1RM"
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||||
|
|
||||||
|
SUBCASE(it->name) {
|
||||||
|
CHECK( libeosio::base58_encode(it->in) == it->expected );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue