olm/tests/test_olm_sha256.cpp
Hubert Chathi 8475061136 switch to doctest for unit testing
thanks to Nico Werner, who did most of the porting work
2021-12-22 13:45:33 -05:00

19 lines
489 B
C++

#include "olm/olm.h"
#include "testing.hh"
#include <vector>
TEST_CASE("Olm sha256 test") {
std::vector<std::uint8_t> utility_buffer(::olm_utility_size());
::OlmUtility * utility = ::olm_utility(utility_buffer.data());
CHECK_EQ(std::size_t(43), ::olm_sha256_length(utility));
std::uint8_t output[43];
::olm_sha256(utility, "Hello, World", 12, output, 43);
std::uint8_t expected_output[] = "A2daxT/5zRU1zMffzfosRYxSGDcfQY3BNvLRmsH76KU";
CHECK_EQ_SIZE(output, expected_output, 43);
}