SVN / public / code / vorlesung-01 / PrimeTest.cpp

Revision 154
Date2026-04-21T15:58:54+02:00
Committerhb1003
Download
// Copyright 2026, University of Freiburg
// Chair of Algorithms and Data Structures
// Author: Hannah Bast <bast@cs.uni-freiburg.de>

#include <gtest/gtest.h>

#include "./Prime.cpp"

// Test that the `isPrime` function does what it should via a few test cases.
TEST(PrimeTest, isPrime) {
  ASSERT_EQ(isPrime(1), 1);
  ASSERT_EQ(isPrime(42), 2);
  ASSERT_EQ(isPrime(314159), 0);
}

int main(int argc, char **argv) {
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}