Previously, many tests just had a return statement when the test shouldn't
be executed (e.g. Unix-only). This made it look like the test was successful
when in fact it wasn't executed at all.
Assert.Ignore() is now used instead to correctly exclude those tests.
Note: This revision was originally supplied in six parts. Notes
accompanying each of the parts are reproduced below.
[PATCH v5 1/1] System.Char icall: New Unicode category tables compatible with MS .NET
These new category tables, generated using create-category-table(.cs)
available in the mcs sources, make the Mono runtime understand the
same Unicode category codes as recent versions of Microsoft's runtime.
CategoryData_v2 matches versions v2.0.50727 and v3.5.21022 of .NET.
CategoryData_v4 matches version v4.0.30319 of .NET. The v4 tables can
be disabled by defining the DISABLE_NET_4_0 preprocessor symbol.
Similarly, the astral portions of both tables can be disabled by
defining the DISABLE_ASTRAL preprocessor symbol.
CAUTION: Mcs has to be updated with the corresponding patches, or Mono
will suffer a low-level (internal call) crash when initializing
System.Char.
[PATCH v5 1/5] create-category-table: Utility to generate reasonably-packed Unicode tables
This program generates (partially) bi-level tables encoding the
contents of the Unicode character category database.
Mono embeds a linear table with category codes for the Unicode
BMP (first 65536 codepoints), and lacks information about characters
in the astral planes--leading to requests such as bug 480178.
Extending the linear table to cover the full codespace is not an ideal
solution, as that would expand the embedded "blob" by a factor of 17.
The new tables generated by this program can be used to support the
full range of characters. An additional level of indirection used for
characters outside the U+0000..U+FFFF range enables "page" sharing, so
that the total amount of embedded data only grows by 13.5kB.
Cf. in-file comments for usage instructions.
[PATCH v5 2/5] System.Char: Handle astral planes in (string,int) overload
If the string element at index starts a surrogate pair, we decode the
full codepoint and "query" the higher planes of the database.
This fixes bug 480178.
CAUTION: This commit depends on the following runtime change:
System.Char icall: New Unicode category tables compatible with
MS .NET.
Without it, Mono will suffer a low-level (internal call) crash when
initializing System.Char.
COMPATIBILITY
The updated Mono runtime as been verified to produce the same results
as Microsoft's; here are the MD5 sums of their Unicode category
database dumps (generated via create-category-table --dump, compiled
and executed under the relevant runtime):
eba45e00acdc82f9a08873465110aef4 v2.0.50727.dump
eba45e00acdc82f9a08873465110aef4 v3.5.21022.dump
56fd5c828fbb9083693835680667fd2c v4.0.30319.dump
eba45e00acdc82f9a08873465110aef4 gmcs.dump
56fd5c828fbb9083693835680667fd2c dmcs.dump
These results will naturally differ if support for .NET v4 or astral
planes is disabled when building the runtime. Note, also, that these
are different from the results produced by Mono prior to the
introduction of these changes, even for the BMP.
Other versions of the internal database can be easily generated using
create-category-table(.cs), but this currently requires a rebuild.
PERFORMANCE
Direct array indexing is mandatory for code points in the
U+0000..U+FFFF range; as pointed out by Andreas Nahr, performing
bi-level lookups in the Char.Is*(char) predicates cause the JIT to
stop inlining them and results in an important performance drop.
The simple data access pattern used for higher planes, suggested by
Paolo Molaro, is fairly efficient but currenly only used by this
non-optimized method.
[PATCH v5 3/5] Globalization.IdnMappingTest: U+0221 is not unassigned anymore, use U+18B0
U+0221 is LATIN SMALL LETTER D WITH CURL in Unicode 4.0, and is recognized as a
valid letter in recent versions of the .NET framework. This causes
GetAsciiInvalid to (unexpectedly) succeed, and the test to fail.
Use U+18B0 instead, which is unassigned as of Unicode 5.2 and .NET 3.5 SP1.
[PATCH v5 4/5] CharCategoryTest: Update category dumps to match MS .NET
The category codes in newer versions of Microsoft's framework are not
compatible with the ones encoded in this class, causing tests to fail.
Fix that by using new sets of dumps generated under v3.5.21022 and
v4.0.30319.
Also, drop CharTest.IsWhiteSpace_Complete as the same checks are
performed by CharCategoryTest.IsWhiteSpace.
While we are at it, improve the generator so that:
- common code is shared between the generator and the test;
- a number of test cases can be generated at once via
command-line arguments;
- the dumps are word-wrapped, enhancing legibility and avoiding
line length limitations in some compilers.
[PATCH v5 5/5] CharTest: Add tests for astral plane characters/surrogate pairs
- Show that Char.GetUnicodeCategory(string,int) results in a
lookup into the higher planes of the Unicode database when invoked
on a valid surrogate pair, and returns the "normal" category code
otherwise.
- Perform a few sanity checks on the results of ConvertFromUtf32
and GetUnicodeCategory when invoked on codepoints from the
higher planes.
(cherry picked from commit 70dff8b4272dba83bed23e6502499646526efd59)
* CultureInfo.cs : it seems that zh-Hant and zh-Hans are introduced
as almost alias of zh-CHS/zh-CHT in vista and some new windows.
Add hacky support for them.
* CultureInfoTest.cs : test zh-Hant.
svn path=/trunk/mcs/; revision=134499
* CompareInfo.cs : Fixed bug #462957. With empty target string it
should always return 0.
* CompareInfoTest.cs : added test for #462957.
svn path=/trunk/mcs/; revision=122602
* HijriCalendar.cs ThaiBuddhistCalendar.cs HebrewCalendar.cs
GregorianCalendar.cs KoreanCalendar.cs JulianCalendar.cs :
implemented ToFourDigitYear(), actually base implementation mostly
works as is.
* CalendarTest.cs : enabled ToFourDigitYear() test from 5 years ago.
and added some more ToFourDigitYear() tests.
svn path=/trunk/mcs/; revision=81688
TextInfo if current culture is invariant. Remoted private ctor.
In Default, always construct new instance since the current culture
may change.
* CaseInsensitiveHashCodeProviderTest.cs: Improved test for
Default property to show the a new intance is constructed. Added test
for DefaultInvariant. Improved serialization tests. Added ctor test
for null CultureInfo. Code formatting.
* CultureInfoTest.cs: Fixed UseUserOverride tests to pass on systems
where invariant culture is default locale.
svn path=/trunk/mcs/; revision=81408