<commit_before>﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ExprOpt = Microsoft.FSharp.Core.FSharpOption<AST.Expression>;
using Expr = AST.Expression;

namespace ParcelTest
{
    [TestClass]
    class PrecedenceTests
    {
        [TestMethod]
        public void MultiplicationVsAdditionPrecedenceTest()
        {
            var mwb = MockWorkbook.standardMockWorkbook();
            var e = mwb.envForSheet(1);

            var f = "=2*3+1";

            ExprOpt asto = Parcel.parseFormula(f, e.Path, e.WorkbookName, e.WorksheetName);

            Expr correct =
                Expr.NewBinOpExpr(
                    "+",
                    Expr.NewBinOpExpr(
                        "*",
                        Expr.NewReferenceExpr(new AST.ReferenceConstant(e, 2.0)),
                        Expr.NewReferenceExpr(new AST.ReferenceConstant(e, 3.0))
                    ),
                    Expr.NewReferenceExpr(new AST.ReferenceConstant(e, 1.0))
                );
<commit_msg>Make precedence test public to be discoverable by test runner.<commit_after>﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ExprOpt = Microsoft.FSharp.Core.FSharpOption<AST.Expression>;
using Expr = AST.Expression;

namespace ParcelTest
{
    [TestClass]
    public class PrecedenceTests
    {
        [TestMethod]
        public void MultiplicationVsAdditionPrecedenceTest()
        {
            var mwb = MockWorkbook.standardMockWorkbook();
            var e = mwb.envForSheet(1);

            var f = "=2*3+1";

            ExprOpt asto = Parcel.parseFormula(f, e.Path, e.WorkbookName, e.WorksheetName);

            Expr correct =
                Expr.NewBinOpExpr(
                    "+",
                    Expr.NewBinOpExpr(
                        "*",
                        Expr.NewReferenceExpr(new AST.ReferenceConstant(e, 2.0)),
                        Expr.NewReferenceExpr(new AST.ReferenceConstant(e, 3.0))
                    ),
                    Expr.NewReferenceExpr(new AST.ReferenceConstant(e, 1.0))
                );

{'fraction_non_alphanumeric': 0.09530651340996169, 'fraction_numerical': 0.009578544061302681, 'mean_word_length': 1.7779255319148937, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1335703', 'n_tokens_mistral': 621, 'n_tokens_neox': 559, 'n_words': 104}