2010-05-31 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-anon-19.cs
blob5007c37af47df23aa2cd5b1681fe6b2f0f3b603f
3 // Test case for bug: #349034
5 using System;
6 using System.Collections.Generic;
7 using System.Text.RegularExpressions;
9 class Test {
10 private static void TestNaturalSort()
12 Comparison<string> naturalSortComparer = (left, right) => {
13 return Regex.Replace(left ?? "", @"([\d]+)|([^\d]+)", m =>
14 (m.Value.Length > 0 && char.IsDigit(m.Value[0])) ?
15 m.Value.PadLeft(Math.Max((left ?? "").Length, (right ?? "").Length)) :
16 m.Value).CompareTo(Regex.Replace(right ?? "", @"([\d]+)|([^\d]+)", m =>
17 (m.Value.Length > 0 && char.IsDigit(m.Value[0])) ?
18 m.Value.PadLeft(Math.Max((left ?? "").Length, (right ?? "").Length)) :
19 m.Value));
23 public static void Main ()
25 TestNaturalSort ();