mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 11:26:31 +00:00
rework to Azaion.Suite
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
using IntervalTree;
|
||||
|
||||
namespace Azaion.Annotator.Test;
|
||||
|
||||
public class IntervalTreeTest
|
||||
{
|
||||
[Theory]
|
||||
[MemberData(nameof(IntervalTreeTestQueryTestData))]
|
||||
public void IntervalTreeTestQuery(int second, string[] expected)
|
||||
{
|
||||
var mainTree = new IntervalTree<TimeSpan, string>
|
||||
{
|
||||
{ TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3), "res01" },
|
||||
{ TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(4), "res02" },
|
||||
{ TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(7), "res04" },
|
||||
{ TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(8), "res05" },
|
||||
};
|
||||
|
||||
var result = mainTree.Query(TimeSpan.FromSeconds(second)).ToArray();
|
||||
result.Should().Equal(expected);
|
||||
}
|
||||
|
||||
public static IEnumerable<object[]> IntervalTreeTestQueryTestData()
|
||||
{
|
||||
yield return [1, new[] {"res01"}];
|
||||
yield return [5, new[] {"res04", "res05"}];
|
||||
yield return [9, new string[] {}];
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user