<commit_before>﻿using System;
using System.Linq;
using System.Threading.Tasks;
using Cosmos.TestRunner;
using Cosmos.Compiler.Tests.Bcl.Helper;

namespace Cosmos.Compiler.Tests.Bcl.System
{
    class MathTest
    {
        public static void Execute()
        {
            double result;

            // Test with small number
            result = Math.Sqrt(16);
            Assert.IsTrue(EqualityHelper.DoublesAreEqual(result, 4), "Sqrt does not produce accurate result with small input");

            // Test with large number
            result = Math.Sqrt(2432146.513);
            Assert.IsTrue(EqualityHelper.DoublesAreEqual(result, 1559.53406920143), "Sqrt does not produce accurate result with large input");

            // Test with zero
            result = Math.Sqrt(0);
            Assert.IsTrue((result == 0), "Sqrt of zero must be zero");

            // Test with negative number
            result = Math.Sqrt(-433);
            Assert.IsTrue(double.IsNaN(result), "Sqrt of negative must return NaN");

            // Test with NaN
            result = Math.Sqrt(double.NaN);
            Assert.IsTrue(double.IsNaN(result), "Sqrt of NaN must return NaN");

            // Test with positive infinity
            result = Math.Sqrt(double.PositiveInfinity);
            Assert.IsTrue(double.IsPositiveInfinity(result), "Sqrt of PositiveInfinity must return PositiveInfinity");<commit_msg>Added tests for Math.Exp and Math.Pow<commit_after>﻿using System;
using System.Linq;
using System.Threading.Tasks;
using Cosmos.TestRunner;
using Cosmos.Compiler.Tests.Bcl.Helper;

namespace Cosmos.Compiler.Tests.Bcl.System
{
    internal class MathTest
    {
        public static void Execute()
        {
            double result;

            // Test with small number
            result = Math.Sqrt(16);
            Assert.IsTrue(EqualityHelper.DoublesAreEqual(result, 4), "Sqrt does not produce accurate result with small input");

            // Test with large number
            result = Math.Sqrt(2432146.513);
            Assert.IsTrue(EqualityHelper.DoublesAreEqual(result, 1559.53406920143), "Sqrt does not produce accurate result with large input");

            // Test with zero
            result = Math.Sqrt(0);
            Assert.IsTrue((result == 0), "Sqrt of zero must be zero");

            // Test with negative number
            result = Math.Sqrt(-433);
            Assert.IsTrue(double.IsNaN(result), "Sqrt of negative must return NaN");

            // Test with NaN
            result = Math.Sqrt(double.NaN);
            Assert.IsTrue(double.IsNaN(result), "Sqrt of NaN must return NaN");

            // Test with positive infinity
            result = Math.Sqrt(double.PositiveInfinity);
            Assert.IsTrue(double.IsPositiveInfinity(result), "Sqrt of PositiveInfinity must return PositiveInfinity");

            #region Math.Exp

            //Test with integer
            result = Math.Exp(2);
            Assert.IsTrue((result == 7.38905609893065), "e^2 is equal to 7.38905609893065");

            //Test with double exponent
            result = Math.Exp(1.5);
            Assert.IsTrue(EqualityHelper.DoublesAreEqual(result, 4.48168907033806), "e^1.5 returns correct result");

            #endregion Math.Exp

            #region Math.Pow

            //Test with integer power
            result = Math.Pow(2, 2);
            Assert.IsTrue(EqualityHelper.DoublesAreEqual(result, 4), "2^2 gives accurate result");

            //Test with decimal power
            result = Math.Pow(9, 0.5);
            Assert.IsTrue(EqualityHelper.DoublesAreEqual(result, Math.Sqrt(9)), "9^0.5 gives same answer as sqrt(9)");

            //Test with negative base
            result = Math.Pow(-2, 2);
            Assert.IsTrue(EqualityHelper.DoublesAreEqual(result, 4), "Math.Pow gives correct result when raising negative number to even power");

            result = Math.Pow(-2, 3);
            Assert.IsTrue(EqualityHelper.DoublesAreEqual(result, -8), "Math.Pow gives correct result when raising negative number to odd power");

            //Test with negative power
            result = Math.Pow(2, -1);
            Assert.IsTrue(EqualityHelper.DoublesAreEqual(result, 0.5), "Pow gives correct results when handling negative powers");

            #endregion Math.Pow
{'fraction_non_alphanumeric': 0.10106629578117757, 'fraction_numerical': 0.03245248029670839, 'mean_word_length': 2.244360902255639, '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': '7385246', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1162, 'n_words': 328}