Added a unit test to confirm that the code point encoding works correctly.
This commit is contained in:
@@ -13,6 +13,9 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
#if DEBUG
|
||||
[assembly: InternalsVisibleTo("UnicodeInformation.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100711da5e71bb2208797ed36597e628c6bf6541b6c157ede943539d19de5104763bd2f42d8c0233ea8fbe7e782d4e2d29c3706a8e8dc1cfa78faabec946a167f7b2b1d396d17a85839ad96f2be930c0efaa893c8b9b6a665bf50ca569b56b9eabf3a69e8274723f85e9d4c3eea1e53dcbbb29a74c78c305e447917daaa6593f1c2")]
|
||||
#endif
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Net;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Unicode.Builder;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Unicode.Tests
|
||||
{
|
||||
@@ -61,5 +62,25 @@ namespace System.Unicode.Tests
|
||||
Assert.AreEqual((int)'\t', data.Get('\t').CodePointRange.FirstCodePoint);
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[TestMethod]
|
||||
public void TestCodePointEncoding()
|
||||
{
|
||||
using (var stream = new MemoryStream(4))
|
||||
using (var writer = new BinaryWriter(stream, Encoding.UTF8, true))
|
||||
using (var reader = new BinaryReader(stream, Encoding.UTF8, true))
|
||||
{
|
||||
for (int i = 0; i <= 0x10FFFF; ++i)
|
||||
{
|
||||
writer.WriteCodePoint(i);
|
||||
writer.Flush();
|
||||
stream.Position = 0;
|
||||
Assert.AreEqual(i, UnicodeData.ReadCodePoint(reader));
|
||||
stream.Position = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,12 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>..\System.Unicode.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
@@ -67,6 +73,11 @@
|
||||
<Name>UnicodeInformation</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\System.Unicode.snk">
|
||||
<Link>System.Unicode.snk</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
|
||||
@@ -16,6 +16,9 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
[assembly: InternalsVisibleTo("UnicodeInformation.Builder, PublicKey=0024000004800000940000000602000000240000525341310004000001000100711da5e71bb2208797ed36597e628c6bf6541b6c157ede943539d19de5104763bd2f42d8c0233ea8fbe7e782d4e2d29c3706a8e8dc1cfa78faabec946a167f7b2b1d396d17a85839ad96f2be930c0efaa893c8b9b6a665bf50ca569b56b9eabf3a69e8274723f85e9d4c3eea1e53dcbbb29a74c78c305e447917daaa6593f1c2")]
|
||||
#if DEBUG
|
||||
[assembly: InternalsVisibleTo("UnicodeInformation.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100711da5e71bb2208797ed36597e628c6bf6541b6c157ede943539d19de5104763bd2f42d8c0233ea8fbe7e782d4e2d29c3706a8e8dc1cfa78faabec946a167f7b2b1d396d17a85839ad96f2be930c0efaa893c8b9b6a665bf50ca569b56b9eabf3a69e8274723f85e9d4c3eea1e53dcbbb29a74c78c305e447917daaa6593f1c2")]
|
||||
#endif
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
|
||||
@@ -87,7 +87,11 @@ namespace System.Unicode
|
||||
// return reader.ReadByte() | ((reader.ReadByte() | (reader.ReadByte() << 8)) << 8);
|
||||
//}
|
||||
|
||||
#if DEBUG
|
||||
internal static int ReadCodePoint(BinaryReader reader)
|
||||
#else
|
||||
private static int ReadCodePoint(BinaryReader reader)
|
||||
#endif
|
||||
{
|
||||
byte b = reader.ReadByte();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user