<commit_before>﻿using Buddhabrot.Core.Boundary;

namespace Buddhabrot.Core.Tests.Boundary;

public class RegionLookupTests
{
    private readonly IReadOnlyList<RegionId> _power2Regions =
        new[] {(0, 0), (1, 0), (2, 0), (2, 1), (3, 1), (3, 2), (4, 2), (4, 1), (4, 0)}
            .Select(t => new RegionId(t.Item1, t.Item2)).ToList();

    private readonly IReadOnlyList<RegionId> _power3Regions =
        new[]
            {
                (0, 0), (1, 0), (2, 0), (3, 0), (3, 1), (4, 1), (4, 0), (5, 0), (5, 1), (5, 2), (6, 2), (7, 2), (8, 2),
                (9, 2), (9, 1), (9, 0)
            }
            .Select(t => new RegionId(t.Item1, t.Item2)).ToList();

    [Fact]
    public void ShouldConstructQuadTreeFromRealBoundaries()
    {
        var _ = new RegionLookup(verticalPower: 2, regions: _power2Regions);
        _ = new RegionLookup(verticalPower: 3, regions: _power3Regions);
    }

    [Fact]
    public void ShouldReturnEveryAreaIfSearchAreaIsEqualToBounds()
    {
        var lookup = new RegionLookup(2, new[] {new RegionId(0, 0), new RegionId(4, 1)});
        var visibleAreas = lookup.GetVisibleAreas(
            new ComplexArea(
                new Range(-2, 2),
                new Range(-2, 2)));

        visibleAreas.Should().HaveCount(2);
    }

    [Fact]
    public void ShouldReturnIntersectionsWithSearchArea()
    {
        var lookup = new RegionLookup(2, new[] {new RegionId(0, 0), new RegionId(4, 1)});
        var visibleAreas = lookup.GetVisibleAreas(
            new ComplexArea(
                new Range(-0.5, 0.5),
                new Range(0, 1)));

        visibleAreas.Should().HaveCount(1);
    }
}<commit_msg>Fixed tests<commit_after>﻿using Buddhabrot.Core.Boundary;

namespace Buddhabrot.Core.Tests.Boundary;

public class RegionLookupTests
{
    private readonly IReadOnlyList<RegionId> _power2Regions =
        new[] {(0, 0), (1, 0), (2, 0), (2, 1), (3, 1), (3, 2), (4, 2), (4, 1), (4, 0)}
            .Select(t => new RegionId(t.Item1, t.Item2)).ToList();

    private readonly IReadOnlyList<RegionId> _power3Regions =
        new[]
            {
                (0, 0), (1, 0), (2, 0), (3, 0), (3, 1), (4, 1), (4, 0), (5, 0), (5, 1), (5, 2), (6, 2), (7, 2), (8, 2),
                (9, 2), (9, 1), (9, 0)
            }
            .Select(t => new RegionId(t.Item1, t.Item2)).ToList();

    [Fact]
    public void ShouldConstructQuadTreeFromRealBoundaries()
    {
        var _ = new RegionLookup(verticalPower: 2, regions: _power2Regions);
        _ = new RegionLookup(verticalPower: 3, regions: _power3Regions);
    }

    [Fact]
    public void ShouldReturnEveryAreaPlusMirrorsIfSearchAreaIsEqualToBounds()
    {
        var lookup = new RegionLookup(2, new[] {new RegionId(0, 0), new RegionId(4, 1)});
        var visibleAreas = lookup.GetVisibleAreas(
            new ComplexArea(
                new Range(-2, 2),
                new Range(-2, 2)),
            0.00001);
        
        visibleAreas.Should().HaveCount(4);
    }

    [Fact]
    public void ShouldReturnIntersectionsWithSearchArea()
    {
        var lookup = new RegionLookup(2, new[] {new RegionId(0, 0), new RegionId(4, 1)});
        var visibleAreas = lookup.GetVisibleAreas(
            new ComplexArea(
                new Range(-0.5, 0.5),
                new Range(0, 1)),
            0.000001);

        visibleAreas.Should().HaveCount(1);
    }
}
{'fraction_non_alphanumeric': 0.15693215339233038, 'fraction_numerical': 0.05221238938053097, 'mean_word_length': 2.2605769230769233, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4936181', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1131, 'n_words': 291}