<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpressionToCodeLib;
using ValueUtils;
using Xunit;

namespace ValueUtilsTest {
    public class FieldwiseEqualityTest {

        static readonly Func<SampleStruct, SampleStruct, bool> eq = FieldwiseEquality<SampleStruct>.Instance;

        [Fact]
        public void IdenticalValuesAreEqual() {
            PAssert.That(() =>
                eq(new SampleStruct(1, 2, "3", 4), new SampleStruct(1, 2, "3", 4)));
        }


        [Fact]
        public void OneChangedMemberCausesInequality() {
            PAssert.That(() =>
                !eq(new SampleStruct(1, 2, "3", 4), new SampleStruct(11, 2, "3", 4)));<commit_msg>Add test for null equality, but disable it - I don't see the need to support nulls<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpressionToCodeLib;
using ValueUtils;
using Xunit;

namespace ValueUtilsTest {
    public class FieldwiseEqualityTest {

        static readonly Func<SampleStruct, SampleStruct, bool> eq = FieldwiseEquality<SampleStruct>.Instance;

        [Fact]
        public void IdenticalValuesAreEqual() {
            PAssert.That(() =>
                eq(new SampleStruct(1, 2, "3", 4), new SampleStruct(1, 2, "3", 4)));
        }

        [Fact(Skip = "Don't support nulls")]
        public void CanCheckEqualityWithNull() {
            PAssert.That(() =>
                !FieldwiseEquality.AreEqual(Tuple.Create(1), null));
        }


        [Fact]
        public void OneChangedMemberCausesInequality() {
            PAssert.That(() =>
                !eq(new SampleStruct(1, 2, "3", 4), new SampleStruct(11, 2, "3", 4)));
{'fraction_non_alphanumeric': 0.11833333333333333, 'fraction_numerical': 0.019444444444444445, 'mean_word_length': 2.898268398268398, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, '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': '5885954', 'n_tokens_mistral': 542, 'n_tokens_neox': 516, 'n_words': 140}