<commit_before>// This is an example from Test Driven Development with C++, a cool book
#include <string>

using std::string;

class Primes
{
public:
  bool aIsDivisibleByB(const int a, const int b) const {
    return (a%b==0);
  }

  bool isPrime(const int n) const {
    return true; // STUB
  }

  int nthPrime(const int n) const {
    return -42; // STUB
  }
};

#include "gmock/gmock.h"

TEST(PrimeTesting, FirstFivePrimesAreCorrect) {
  Primes primes;

  ASSERT_THAT(primes.nthPrime(1), testing::Eq(2)); 
  ASSERT_THAT(primes.nthPrime(2), testing::Eq(3)); 
  ASSERT_THAT(primes.nthPrime(3), testing::Eq(5)); 
  ASSERT_THAT(primes.nthPrime(4), testing::Eq(7)); 
  ASSERT_THAT(primes.nthPrime(5), testing::Eq(11)); 

}

TEST(PrimeTesting, SeveralPrimeNumbersArePrime) {
  Primes primes;

  ASSERT_TRUE(primes.isPrime(2));
  ASSERT_TRUE(primes.isPrime(3));
  ASSERT_TRUE(primes.isPrime(5));
  ASSERT_TRUE(primes.isPrime(7));
  ASSERT_TRUE(primes.isPrime(11));
}
<commit_msg>all tests green\!<commit_after>// This is an example from Test Driven Development with C++, a cool book
#include <string>

using std::string;

class Primes
{
public:
  bool aIsDivisibleByB(const int a, const int b) const {
    return (a%b==0);
  }

  bool isPrime(const int n) const {
    // loop from i, starting with n/2 and go down to 2
    // for each of those i's do
    //     check if its divisible.. if so: return false
    //     otherwise: keep going
    // if we get to end of the loop and haven't returned false, return true
    //if(n < 2)
    // return false;

    for(int i = n/2; i >= 2; i--) {
      if(aIsDivisibleByB(n, i))
	return false;
    }
    return true;

  }

  int nthPrime(const int n) const {
    int i = 2;
    int count = 0;

    while(true) {
      if(isPrime(i)) {
	count++;
	if(count == n)
	  return i;
      }
      i++;
    }
  }
};

#include "gmock/gmock.h"

TEST(PrimeTesting, FirstFivePrimesAreCorrect) {
  Primes primes;

  ASSERT_THAT(primes.nthPrime(1), testing::Eq(2)); 
  ASSERT_THAT(primes.nthPrime(2), testing::Eq(3)); 
  ASSERT_THAT(primes.nthPrime(3), testing::Eq(5)); 
  ASSERT_THAT(primes.nthPrime(4), testing::Eq(7)); 
  ASSERT_THAT(primes.nthPrime(5), testing::Eq(11)); 

}

TEST(PrimeTesting, SeveralPrimeNumbersArePrime) {
  Primes primes;

  ASSERT_TRUE(primes.isPrime(2));
  ASSERT_TRUE(primes.isPrime(3));
  ASSERT_TRUE(primes.isPrime(5));
  ASSERT_TRUE(primes.isPrime(7));
  ASSERT_TRUE(primes.isPrime(11));
}

{'fraction_non_alphanumeric': 0.1463614063777596, 'fraction_numerical': 0.01839738348323794, 'mean_word_length': 3.6520912547528517, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7672948', 'n_tokens_mistral': 994, 'n_tokens_neox': 907, 'n_words': 212}