<commit_before>﻿namespace OffByOne.Ql.Tests.Evaluator
{
    public class DecimalValueTests
    {
    }
}<commit_msg>Added basic decimal test<commit_after>﻿namespace OffByOne.Ql.Tests.Evaluator
{
    using System;
    using System.Collections.Generic;

    using OffByOne.Ql.Ast.Expressions;
    using OffByOne.Ql.Ast.Expressions.Binary;
    using OffByOne.Ql.Ast.Expressions.Unary;
    using OffByOne.Ql.Ast.Literals;
    using OffByOne.Ql.Evaluator;
    using OffByOne.Ql.Values;
    using OffByOne.Ql.Values.Contracts;

    using Xunit;

    public class DecimalValueTests
    {
        public static IEnumerable<object[]> SimpleDecimalExpressionData => new List<object[]>
        {
            new object[]
            {
                new AddExpression(new DecimalLiteral(4), new DecimalLiteral(4)),
                typeof(DecimalValue),
                new DecimalValue(8),
            },
            new object[]
            {
                new AddExpression(new DecimalLiteral(4), new NegativeExpression(new DecimalLiteral(4))),
                typeof(DecimalValue),
                new DecimalValue(0)
            },
            new object[]
            {
                new AddExpression(new NegativeExpression(new DecimalLiteral(4)), new DecimalLiteral(4)),
                typeof(DecimalValue),
                new DecimalValue(0)
            }
        };

        [Theory]
        [MemberData(nameof(SimpleDecimalExpressionData))]
        public void Evaluate_ShoudlReturnExpectedValueFromExpression(
            Expression expression,
            Type expectedResultType,
            IValue expected)
        {
            var evaluator = new Evaluator();
            var environment = new TypeEnvironment();
            var result = evaluator.Evaluate(expression, environment);
            Assert.IsType(expectedResultType, result);
            Assert.NotNull(result);
            Assert.Equal(expected, result);
        }
    }
}
{'fraction_non_alphanumeric': 0.08624229979466119, 'fraction_numerical': 0.004620123203285421, 'mean_word_length': 2.021705426356589, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '2887035', 'n_tokens_mistral': 534, 'n_tokens_neox': 511, 'n_words': 99}