<commit_before>
#include "stdafx.h"
#include "CppUnitTest.h"

#include "internal/task_builder.h"
#include "internal/task_serializer.h"

#include "common.h"

using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert;

namespace UnitTests {

using boost::posix_time::ptime;
using boost::posix_time::time_duration;
using boost::gregorian::date;
using boost::gregorian::greg_month;

using Task = You::QueryEngine::Task;
using TaskBuilder = You::QueryEngine::Internal::TaskBuilder;
using TaskSerializer = You::QueryEngine::Internal::TaskSerializer;

TEST_CLASS(TaskBuilderTest) {
public:
	static Task getMockTask() {
		Task::Description desc = L"Learn Haskell Lens";
		Task::Time dead = ptime(date(2002, 1, 10),
			time_duration(1, 2, 3));
		Task::Dependencies dep = { 1, 2, 3 };
		Task::Priority prio = Task::Priority::IMPORTANT;
		return TaskBuilder::get().description(desc).deadline(dead).
			priority(prio).dependencies(dep);
	}

	/// Should be able to serialize a complex task.
	TEST_METHOD(serializeTask) {
		Task task = getMockTask();
		auto serialized = TaskSerializer::serialize(task);
		Assert::AreEqual(serialized[TaskSerializer::KEY_DESCRIPTION],
			task.getDescription());
		Assert::AreEqual(serialized[TaskSerializer::KEY_PRIORITY],
			std::wstring(L"important"));
		Assert::AreEqual(serialized[TaskSerializer::KEY_DEPENDENCIES],
			std::wstring(L"1;2;3;"));
		Assert::AreEqual(serialized[TaskSerializer::KEY_DEADLINE],
			std::wstring(L"2002;1;10;1;2;3;"));
	}

	/// Should be able to deserialize a complex task.
	TEST_METHOD(deserializeTask) {
		Task task = getMockTask();
		auto serialized = TaskSerializer::serialize(task);
		auto deserialized = TaskSerializer::deserialize(serialized);
		Assert::IsTrue(deserialized.isStrictEqual(task));
	}
};
}  // namespace UnitTests<commit_msg>Move TaskSerializerTest to its own namespace<commit_after>
#include "stdafx.h"
#include "CppUnitTest.h"

#include "internal/task_builder.h"
#include "internal/task_serializer.h"

#include "common.h"

using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert;

namespace You {
namespace QueryEngine {
namespace UnitTests {

using boost::posix_time::ptime;
using boost::posix_time::time_duration;
using boost::gregorian::date;
using boost::gregorian::greg_month;

using Task = You::QueryEngine::Task;
using TaskBuilder = You::QueryEngine::Internal::TaskBuilder;
using TaskSerializer = You::QueryEngine::Internal::TaskSerializer;

TEST_CLASS(TaskBuilderTest) {
public:
	static Task getMockTask() {
		Task::Description desc = L"Learn Haskell Lens";
		Task::Time dead = ptime(date(2002, 1, 10),
			time_duration(1, 2, 3));
		Task::Dependencies dep = { 1, 2, 3 };
		Task::Priority prio = Task::Priority::IMPORTANT;
		return TaskBuilder::get().description(desc).deadline(dead).
			priority(prio).dependencies(dep);
	}

	/// Should be able to serialize a complex task.
	TEST_METHOD(serializeTask) {
		Task task = getMockTask();
		auto serialized = TaskSerializer::serialize(task);
		Assert::AreEqual(serialized[TaskSerializer::KEY_DESCRIPTION],
			task.getDescription());
		Assert::AreEqual(serialized[TaskSerializer::KEY_PRIORITY],
			std::wstring(L"important"));
		Assert::AreEqual(serialized[TaskSerializer::KEY_DEPENDENCIES],
			std::wstring(L"1;2;3;"));
		Assert::AreEqual(serialized[TaskSerializer::KEY_DEADLINE],
			std::wstring(L"2002;1;10;1;2;3;"));
	}

	/// Should be able to deserialize a complex task.
	TEST_METHOD(deserializeTask) {
		Task task = getMockTask();
		auto serialized = TaskSerializer::serialize(task);
		auto deserialized = TaskSerializer::deserialize(serialized);
		Assert::IsTrue(deserialized.isStrictEqual(task));
	}
};
}  // namespace UnitTests
}  // namespace QueryEngine
}  // namespace You
{'fraction_non_alphanumeric': 0.1431251675154114, 'fraction_numerical': 0.013937282229965157, 'mean_word_length': 6.940425531914894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3099151', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1179, 'n_words': 224}