<commit_before>﻿using System.Runtime.InteropServices;

using NUnit.Framework;

namespace Kirkin.Tests.Native
{
    public class NativeTests
    {
        [Test]
        public void NativeAdd()
        {
            Assert.AreEqual(3, NativeMethods.Add(1, 2));
        }

        static class NativeMethods
        {
#if DEBUG
            [DllImport(@"..\..\..\Debug\Kirkin.Native.dll")]
#else
            [DllImport(@"..\..\..\Release\Kirkin.Native.dll")]
#endif
            public static extern int Add(int a, int b);
        }
    }
}<commit_msg>NativeTests: skip tests if Kirkin.Native.dll does not exist<commit_after>﻿using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;

using NUnit.Framework;

namespace Kirkin.Tests.Native
{
    public class NativeTests
    {
#if DEBUG
        const string DLL_PATH = @"..\..\..\Debug\Kirkin.Native.dll";
#else
        const string DLL_PATH = @"..\..\..\Release\Kirkin.Native.dll";
#endif

        [Test]
        public void NativeAdd()
        {
            SkipTestIfNativeDllDoesntExist();

            Assert.AreEqual(3, NativeMethods.Add(1, 2));
        }

        private static void SkipTestIfNativeDllDoesntExist()
        {
            Assembly assembly = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly();
            string root = Path.GetDirectoryName(assembly.Location);
            string dllPath = Path.Combine(root, DLL_PATH);

            if (!File.Exists(dllPath)) {
                throw new IgnoreException("Kirkin.Native.dll does not exist.");
            }
        }

        static class NativeMethods
        {
            [DllImport(DLL_PATH)]
            public static extern int Add(int a, int b);
        }
    }
}
{'fraction_non_alphanumeric': 0.1195589088798607, 'fraction_numerical': 0.003482298316889147, 'mean_word_length': 2.045936395759717, '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': '6186948', 'n_tokens_mistral': 525, 'n_tokens_neox': 483, 'n_words': 108}