<commit_before>#include <threadPool/threadPool.h>
#include <gtest/gtest.h>

using namespace threadPool;

TEST(TestThreadPool, SimpleQueue) {
	std::atomic_int ct(0);

	ThreadPool<int> threadPool;
	threadPool.spawnThread([&ct](int) { ++ct; sleep(1); }, 5);

	for (int i(0); i<10; ++i) {
		threadPool.queue(0);
	}
	threadPool.wait();

	EXPECT_EQ(ct, 10);
}
TEST(TestThreadPool, SimpleQueue2) {
	for (int j(0); j<100; ++j) {
		std::atomic_int ct(0);
		ThreadPool<int> threadPool;
		threadPool.spawnThread([&ct](int) { ++ct; }, 5);

		for (int i(0); i<10; ++i) {
			threadPool.queue(0);
		}
		threadPool.wait();

		EXPECT_EQ(ct, 10);
	}
}

TEST(TestThreadPool, RecursiveQueue) {
	std::atomic_int ct(0);

	ThreadPool<int> threadPool;
	threadPool.spawnThread([&ct, &threadPool](int _ct) {
		++ct; sleep(1);
		if (_ct > 0)
			threadPool.queue(_ct-1);
	}, 5);

	for (int i(0); i<10; ++i) {
		threadPool.queue(1);
	}
	threadPool.wait();

	EXPECT_EQ(ct, 20);
}

TEST(TestThreadPool, RecursiveQueue2) {
	for (int j(0); j<100; ++j) {

		std::atomic_int ct(0);
		ThreadPool<int> threadPool;
		threadPool.spawnThread([&ct, &threadPool](int _ct) {
			++ct;
			if (_ct > 0)
				threadPool.queue(_ct-1);
		}, 5);
<commit_msg>removing sleeps for faster unit testing<commit_after>#include <threadPool/threadPool.h>
#include <gtest/gtest.h>

using namespace threadPool;

TEST(TestThreadPool, SimpleQueue) {
	std::atomic_int ct(0);

	ThreadPool<int> threadPool;
	threadPool.spawnThread([&ct](int) { ++ct; }, 5);

	for (int i(0); i<10; ++i) {
		threadPool.queue(0);
	}
	threadPool.wait();

	EXPECT_EQ(ct, 10);
}
TEST(TestThreadPool, SimpleQueue2) {
	for (int j(0); j<100; ++j) {
		std::atomic_int ct(0);
		ThreadPool<int> threadPool;
		threadPool.spawnThread([&ct](int) { ++ct; }, 5);

		for (int i(0); i<10; ++i) {
			threadPool.queue(0);
		}
		threadPool.wait();

		EXPECT_EQ(ct, 10);
	}
}

TEST(TestThreadPool, RecursiveQueue) {
	std::atomic_int ct(0);

	ThreadPool<int> threadPool;
	threadPool.spawnThread([&ct, &threadPool](int _ct) {
		++ct;
		if (_ct > 0)
			threadPool.queue(_ct-1);
	}, 5);

	for (int i(0); i<10; ++i) {
		threadPool.queue(1);
	}
	threadPool.wait();

	EXPECT_EQ(ct, 20);
}

TEST(TestThreadPool, RecursiveQueue2) {
	for (int j(0); j<100; ++j) {

		std::atomic_int ct(0);
		ThreadPool<int> threadPool;
		threadPool.spawnThread([&ct, &threadPool](int _ct) {
			++ct;
			if (_ct > 0)
				threadPool.queue(_ct-1);
		}, 5);

{'fraction_non_alphanumeric': 0.19669421487603306, 'fraction_numerical': 0.033884297520661154, 'mean_word_length': 4.578341013824885, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6630678', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1019, 'n_words': 191}