using System;
using System.Collections.Generic;
namespace Tessera.UnitTests.Unicode
{
public static class CodeUnitSamples
{
///
/// Every UTF-16 code unit `isSurrogate` disagrees with `expected` on, up to the first ten.
///
public static string SurrogateMismatches(Func isSurrogate, Func expected)
{
var mismatches = new List();
for (int character = 0; character <= char.MaxValue && mismatches.Count < 10; ++character)
{
if (isSurrogate((char)character) != expected((char)character))
{
mismatches.Add($"U+{character:X4}");
}
}
return string.Join("; ", mismatches);
}
}
}