<commit_before>﻿using NUnit.Framework;
using SwissArmyKnife.DataStructures;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SwissArmyKnife.Tests.DataStructures
{
    [TestFixture]
    internal class BloomFilterTests
    {
        [Test]
        public void AddAndTest_Successful([Values("a", "b", "c", "d", "lorem ipsum dolor sit amet")]string input)
        {
            var bf = new BloomFilter(64);

            var testData = Encoding.ASCII.GetBytes(input);

            bf.Add(testData);

            var result = bf.Test(testData);

            Assert.IsTrue(result);
        }

        [Test]
        public void TestWithoutAdd_Successful([Values("a", "b", "c", "d", "lorem ipsum dolor sit amet")]string input)
        {
            var bf = new BloomFilter(64);

            var testData = Encoding.ASCII.GetBytes(input);

            var result = bf.Test(testData);

            Assert.IsFalse(result);
        }

    }
}<commit_msg>Added tests for argument checking in BloomFilter<commit_after>﻿using NUnit.Framework;
using SwissArmyKnife.DataStructures;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SwissArmyKnife.Tests.DataStructures
{
    [TestFixture]
    internal class BloomFilterTests
    {
        [Test]
        public void AddAndTest_Successful([Values("a", "b", "c", "d", "lorem ipsum dolor sit amet")]string input)
        {
            var bf = new BloomFilter(64);

            var testData = Encoding.ASCII.GetBytes(input);

            bf.Add(testData);

            var result = bf.Test(testData);

            Assert.IsTrue(result);
        }

        [Test]
        public void TestWithoutAdd_Successful([Values("a", "b", "c", "d", "lorem ipsum dolor sit amet")]string input)
        {
            var bf = new BloomFilter(64);

            var testData = Encoding.ASCII.GetBytes(input);

            var result = bf.Test(testData);

            Assert.IsFalse(result);
        }

        [Test]
        [ExpectedException(typeof(ArgumentOutOfRangeException))]
        public void InitializesWithZeroSize_Throws()
        {
            var bf = new BloomFilter(0);
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void AddNull_Throws()
        {
            var bf = new BloomFilter(64);

            byte[] input = null;

            bf.Add(input);
        }

        [Test]
        [ExpectedException(typeof(ArgumentException))]
        public void AddEmpty_Throws()
        {
            var bf = new BloomFilter(64);

            byte[] input = new byte[0];

            bf.Add(input);
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void TestWithNull_Throws()
        {
            var bf = new BloomFilter(64);

            byte[] input = null;

            bf.Test(input);
        }

        [Test]
        [ExpectedException(typeof(ArgumentException))]
        public void TestWithEmpty_Throws()
        {
            var bf = new BloomFilter(64);

            byte[] input = new byte[0];

            bf.Test(input);
        }
    }
}
{'fraction_non_alphanumeric': 0.10812480691998765, 'fraction_numerical': 0.005869632375656472, 'mean_word_length': 2.057601510859301, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 4, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4228084', 'n_tokens_mistral': 973, 'n_tokens_neox': 925, 'n_words': 207}