mirror of
https://github.com/davidkaya/aryx.git
synced 2026-07-28 23:48:39 +02:00
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using Kopaya.AgentHost.Services;
|
|
|
|
namespace Kopaya.AgentHost.Tests;
|
|
|
|
public sealed class StreamingTextMergerTests
|
|
{
|
|
[Fact]
|
|
public void Merge_AppendsPlainDeltas()
|
|
{
|
|
Assert.Equal("I am going", StreamingTextMerger.Merge("I am", " going"));
|
|
}
|
|
|
|
[Fact]
|
|
public void Merge_ReplacesWithGrowingSnapshot()
|
|
{
|
|
Assert.Equal("I am going", StreamingTextMerger.Merge("I am", "I am going"));
|
|
}
|
|
|
|
[Fact]
|
|
public void Merge_PreservesCurrentTextForDuplicateSubset()
|
|
{
|
|
Assert.Equal("I am going", StreamingTextMerger.Merge("I am going", "going"));
|
|
}
|
|
|
|
[Fact]
|
|
public void Merge_UsesOverlapToAvoidDuplicateJoins()
|
|
{
|
|
Assert.Equal("Hello world", StreamingTextMerger.Merge("Hello wor", "world"));
|
|
}
|
|
|
|
[Fact]
|
|
public void Merge_ReplacesWithRevisedSnapshotWhenMostTokensOverlap()
|
|
{
|
|
const string current = "I mirror the existing button pattern and add brief toggle docs.";
|
|
const string incoming = "I found the standalone component pattern and I am updating toggle docs next.";
|
|
|
|
Assert.Equal(incoming, StreamingTextMerger.Merge(current, incoming));
|
|
}
|
|
}
|