-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added fixed size sorted arrays and refactored fixed size graph nodes
- Loading branch information
Jack Dermody
committed
Jul 30, 2024
1 parent
3ff5c4e
commit 097022d
Showing
12 changed files
with
13,331 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using BrightData.Types; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace BrightData.UnitTests | ||
{ | ||
public class FixedSizeArrayTests | ||
{ | ||
[Fact] | ||
public void TestAscending() | ||
{ | ||
var array = new FixedSizeSortedAscending2Array<uint, float>(); | ||
array.TryAdd(1, 0.5f).Should().BeTrue(); | ||
array.TryAdd(1, 0.5f).Should().BeFalse(); | ||
array.TryAdd(2, 0.3f).Should().BeTrue(); | ||
array.TryAdd(3, 0.8f).Should().BeFalse(); | ||
array.MinValue.Should().Be(2); | ||
array.MaxValue.Should().Be(1); | ||
array.RemoveAt(0); | ||
array.Size.Should().Be(1); | ||
array.MinValue.Should().Be(1); | ||
} | ||
|
||
[Fact] | ||
public void TestDescending() | ||
{ | ||
var array = new FixedSizeSortedDescending2Array<uint, float>(); | ||
array.TryAdd(1, 0.5f).Should().BeTrue(); | ||
array.TryAdd(1, 0.5f).Should().BeFalse(); | ||
array.TryAdd(2, 0.8f).Should().BeTrue(); | ||
array.TryAdd(3, 0.3f).Should().BeFalse(); | ||
array.MinValue.Should().Be(1); | ||
array.MaxValue.Should().Be(2); | ||
array.RemoveAt(0); | ||
array.Size.Should().Be(1); | ||
array.MaxValue.Should().Be(1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.