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


using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace NP_DATETIME;

namespace CSS133Assignment1Tests
{
	TEST_CLASS(DateTests)
	{
	public:

		// Constructor tests

		TEST_METHOD(emptyConstructor) {
			Date today;
			Assert::IsTrue(isToday(today));
		}

		TEST_METHOD(InvalidConstructor) {
			Date today(99999, 236236, -236);
			Assert::IsTrue(isToday(today));
		}

		// Minimum tests

		TEST_METHOD(minDateTest) {
			Date date1(0, 0, LOWYEAR);
			Assert::AreEqual(LOWYEAR, date1.getYear());
			Assert::AreEqual((short)0, date1.getMonth());
			Assert::AreEqual((short)0, date1.getDayOfMonth());
		}

		TEST_METHOD(minUnderflowDayDateTest) {
			Date date1(-1, 0, LOWYEAR);
			Assert::AreEqual(LOWYEAR, date1.getYear());
			Assert::AreEqual((short)0, date1.getMonth());
			Assert::AreEqual((short)0, date1.getDayOfMonth());
		}


		// Static tests

		TEST_METHOD(testCountLeapYears) {
			Date date1;
			Assert::AreEqual((short)1, date1.countLeaps(1760));
			Assert::AreEqual((short)2, date1.countLeaps(1764));
			Assert::AreEqual((short)3, date1.countLeaps(1768));<commit_msg>add underflow tests<commit_after>#include "stdafx.h"
#include "CppUnitTest.h"


using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace NP_DATETIME;

namespace CSS133Assignment1Tests
{
	TEST_CLASS(DateTests)
	{
	public:

		// Constructor tests

		TEST_METHOD(emptyConstructor) {
			Date today;
			Assert::IsTrue(isToday(today));
		}

		TEST_METHOD(InvalidConstructor) {
			Date today(99999, 236236, -236);
			Assert::IsTrue(isToday(today));
		}

		// Minimum tests

		TEST_METHOD(minDateTest) {
			Date date1(0, 0, LOWYEAR);
			Assert::AreEqual(LOWYEAR, date1.getYear());
			Assert::AreEqual((short)0, date1.getMonth());
			Assert::AreEqual((short)0, date1.getDayOfMonth());
		}

		TEST_METHOD(minUnderflowDayDateTest) {
			Date date1(-1, 0, LOWYEAR);
			Assert::AreEqual(LOWYEAR, date1.getYear());
			Assert::AreEqual((short)0, date1.getMonth());
			Assert::AreEqual(currentDate(), date1.getDayOfMonth());
		}

		TEST_METHOD(minUnderflowDayMonthTest) {
			Date date1(0, -1, LOWYEAR);
			Assert::AreEqual(LOWYEAR, date1.getYear());
			Assert::AreEqual(currentMonth(), date1.getMonth());
			Assert::AreEqual((short)0, date1.getDayOfMonth());
		}

		TEST_METHOD(minUnderflowDayYearTest) {
			Date date1(0, 0, LOWYEAR - 1);
			Assert::AreEqual(currentYear(), date1.getYear());
			Assert::AreEqual((short)0, date1.getMonth());
			Assert::AreEqual((short)0, date1.getDayOfMonth());
		}


		// Static tests

		TEST_METHOD(testCountLeapYears) {
			Date date1;
			Assert::AreEqual((short)1, date1.countLeaps(1760));
			Assert::AreEqual((short)2, date1.countLeaps(1764));
			Assert::AreEqual((short)3, date1.countLeaps(1768));
{'fraction_non_alphanumeric': 0.1550553769203287, 'fraction_numerical': 0.04322972490175062, 'mean_word_length': 5.466512702078522, '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': '2538648', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1003, 'n_words': 146}