diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-11-05 01:45:06 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-11-05 01:45:06 +0100 |
commit | 2a8202e74846d191a321cca1202175af9db6107d (patch) | |
tree | a6f455caf07da1186851f343a237a4c4e4484f46 /tests/test_base64.cpp | |
parent | 8efa0ec17d8c262f9c3fd7603e8074f74a053708 (diff) |
Diffstat (limited to 'tests/test_base64.cpp')
-rw-r--r-- | tests/test_base64.cpp | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/tests/test_base64.cpp b/tests/test_base64.cpp deleted file mode 100644 index 6f80acf..0000000 --- a/tests/test_base64.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "olm/base64.hh" -#include "olm/base64.h" -#include "unittest.hh" - -int main() { - -{ /* Base64 encode test */ -TestCase test_case("Base64 C++ binding encode test"); - -std::uint8_t input[] = "Hello World"; -std::uint8_t expected_output[] = "SGVsbG8gV29ybGQ"; -std::size_t input_length = sizeof(input) - 1; - -std::size_t output_length = olm::encode_base64_length(input_length); -assert_equals(std::size_t(15), output_length); - -std::uint8_t output[15]; -olm::encode_base64(input, input_length, output); -assert_equals(expected_output, output, output_length); -} - -{ -TestCase test_case("Base64 C binding encode test"); - -std::uint8_t input[] = "Hello World"; -std::uint8_t expected_output[] = "SGVsbG8gV29ybGQ"; -std::size_t input_length = sizeof(input) - 1; - -std::size_t output_length = ::_olm_encode_base64_length(input_length); -assert_equals(std::size_t(15), output_length); - -std::uint8_t output[15]; -output_length = ::_olm_encode_base64(input, input_length, output); -assert_equals(std::size_t(15), output_length); -assert_equals(expected_output, output, output_length); -} - -{ /* Base64 decode test */ -TestCase test_case("Base64 C++ binding decode test"); - -std::uint8_t input[] = "SGVsbG8gV29ybGQ"; -std::uint8_t expected_output[] = "Hello World"; -std::size_t input_length = sizeof(input) - 1; - -std::size_t output_length = olm::decode_base64_length(input_length); -assert_equals(std::size_t(11), output_length); - -std::uint8_t output[11]; -olm::decode_base64(input, input_length, output); -assert_equals(expected_output, output, output_length); -} - -{ -TestCase test_case("Base64 C binding decode test"); - -std::uint8_t input[] = "SGVsbG8gV29ybGQ"; -std::uint8_t expected_output[] = "Hello World"; -std::size_t input_length = sizeof(input) - 1; - -std::size_t output_length = ::_olm_decode_base64_length(input_length); -assert_equals(std::size_t(11), output_length); - -std::uint8_t output[11]; -output_length = ::_olm_decode_base64(input, input_length, output); -assert_equals(std::size_t(11), output_length); -assert_equals(expected_output, output, output_length); -} - - -} |