Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Jan 8, 2024
1 parent e9995b7 commit e014329
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/Li.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ int main()
}
}

{
uint64_t x = std::numeric_limits<uint64_t>::max() / 10;
uint64_t res = Li_inverse(x);
if (res != std::numeric_limits<uint64_t>::max())
{
std::cout << "Li_inverse(" << x << ") != UINT64_MAX, failed to prevent integer overflow!" << std::endl;
std::exit(1);
}
}

std::cout << std::endl;
std::cout << "All tests passed successfully!" << std::endl;

Expand Down
10 changes: 10 additions & 0 deletions test/Ri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ int main()
}
}

{
uint64_t x = std::numeric_limits<uint64_t>::max() / 10;
uint64_t res = Ri_inverse(x);
if (res != std::numeric_limits<uint64_t>::max())
{
std::cout << "Ri_inverse(" << x << ") != UINT64_MAX, failed to prevent integer overflow!" << std::endl;
std::exit(1);
}
}

std::cout << std::endl;
std::cout << "All tests passed successfully!" << std::endl;

Expand Down

0 comments on commit e014329

Please sign in to comment.