Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mariano54 authored and AmineKhaldi committed Sep 8, 2021
1 parent a5f420c commit 280cbe9
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/test.cpp
Expand Up @@ -468,13 +468,9 @@ TEST_CASE("Error handling")
SECTION("Should throw on a bad public key")
{
vector<uint8_t> buf(G1Element::SIZE, 0);
// This are all the "first byte values" which are tested to be valid G1 elements if the remaining bytes are zero.
std::vector<uint8_t> vecValid{0x85, 0x86, 0x87, 0x88, 0x89, 0x8C, 0x8F, 0x91, 0x93, 0x94, 0x96, 0x98, 0x99, 0x9A,
0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAC, 0xAF, 0xB1, 0xB3, 0xB4, 0xB6, 0xB8, 0xB9, 0xBA,
0xC0};
for (int i = 0; i < 0xFF; i++) {
buf[0] = (uint8_t)i;
if (std::find(vecValid.begin(), vecValid.end(), i) != vecValid.end()) {
if (i == 0xc0) { // Infinity prefix shouldn't throw here as we have only zero values
REQUIRE_NOTHROW(G1Element::FromByteVector(buf));
} else {
REQUIRE_THROWS(G1Element::FromByteVector(buf));
Expand All @@ -485,7 +481,6 @@ TEST_CASE("Error handling")
SECTION("Should throw on a bad G2Element")
{
vector<uint8_t> buf(G2Element::SIZE, 0);

for (int i = 0; i < 0xFF; i++) {
buf[0] = (uint8_t)i;
if (i == 0xc0) { // Infinity prefix shouldn't throw here as we have only zero values
Expand Down

0 comments on commit 280cbe9

Please sign in to comment.