Skip to content

Commit

Permalink
Test for key_from_hex_chars (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmwilson committed May 13, 2022
1 parent eeb7d72 commit f5856d7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@

using namespace std::literals::string_literals;

TEST_CASE("Test key_from_hex_chars", "[output]")
{
REQUIRE(key_from_hex_chars(""s) == std::vector<std::uint8_t> {});
REQUIRE(key_from_hex_chars("hello"s) == std::nullopt);
REQUIRE(key_from_hex_chars("12z"s) == std::nullopt);
REQUIRE(key_from_hex_chars("0xabcd"s) == std::nullopt);
REQUIRE(key_from_hex_chars("ab cd"s) == std::nullopt);
REQUIRE(key_from_hex_chars("a"s) == std::vector<std::uint8_t> {0x0a});
REQUIRE(key_from_hex_chars("0123456789abcdef"s) ==
std::vector<std::uint8_t> {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef});
REQUIRE(key_from_hex_chars("0123456789ABCDEF"s) ==
std::vector<std::uint8_t> {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef});
}

/**
* Compare the output of stenc given device responses
*
Expand Down

0 comments on commit f5856d7

Please sign in to comment.