mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-23 17:36:37 +02:00
Base64/32 tests for #229.
This commit is contained in:
parent
c612d21639
commit
7d38b1a9b9
1 changed files with 28 additions and 0 deletions
|
@ -47,6 +47,20 @@ BOOST_AUTO_TEST_CASE(Base64Decode)
|
||||||
BOOST_CHECK_EQUAL(size, 25);
|
BOOST_CHECK_EQUAL(size, 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(Base64EncodeBufferTooSmall)
|
||||||
|
{
|
||||||
|
const uint8_t input[] = {0x53, 0xd3};
|
||||||
|
char result[3];
|
||||||
|
BOOST_CHECK_EQUAL(ByteStreamToBase64(input, 2, result, 3), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(Base64DecodeBufferTooSmall)
|
||||||
|
{
|
||||||
|
const char* input = "U9M=";
|
||||||
|
uint8_t result[1];
|
||||||
|
BOOST_CHECK_EQUAL(Base64ToByteStream(input, 4, result, 1), 0);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(Base32EncodeEmpty)
|
BOOST_AUTO_TEST_CASE(Base32EncodeEmpty)
|
||||||
{
|
{
|
||||||
BOOST_CHECK_EQUAL(ByteStreamToBase32(nullptr, 0, nullptr, 0), 0);
|
BOOST_CHECK_EQUAL(ByteStreamToBase32(nullptr, 0, nullptr, 0), 0);
|
||||||
|
@ -86,4 +100,18 @@ BOOST_AUTO_TEST_CASE(Base32Decode)
|
||||||
BOOST_CHECK_EQUAL(size, 25);
|
BOOST_CHECK_EQUAL(size, 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(Base32EncodeBufferTooSmall)
|
||||||
|
{
|
||||||
|
const uint8_t input[] = {0x53, 0xd3};
|
||||||
|
char result[3];
|
||||||
|
BOOST_CHECK_EQUAL(ByteStreamToBase64(input, 2, result, 3), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(Base32DecodeBufferTooSmall)
|
||||||
|
{
|
||||||
|
const char* input = "kpjq";
|
||||||
|
uint8_t result[1];
|
||||||
|
BOOST_CHECK_EQUAL(Base64ToByteStream(input, 4, result, 1), 0);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
Loading…
Add table
Reference in a new issue