Skip to content

Commit

Permalink
Add coverage of spans allowing user requested data amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Jan 15, 2025
1 parent a082b7e commit e553f9e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test_shake256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,21 @@ void test_class()
hasher.finalize();
const auto array_return4 {hasher.get_digest(small_container_span)};
BOOST_TEST(array_return4 == boost::crypt::state::success);

// And the range interfaces
hasher.init();
hasher.process_bytes(bad_update_msg);
BOOST_TEST(hasher.get_digest(small_container, 10U) == boost::crypt::state::state_error);
hasher.finalize();
BOOST_TEST(hasher.get_digest(small_container, 10U) == boost::crypt::state::insufficient_output_length);
BOOST_TEST(hasher.get_digest(small_container, 5U) == boost::crypt::state::success);

hasher.init();
hasher.process_bytes(bad_update_msg);
BOOST_TEST(hasher.get_digest(small_container_span, 10U) == boost::crypt::state::state_error);
hasher.finalize();
BOOST_TEST(hasher.get_digest(small_container_span, 10U) == boost::crypt::state::insufficient_output_length);
BOOST_TEST(hasher.get_digest(small_container_span, 5U) == boost::crypt::state::success);
}

void test_user_container()
Expand Down

0 comments on commit e553f9e

Please sign in to comment.