/*******************************************************************************
***  This file is part of Dux Rei Nummariae.                                 ***
***                                                                          ***
***  Copyright (C) 2017, 2018, 2019, 2020, 2021                              ***
***  John Schneiderman <Licensing _AT_ Schneiderman _DOT_ me>                ***
***                                                                          ***
***  This program is free software: you can redistribute it and/or modify it ***
***  under the terms of the GNU Affero General Public License as published   ***
***  by the Free Software Foundation, either version 3 of the License, or    ***
***  (at your option) any later version.                                     ***
***                                                                          ***
***  This program is distributed in the hope that it will be useful, but     ***
***  WITHOUT ANY WARRANTY; without even the implied warranty of              ***
***  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                    ***
***  See the GNU Affero General Public License for more details.             ***
***                                                                          ***
***  You should have received a copy of the GNU Affero General Public License***
***  along with this program. If not, see <http://www.gnu.org/licenses/>.    ***
*******************************************************************************/
#include <pecunia/Codes.h>
using pecunia::currency::Iso4217Codes;
#include <pecunia/Money.h>
using pecunia::currency::Money;
#include <QString>
using ::QString;
#include <QTest>
// using QTEST_MAIN.

#include <map>
using std::map;

#include <budgeting/BudgetSource.h>
using drn::budgeting::BudgetSource;
#include <budgeting/EventFrequency.h>
using drn::budgeting::EventFrequency;
#include <budgeting/Goal.h>
using drn::budgeting::Goal;
#include <budgeting/GoalMap.h>
using drn::budgeting::GoalMap;


namespace drn
{
namespace budgeting
{
namespace tests
{

struct GoalMapUT : QObject
{
	Q_OBJECT

private slots:
	// Constructor Tests

	void constructor_Empty_ShouldBeDefaults()
	{
		const GoalMap bills{};
		QVERIFY2(bills.empty() == true, "By default there should not be any values.");
	}
	void constructor_FullInit_ShouldBeSupplied()
	{
		const map<BudgetSource, Goal> values{
			{
				BudgetSource{QStringLiteral("Computer")},
				Goal{
					BudgetSource{QStringLiteral("Computer")},
					Money{50, 3400u, Iso4217Codes::USD},
					EventFrequency::Weekly,
					{9999, 6, 20},
					Money{5000, 3400u, Iso4217Codes::USD}
				}
			},
			{
				BudgetSource{QStringLiteral("Vacation")},
				Goal{
					BudgetSource{QStringLiteral("Vacation")},
					Money{75, 4400u, Iso4217Codes::USD},
					EventFrequency::Weekly,
					{9999, 6, 20},
					Money{7500, 4400u, Iso4217Codes::USD}
				}
			}
		};
		const GoalMap goals{values};
		QCOMPARE(
			goals.at(BudgetSource{QStringLiteral("Computer")}),
			values.at(BudgetSource{QStringLiteral("Computer")})
		);
		QCOMPARE(
			goals.at(BudgetSource{QStringLiteral("Vacation")}),
			values.at(BudgetSource{QStringLiteral("Vacation")})
		);
	}

	//}
};

}}}

QTEST_MAIN(drn::budgeting::tests::GoalMapUT)
#include "GoalMap-unit-tests.moc"
