Add UTF32 tests

- Encoding and decoding valid chars and bytes
- Other methods
- Ctors
- Properties


Commit migrated from https://github.com/dotnet/corefx/commit/273c114e0877d4d38d901dc76610fd8e2e465a0c
This commit is contained in:
Hugh Bellamy committed 2016-04-25 23:04:13 +01:00
1 parent 6b3c0af254
commit 82e6681aed
8 files changed
+445 -20

No files matched your search

@@ -0,0 +1,29 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Xunit;
namespace System.Text.Tests
{
public class UTF32EncodingGetMaxByteCount
{
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(10)]
[InlineData(int.MaxValue / 4 - 1)]
public void GetMaxByteCount(int charCount)
{
int expected = (charCount + 1) * 4;
Assert.Equal(expected, new UTF32Encoding(true, false, false).GetMaxByteCount(charCount));
Assert.Equal(expected, new UTF32Encoding(true, true, false).GetMaxByteCount(charCount));
Assert.Equal(expected, new UTF32Encoding(true, false, true).GetMaxByteCount(charCount));
Assert.Equal(expected, new UTF32Encoding(true, true, true).GetMaxByteCount(charCount));
Assert.Equal(expected, new UTF32Encoding(false, true, true).GetMaxByteCount(charCount));
Assert.Equal(expected, new UTF32Encoding(false, true, false).GetMaxByteCount(charCount));
Assert.Equal(expected, new UTF32Encoding(false, false, true).GetMaxByteCount(charCount));
Assert.Equal(expected, new UTF32Encoding(false, false, false).GetMaxByteCount(charCount));
}
}
}