Skip to content

Instantly share code, notes, and snippets.

@mentix02
Last active May 23, 2020 22:29
Show Gist options
  • Save mentix02/6f0f366f3b881d42756ca31514702242 to your computer and use it in GitHub Desktop.
Save mentix02/6f0f366f3b881d42756ca31514702242 to your computer and use it in GitHub Desktop.
A test file for primelib.cpp
#include "shipyard.hpp"
#include "primelib.cpp"
void test_is_prime()
{
sy::AssertTrue(is_prime(5), "is_prime(5) == true");
sy::AssertFalse(is_prime(12), "is_prime(12) == false");
}
void test_n_prime()
{
sy::Assert(n_prime(10), uint32_t(29));
sy::Assert(n_prime(100), uint32_t(541));
}
void test_primes_till()
{
const auto primes = primes_till(10);
sy::Assert(primes, {2, 3, 5, 7, 11, 13, 17, 19, 23, 29});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment