// =====================================================================================================================
//  fennec, a free and open source game engine
//  Copyright © 2025 - 2026  Medusa Slockbower
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU 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 General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================

#ifndef FENNEC_TEST_MATH_EXPONENTIAL_H
#define FENNEC_TEST_MATH_EXPONENTIAL_H

#include "../../test.h"

#include <fennec/math/exponential.h>
#include <fennec/math/ext/constants.h>

namespace fennec::test
{

	inline void fennec_test_math_exponential()
	{
		fennec_test_run(fennec::pow(1.0f, 2.0f), 1.0f);
		fennec_test_run(fennec::pow(2.0f, 0.0f), 1.0f);
		fennec_test_run(fennec::pow(2.0f, 1.0f), 2.0f);
		fennec_test_run(fennec::pow(2.0f, 2.0f), 4.0f);

		fennec_test_spacer(1);

		fennec_test_run(fennec::exp(-1.0f), fennec::one_over_e<float>());
		fennec_test_run(fennec::exp( 0.0f), 1.0f);
		fennec_test_run(fennec::exp( 1.0f), fennec::e<float>());
		fennec_test_run(fennec::exp( 2.0f), fennec::e_sq<float>());

		fennec_test_spacer(1);

		fennec_test_run(fennec::exp2(-1.0f), 0.5f);
		fennec_test_run(fennec::exp2( 0.0f), 1.0f);
		fennec_test_run(fennec::exp2( 1.0f), 2.0f);
		fennec_test_run(fennec::exp2( 2.0f), 4.0f);

		fennec_test_spacer(1);

		fennec_test_run(fennec::log(fennec::one_over_e<float>()), -1.0f);
		fennec_test_run(fennec::log(1.0f),                         0.0f);
		fennec_test_run(fennec::log(fennec::e<float>()),           1.0f);
		fennec_test_run(fennec::log(fennec::e_sq<float>()),        2.0f);

		fennec_test_spacer(1);

		fennec_test_run(fennec::log2(1.0f), 0.0f);
		fennec_test_run(fennec::log2(2.0f), 1.0f);
		fennec_test_run(fennec::log2(4.0f), 2.0f);

		fennec_test_spacer(1);

		fennec_test_run(fennec::sqrt(1.0f), 1.0f);
		fennec_test_run(fennec::sqrt(4.0f), 2.0f);
		fennec_test_run(fennec::sqrt(9.0f), 3.0f);

		fennec_test_spacer(1);

		fennec_test_run(fennec::inversesqrt(1.0f), 1.0f / 1.0f);
		fennec_test_run(fennec::inversesqrt(4.0f), 1.0f / 2.0f);
		fennec_test_run(fennec::inversesqrt(9.0f), 1.0f / 3.0f);
	}

}

#endif // FENNEC_TEST_MATH_EXPONENTIAL_H
