<commit_before>#include <igloo/igloo_alt.h>
using namespace igloo;

#include <boost/thread.hpp>

#include <TcpServer.h>
#include <TcpClient.h>

Describe(a_tcp_server)
{
	It(can_start_listening_on_a_port)
	{
		TcpServer server;
		server.startListening( 1337 );

		Assert::That(server.isListening(), IsTrue());
	}

	It(can_stop_listening_by_calling_stopListening)
	{
		TcpServer server;
		server.startListening( 1337 );
		server.stopListening();

		Assert::That(server.isListening(), IsFalse());
	}

	It(has_no_connections_if_no_client_connected)
	{
		TcpServer server;

		Assert::That(server.hasNewConnections(), IsFalse());
	}

	It(can_receive_a_connection_from_a_client)
	{
		TcpServer server;
		server.startListening( 1337 );

		TcpClient client;
		client.connectToServer( "localhost", "1337" );
		
		boost::this_thread::sleep(boost::posix_time::millisec(1000));

		Assert::That(server.hasNewConnections(), IsTrue());
	}

	// Dummy test that previously broke the "It can receive a connection
	// from a client" test.
	It(can_lol)
	{
		Assert::That(0, Equals(0));
	}
};<commit_msg>The "Another connection" test works nao! :D<commit_after>#include <igloo/igloo_alt.h>
using namespace igloo;

#include <boost/thread.hpp>

#include <TcpServer.h>
#include <TcpClient.h>

Describe(a_tcp_server)
{
	It(can_start_listening_on_a_port)
	{
		TcpServer server;
		server.startListening( 1337 );

		Assert::That(server.isListening(), IsTrue());
	}

	It(can_stop_listening_by_calling_stopListening)
	{
		TcpServer server;
		server.startListening( 1337 );
		server.stopListening();

		Assert::That(server.isListening(), IsFalse());
	}

	It(has_no_connections_if_no_client_connected)
	{
		TcpServer server;

		Assert::That(server.hasNewConnections(), IsFalse());
	}

	It(can_receive_a_connection_from_a_client)
	{
		TcpServer server;
		server.startListening( 1337 );

		TcpClient client;
		client.connectToServer( "localhost", "1337" );
		
		boost::this_thread::sleep(boost::posix_time::millisec(1000));

		Assert::That(server.hasNewConnections(), IsTrue());
	}

	It(can_receive_another_connection_from_a_client)
	{
		TcpServer server;
		server.startListening( 1337 );

		TcpClient client;
		client.connectToServer( "localhost", "1337" );
		
		boost::this_thread::sleep(boost::posix_time::millisec(1000));

		Assert::That(server.hasNewConnections(), IsTrue());
	}

	// Dummy test that previously broke the "It can receive a connection
	// from a client" test.
	It(can_lol)
	{
		Assert::That(0, Equals(0));
	}
};
{'fraction_non_alphanumeric': 0.13822115384615385, 'fraction_numerical': 0.022435897435897436, 'mean_word_length': 5.64095744680851, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1876028', 'n_tokens_mistral': 1033, 'n_tokens_neox': 917, 'n_words': 145}