BindingFlags.Public needed here as Exception.HResult is now public in .NET 4.5. This...
[mono.git] / mcs / class / corlib / Test / System.Collections / SortedListTest.cs
1 // SortedListTest.cs - NUnit Test Cases for the System.Collections.SortedList class
2 //
3 // Authors:
4 //      Jaak Simm
5 //      Duncan Mak (duncan@ximian.com)
6 //
7 // Thanks go to David Brandt (bucky@keystreams.com),
8 // because this file is based on his ArrayListTest.cs
9 //
10 // (C) Ximian, Inc.  http://www.ximian.com
11 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
12 // 
13 // main TODO: additional tests for functions affected by
14 //            fixedsize and read-only properties 
15
16
17 using System;
18 using System.Collections;
19 using System.IO;
20 using System.Runtime.Serialization.Formatters;
21 using System.Runtime.Serialization.Formatters.Binary;
22
23 using NUnit.Framework;
24
25 namespace MonoTests.System.Collections
26 {
27         public class SortedListComparer : IComparer
28         {
29                 public int Compare (object x, object y)
30                 {
31                         return x.GetHashCode () - y.GetHashCode ();
32                 }
33         }
34
35         [TestFixture]
36         public class SortedListTest
37         {
38                 protected SortedList sl1;
39                 protected SortedList sl2;
40                 protected SortedList emptysl;
41                 protected const int icap = 16;
42
43                 public void TestConstructor1 ()
44                 {
45                         SortedList temp1 = new SortedList ();
46                         Assert.IsNotNull (temp1, "#1");
47 #if !NET_2_0 // no such expectation as it is broken in .NET 2.0
48                         Assert.AreEqual (icap, temp1.Capacity, "#2");
49 #endif
50                 }
51
52                 [Test]
53                 public void TestConstructor2 ()
54                 {
55                         Comparer c = Comparer.Default;
56                         SortedList temp1 = new SortedList (c);
57                         Assert.IsNotNull (temp1, "#1");
58 #if !NET_2_0 // no such expectation as it is broken in .NET 2.0
59                         Assert.AreEqual (icap, temp1.Capacity, "#2");
60 #endif
61                 }
62
63                 [Test]
64                 public void TestConstructor3 ()
65                 {
66                         Hashtable d = new Hashtable ();
67                         d.Add ("one", "Mircosoft");
68                         d.Add ("two", "will");
69                         d.Add ("three", "rule");
70                         d.Add ("four", "the world");
71
72                         SortedList temp1 = new SortedList (d);
73                         Assert.IsNotNull (temp1, "#A1");
74                         Assert.AreEqual (4, temp1.Capacity, "#A2");
75                         Assert.AreEqual (4, temp1.Count, "#A3");
76
77                         try {
78                                 new SortedList ((Hashtable) null);
79                                 Assert.Fail ("#B");
80                         } catch (ArgumentNullException) {
81                         }
82
83                         try {
84                                 d = new Hashtable ();
85                                 d.Add ("one", "Mircosoft");
86                                 d.Add ("two", "will");
87                                 d.Add ("three", "rule");
88                                 d.Add ("four", "the world");
89                                 d.Add (7987, "lkj");
90                                 new SortedList (d);
91                                 Assert.Fail ("#C");
92                         } catch (InvalidOperationException) {
93                         }
94                 }
95
96                 [Test]
97                 public void TestConstructor4 ()
98                 {
99                         SortedList temp1 = new SortedList (17);
100                         Assert.IsNotNull (temp1, "#A1");
101                         Assert.AreEqual (17, temp1.Capacity, "#A2");
102
103                         try {
104                                 new SortedList (-6);
105                                 Assert.Fail ("#B");
106                         } catch (ArgumentOutOfRangeException) {
107                         }
108
109                         temp1 = new SortedList (0);
110                         Assert.IsNotNull (temp1, "#C");
111                 }
112
113                 [Test]
114                 public void TestConstructor5 ()
115                 {
116                         Comparer c = Comparer.Default;
117                         SortedList temp1 = new SortedList (c, 27);
118                         Assert.IsNotNull (temp1, "#A1");
119                         Assert.AreEqual (27, temp1.Capacity, "#A2");
120
121                         try {
122                                 new SortedList (-12);
123                                 Assert.Fail ("#B");
124                         } catch (ArgumentOutOfRangeException) {
125                         }
126                 }
127
128 #if !NET_2_0 // no such expectation as it is broken in .NET 2.0
129                 [Test]
130                 public void Constructor_Capacity ()
131                 {
132                         SortedList sl = new SortedList (0);
133                         Assert.AreEqual (0, sl.Capacity, "#A1");
134                         sl.Capacity = 0;
135                         // doesn't reset to class default (16)
136                         Assert.AreEqual (0, sl.Capacity, "#A2");
137
138                         for (int i = 1; i <= 16; i++) {
139                                 sl = new SortedList (i);
140                                 Assert.AreEqual (i, sl.Capacity, "#B1:" + i);
141                                 sl.Capacity = 0;
142                                 // reset to class default (16)
143                                 Assert.AreEqual (16, sl.Capacity, "#B2:" + i);
144                         }
145                 }
146 #endif
147
148                 [Test]
149                 public void TestIsSynchronized ()
150                 {
151                         SortedList sl1 = new SortedList ();
152                         Assert.IsFalse (sl1.IsSynchronized, "#1");
153                         SortedList sl2 = SortedList.Synchronized (sl1);
154                         Assert.IsTrue (sl2.IsSynchronized, "#2");
155                 }
156
157                 [Test]
158                 public void TestCapacity ()
159                 {
160                         for (int i = 0; i < 100; i++) {
161                                 SortedList sl1 = new SortedList (i);
162                                 Assert.AreEqual (i, sl1.Capacity, i.ToString ());
163                         }
164                 }
165
166                 [Test]
167                 public void TestCapacity2 ()
168                 {
169                         SortedList list = new SortedList ();
170
171                         list.Capacity = 5;
172                         Assert.AreEqual (5, list.Capacity, "#1");
173
174                         SortedList sync = SortedList.Synchronized (list);
175                         Assert.AreEqual (5, sync.Capacity, "#2");
176
177                         list.Capacity = 20;
178                         Assert.AreEqual (20, list.Capacity, "#3");
179                         Assert.AreEqual (20, sync.Capacity, "#4");
180                 }
181
182                 [Test]
183                 public void TestCapacity3 ()
184                 {
185                         int new_capacity = 5;
186                         SortedList list = new SortedList (1000);
187                         list.Capacity = new_capacity;
188
189 #if NET_1_1
190                         Assert.AreEqual (new_capacity, list.Capacity);
191 #else
192                         Assert.AreEqual (16, list.Capacity);
193 #endif
194                 }
195
196                 [Test]
197                 public void Capacity_BackTo0 ()
198                 {
199                         SortedList list = new SortedList (42);
200                         Assert.AreEqual (42, list.Capacity, "#1");
201                         list.Capacity = 0;
202 #if !NET_2_0 // no such expectation as it is broken in .NET 2.0
203                         Assert.AreEqual (16, list.Capacity, "#2");
204 #endif
205                 }
206
207                 [Test]
208                 [ExpectedException (typeof (OutOfMemoryException))]
209                 public void TestCapacity4 ()
210                 {
211                         SortedList list = new SortedList ();
212                         list.Capacity = Int32.MaxValue;
213                 }
214
215                 [Test]
216                 public void TestCount ()
217                 {
218                         SortedList sl1 = new SortedList ();
219                         Assert.AreEqual (0, sl1.Count, "#1");
220                         for (int i = 1; i <= 100; i++) {
221                                 sl1.Add ("" + i, "" + i);
222                                 Assert.AreEqual (i, sl1.Count, "#2:" + i);
223                         }
224                 }
225
226                 [Test]
227                 public void TestIsFixed ()
228                 {
229                         SortedList sl1 = new SortedList ();
230                         Assert.IsFalse (sl1.IsFixedSize);
231                 }
232
233                 [Test]
234                 public void TestIsReadOnly ()
235                 {
236                         SortedList sl1 = new SortedList ();
237                         Assert.IsFalse (sl1.IsReadOnly);
238                 }
239
240                 [Test]
241                 public void TestItem ()
242                 {
243                         SortedList sl1 = new SortedList ();
244
245                         object o = sl1 [-1];
246                         Assert.IsNull (o, "#A");
247
248                         try {
249                                 o = sl1 [(string) null];
250                                 Assert.Fail ("#B");
251                         } catch (ArgumentNullException) {
252                         }
253
254                         for (int i = 0; i <= 100; i++)
255                                 sl1.Add ("kala " + i, i);
256                         for (int i = 0; i <= 100; i++)
257                                 Assert.AreEqual (i, sl1 ["kala " + i], "#C:" + i);
258                 }
259
260                 [Test]
261                 public void TestSyncRoot ()
262                 {
263                         SortedList sl1 = new SortedList ();
264                         Assert.IsNotNull (sl1.SyncRoot);
265                         /*
266                         lock( sl1.SyncRoot ) {
267                                 foreach ( Object item in sl1 ) {
268                                         item="asdf";
269                                         Assert ("sl.SyncRoot: item not read-only",item.IsReadOnly);
270                                 }
271                         }
272                         */
273                 }
274
275                 [Test]
276                 public void TestValues ()
277                 {
278                         SortedList sl1 = new SortedList ();
279                         ICollection ic1 = sl1.Values;
280                         for (int i = 0; i <= 100; i++) {
281                                 sl1.Add ("kala " + i, i);
282                                 Assert.AreEqual (ic1.Count, sl1.Count);
283                         }
284                 }
285
286
287                 // TODO: Add with IComparer
288                 [Test]
289                 public void TestAdd ()
290                 {
291                         // seems SortedList cannot be set fixedsize or readonly
292                         SortedList sl1 = new SortedList ();
293
294                         try {
295                                 sl1.Add ((string) null, "kala");
296                                 Assert.Fail ("#A");
297                         } catch (ArgumentNullException) {
298                         }
299
300                         for (int i = 1; i <= 100; i++) {
301                                 sl1.Add ("kala " + i, i);
302                                 Assert.AreEqual (i, sl1.Count, "#B1:" + i);
303                                 Assert.AreEqual (i, sl1 ["kala " + i], "#B2:" + i);
304                         }
305
306                         try {
307                                 sl1.Add ("kala", 10);
308                                 sl1.Add ("kala", 11);
309                                 Assert.Fail ("#C");
310                         } catch (ArgumentException) {
311                         }
312                 }
313
314                 [Test]
315                 public void TestClear ()
316                 {
317                         SortedList sl1 = new SortedList (10);
318                         sl1.Add ("kala", 'c');
319                         sl1.Add ("kala2", 'd');
320                         Assert.AreEqual (10, sl1.Capacity, "#A1");
321                         Assert.AreEqual (2, sl1.Count, "#A2");
322                         sl1.Clear ();
323                         Assert.AreEqual (0, sl1.Count, "#B1");
324 #if !NET_2_0 // no such expectation as it is broken in .NET 2.0
325                         Assert.AreEqual (16, sl1.Capacity, "#B2");
326 #endif
327                 }
328
329 #if !NET_2_0 // no such expectation as it is broken in .NET 2.0
330                 [Test]
331                 public void Clear_Capacity ()
332                 {
333                         // strangely Clear change the default capacity (while Capacity doesn't)
334                         for (int i = 0; i <= 16; i++) {
335                                 SortedList sl = new SortedList (i);
336                                 Assert.AreEqual (i, sl.Capacity, "#1:"+ i);
337                                 sl.Clear ();
338                                 // reset to class default (16)
339                                 Assert.AreEqual (16, sl.Capacity, "#2:" + i);
340                         }
341                 }
342
343                 [Test]
344                 public void Clear_Capacity_Reset ()
345                 {
346                         SortedList sl = new SortedList (0);
347                         Assert.AreEqual (0, sl.Capacity, "#1");
348                         sl.Clear ();
349                         // reset to class default (16)
350                         Assert.AreEqual (16, sl.Capacity, "#2");
351                         sl.Capacity = 0;
352                         Assert.AreEqual (16, sl.Capacity, "#3");
353                         // note: we didn't return to 0 - so Clear cahnge the default capacity
354                 }
355 #endif
356
357                 [Test]
358                 public void TestClone ()
359                 {
360                         {
361                                 SortedList sl1 = new SortedList (10);
362                                 for (int i = 0; i <= 50; i++)
363                                         sl1.Add ("kala " + i, i);
364                                 SortedList sl2 = (SortedList) sl1.Clone ();
365                                 for (int i = 0; i <= 50; i++)
366                                         Assert.AreEqual (sl1 ["kala " + i], sl2 ["kala " + i], "#A:" + i);
367                         }
368                         {
369                                 char [] d10 = { 'a', 'b' };
370                                 char [] d11 = { 'a', 'c' };
371                                 char [] d12 = { 'b', 'c' };
372                                 //char[][] d1 = {d10, d11, d12};
373                                 SortedList sl1 = new SortedList ();
374                                 sl1.Add ("d1", d10);
375                                 sl1.Add ("d2", d11);
376                                 sl1.Add ("d3", d12);
377                                 SortedList sl2 = (SortedList) sl1.Clone ();
378                                 Assert.AreEqual (sl1 ["d1"], sl2 ["d1"], "#B1");
379                                 Assert.AreEqual (sl1 ["d2"], sl2 ["d2"], "#B2");
380                                 Assert.AreEqual (sl1 ["d3"], sl2 ["d3"], "#B3");
381                                 ((char []) sl1 ["d1"]) [0] = 'z';
382                                 Assert.AreEqual (sl1 ["d1"], sl2 ["d1"], "#B4");
383                         }
384                 }
385
386                 [Test]
387                 public void TestContains ()
388                 {
389                         SortedList sl1 = new SortedList (55);
390                         for (int i = 0; i <= 50; i++) { sl1.Add ("kala " + i, i); }
391
392                         try {
393                                 if (sl1.Contains (null)) {
394                                 }
395                                 Assert.Fail ("#A");
396                         } catch (ArgumentNullException) {
397                         }
398
399                         Assert.IsTrue (sl1.Contains ("kala 17"), "#B1");
400                         Assert.IsFalse (sl1.Contains ("ohoo"), "#B2");
401                 }
402
403                 [Test]
404                 public void TestContainsKey ()
405                 {
406                         SortedList sl1 = new SortedList (55);
407                         for (int i = 0; i <= 50; i++) { sl1.Add ("kala " + i, i); }
408
409                         try {
410                                 if (sl1.ContainsKey (null)) {
411                                 }
412                                 Assert.Fail ("#A");
413                         } catch (ArgumentNullException) {
414                         }
415
416                         Assert.IsTrue (sl1.ContainsKey ("kala 17"), "#B1");
417                         Assert.IsFalse (sl1.ContainsKey ("ohoo"), "#B2");
418                 }
419
420                 [Test]
421                 public void TestContainsValue ()
422                 {
423                         SortedList sl1 = new SortedList (55);
424                         sl1.Add (0, "zero");
425                         sl1.Add (1, "one");
426                         sl1.Add (2, "two");
427                         sl1.Add (3, "three");
428                         sl1.Add (4, "four");
429
430                         Assert.IsTrue (sl1.ContainsValue ("zero"), "#1");
431                         Assert.IsFalse (sl1.ContainsValue ("ohoo"), "#2");
432                         Assert.IsFalse (sl1.ContainsValue (null), "#3");
433                 }
434
435                 [Test]
436                 public void TestCopyTo ()
437                 {
438                         SortedList sl1 = new SortedList ();
439                         for (int i = 0; i <= 10; i++) { sl1.Add ("kala " + i, i); }
440                         {
441                                 try {
442                                         sl1.CopyTo (null, 2);
443                                         Assert.Fail ("sl.CopyTo: does not throw ArgumentNullException when target null");
444                                 } catch (ArgumentNullException) {
445                                 }
446                         }
447                         {
448                                 try {
449                                         Char [,] c2 = new Char [2, 2];
450                                         sl1.CopyTo (c2, 2);
451                                         Assert.Fail ("sl.CopyTo: does not throw ArgumentException when target is multiarray");
452                                 } catch (ArgumentException) {
453                                 }
454                         }
455                         {
456                                 try {
457                                         Char [] c1 = new Char [2];
458                                         sl1.CopyTo (c1, -2);
459                                         Assert.Fail ("sl.CopyTo: does not throw ArgumentOutOfRangeException when index is negative");
460                                 } catch (ArgumentOutOfRangeException) {
461                                 }
462                         }
463                         {
464                                 try {
465                                         Char [] c1 = new Char [2];
466                                         sl1.CopyTo (c1, 3);
467                                         Assert.Fail ("sl.CopyTo: does not throw ArgumentException when index is too large");
468                                 } catch (ArgumentException) {
469                                 }
470                         }
471                         {
472                                 try {
473                                         Char [] c1 = new Char [2];
474                                         sl1.CopyTo (c1, 1);
475                                         Assert.Fail ("sl.CopyTo: does not throw ArgumentException when SortedList too big for the array");
476                                 } catch (ArgumentException) {
477                                 }
478                         }
479                         {
480                                 try {
481                                         Char [] c2 = new Char [15];
482                                         sl1.CopyTo (c2, 0);
483                                         Assert.Fail ("sl.CopyTo: does not throw InvalidCastException when incompatible data types");
484                                 } catch (InvalidCastException) {
485                                 }
486                         }
487
488                         // CopyTo function does not work well with SortedList
489                         // even example at MSDN gave InvalidCastException
490                         // thus, it is NOT tested here
491                         /*
492                                         sl1.Clear();
493                                         for (int i = 0; i <= 5; i++) {sl1.Add(i,""+i);}
494                             Char[] copy = new Char[15];
495                             Array.Clear(copy,0,copy.Length);
496                             copy.SetValue( "The", 0 );
497                             copy.SetValue( "quick", 1 );
498                             copy.SetValue( "brown", 2 );
499                             copy.SetValue( "fox", 3 );
500                             copy.SetValue( "jumped", 4 );
501                             copy.SetValue( "over", 5 );
502                             copy.SetValue( "the", 6 );
503                             copy.SetValue( "lazy", 7 );
504                             copy.SetValue( "dog", 8 );
505                                         sl1.CopyTo(copy,1);
506                                         AssertEquals("sl.CopyTo: incorrect copy(1).","The", copy.GetValue(0));
507                                         AssertEquals("sl.CopyTo: incorrect copy(1).","quick", copy.GetValue(1));
508                                         for (int i=2; i<8; i++) AssertEquals("sl.CopyTo: incorrect copy(2).",sl1["kala "+(i-2)], copy.GetValue(i));
509                                         AssertEquals("sl.CopyTo: incorrect copy(3).","dog", copy.GetValue(8));
510                         */
511                 }
512
513                 public SortedList DefaultSL ()
514                 {
515                         SortedList sl1 = new SortedList ();
516                         sl1.Add (1.0, "The");
517                         sl1.Add (1.1, "quick");
518                         sl1.Add (34.0, "brown");
519                         sl1.Add (-100.75, "fox");
520                         sl1.Add (1.4, "jumped");
521                         sl1.Add (1.5, "over");
522                         sl1.Add (1.6, "the");
523                         sl1.Add (1.7, "lazy");
524                         sl1.Add (1.8, "dog");
525                         return sl1;
526                 }
527
528                 public IList DefaultValues ()
529                 {
530                         IList il = new ArrayList ();
531                         il.Add ("fox");
532                         il.Add ("The");
533                         il.Add ("quick");
534                         il.Add ("jumped");
535                         il.Add ("over");
536                         il.Add ("the");
537                         il.Add ("lazy");
538                         il.Add ("dog");
539                         il.Add ("brown");
540                         return il;
541                 }
542
543                 [Test]
544                 public void TestGetByIndex ()
545                 {
546                         SortedList sl1 = DefaultSL ();
547                         Assert.AreEqual ("over", sl1.GetByIndex (4), "#A1");
548                         Assert.AreEqual ("brown", sl1.GetByIndex (8), "#A2");
549
550                         try {
551                                 sl1.GetByIndex (-1);
552                                 Assert.Fail ("#B");
553                         } catch (ArgumentOutOfRangeException) {
554                         }
555
556                         try {
557                                 sl1.GetByIndex (100);
558                                 Assert.Fail ("#C");
559                         } catch (ArgumentOutOfRangeException) {
560                         }
561                 }
562
563                 [Test]
564                 public void GetEnumerator ()
565                 {
566                         SortedList sl1 = DefaultSL ();
567                         IDictionaryEnumerator e = sl1.GetEnumerator ();
568                         Assert.IsNotNull (e, "#1");
569                         Assert.IsTrue (e.MoveNext (), "#2");
570                         Assert.IsNotNull (e.Current, "#3");
571                         Assert.IsTrue ((e is ICloneable), "#4");
572                         Assert.IsTrue ((e is IDictionaryEnumerator), "#5");
573                         Assert.IsTrue ((e is IEnumerator), "#6");
574                 }
575
576                 [Test]
577                 public void TestGetKey ()
578                 {
579                         SortedList sl1 = DefaultSL ();
580                         Assert.AreEqual (1.5, sl1.GetKey (4), "#A1");
581                         Assert.AreEqual (34.0, sl1.GetKey (8), "#A2");
582
583                         try {
584                                 sl1.GetKey (-1);
585                                 Assert.Fail ("#B");
586                         } catch (ArgumentOutOfRangeException) {
587                         }
588
589                         try {
590                                 sl1.GetKey (100);
591                                 Assert.Fail ("#C");
592                         } catch (ArgumentOutOfRangeException) {
593                         }
594                 }
595
596                 [Test]
597                 public void TestGetKeyList ()
598                 {
599                         SortedList sl1 = DefaultSL ();
600                         IList keys = sl1.GetKeyList ();
601                         Assert.IsNotNull (keys, "#A1");
602                         Assert.IsTrue (keys.IsReadOnly, "#A2");
603                         Assert.AreEqual (9, keys.Count, "#A3");
604                         Assert.AreEqual (1.4, keys [3], "#A4");
605                         sl1.Add (33.9, "ehhe");
606                         Assert.AreEqual (10, keys.Count, "#B1");
607                         Assert.AreEqual (33.9, keys [8], "#B2");
608                 }
609
610                 [Test]
611                 public void TestGetValueList ()
612                 {
613                         SortedList sl1 = DefaultSL ();
614                         IList originalvals = DefaultValues ();
615                         IList vals = sl1.GetValueList ();
616                         Assert.IsNotNull (vals, "#A1");
617                         Assert.IsTrue (vals.IsReadOnly, "#A2");
618                         Assert.AreEqual (vals.Count, sl1.Count, "#A3");
619
620                         for (int i = 0; i < sl1.Count; i++) {
621                                 Assert.AreEqual (vals [i], originalvals [i], "#A4:" + i);
622                         }
623
624                         sl1.Add (0.01, "ehhe");
625                         Assert.AreEqual (10, vals.Count, "#B1");
626                         Assert.AreEqual ("dog", vals [8], "#B2");
627                 }
628
629                 // TODO: IEnumerable.GetEnumerator [Explicit Interface Implementation]
630                 /*
631                 public void TestIEnumerable_GetEnumerator() {
632                         SortedList sl1 = DefaultSL();
633                         IEnumerator e = sl1.IEnumerable.GetEnumerator();
634                         AssertNotNull("sl.GetEnumerator: does not return enumerator", e);
635                         AssertEquals("sl.GetEnumerator: enumerator not working(1)",e.MoveNext(),true);
636                         AssertNotNull("sl.GetEnumerator: enumerator not working(2)",e.Current);
637                 }
638                 */
639
640                 [Test]
641                 public void TestIndexOfKey ()
642                 {
643                         SortedList sl1 = new SortedList (24);
644
645                         for (int i = 0; i <= 50; i++) {
646                                 string s = string.Format ("{0:D2}", i);
647                                 sl1.Add ("kala " + s, i);
648                         }
649                         Assert.AreEqual (-1, sl1.IndexOfKey ("kala "), "#A");
650
651                         try {
652                                 sl1.IndexOfKey ((string) null);
653                                 Assert.Fail ("#B");
654                         } catch (ArgumentNullException) {
655                         }
656
657                         try {
658                                 sl1.IndexOfKey (10);
659                                 Assert.Fail ("#C");
660                         } catch (InvalidOperationException) {
661                         }
662
663                         for (int i = 0; i <= 50; i++) {
664                                 string s = string.Format ("{0:D2}", i);
665                                 Assert.AreEqual (i, sl1.IndexOfKey ("kala " + s), "#D:" + i);
666                         }
667                 }
668
669                 [Test]
670                 public void TestIndexOfValue ()
671                 {
672                         SortedList sl1 = new SortedList (24);
673                         string s = null;
674                         for (int i = 0; i < 50; i++) {
675                                 s = string.Format ("{0:D2}", i);
676                                 sl1.Add ("kala " + s, 100 + i * i);
677                         }
678                         for (int i = 0; i < 50; i++) {
679                                 s = string.Format ("{0:D2}", i + 50);
680                                 sl1.Add ("kala " + s, 100 + i * i);
681                         }
682                         Assert.AreEqual (-1, sl1.IndexOfValue (102), "#1");
683                         Assert.AreEqual (-1, sl1.IndexOfValue (null), "#2");
684                         for (int i = 0; i < 50; i++)
685                                 Assert.AreEqual (i, sl1.IndexOfValue (100 + i * i), "#3:" + i);
686                 }
687
688                 [Test]
689                 public void TestIndexOfValue2 ()
690                 {
691                         SortedList list = new SortedList ();
692                         list.Add ("key0", "la la");
693                         list.Add ("key1", "value");
694                         list.Add ("key2", "value");
695
696                         int i = list.IndexOfValue ("value");
697                         Assert.AreEqual (1, i);
698                 }
699
700                 [Test]
701                 public void TestIndexOfValue3 ()
702                 {
703                         SortedList list = new SortedList ();
704                         int i = list.IndexOfValue ((string) null);
705                         Assert.AreEqual (1, -i);
706                 }
707
708                 [Test]
709                 public void TestIndexer ()
710                 {
711                         SortedList list = new SortedList ();
712
713                         list.Add (1, new Queue ());
714                         list.Add (2, new Hashtable ());
715                         list.Add (3, new Stack ());
716
717                         Assert.AreEqual (typeof (Queue), list [1].GetType (), "#1");
718                         Assert.AreEqual (typeof (Hashtable), list [2].GetType (), "#2");
719                         Assert.AreEqual (typeof (Stack), list [3].GetType (), "#3");
720                 }
721
722                 [Test]
723                 public void TestEnumerator ()
724                 {
725                         SortedList list = new SortedList ();
726
727                         list.Add (1, new Queue ());
728                         list.Add (2, new Hashtable ());
729                         list.Add (3, new Stack ());
730
731                         foreach (DictionaryEntry d in list) {
732
733                                 int key = (int) d.Key;
734                                 Type value = d.Value.GetType ();
735
736                                 switch (key) {
737                                 case 1:
738                                         Assert.AreEqual (typeof (Queue), value, "#1");
739                                         break;
740
741                                 case 2:
742                                         Assert.AreEqual (typeof (Hashtable), value, "#2");
743                                         break;
744
745                                 case 3:
746                                         Assert.AreEqual (typeof (Stack), value, "#3");
747                                         break;
748
749                                 default:
750                                         Assert.Fail ("#4:" + value.FullName);
751                                         break;
752                                 }
753                         }
754                 }
755
756                 [Test]
757                 public void TestRemove ()
758                 {
759                         SortedList sl1 = new SortedList (24);
760                         string s = null;
761                         int k;
762                         for (int i = 0; i < 50; i++) sl1.Add ("kala " + i, i);
763
764                         try {
765                                 sl1.Remove (s);
766                                 Assert.Fail ("#A");
767                         } catch (ArgumentNullException) {
768                         }
769
770                         k = sl1.Count;
771                         sl1.Remove ("kala ");
772                         Assert.AreEqual (k, sl1.Count, "#B");
773
774                         try {
775                                 sl1.Remove (15);
776                                 Assert.Fail ("#C");
777                         } catch (InvalidOperationException) {
778                         }
779
780                         for (int i = 15; i < 20; i++)
781                                 sl1.Remove ("kala " + i);
782                         for (int i = 45; i < 55; i++)
783                                 sl1.Remove ("kala " + i);
784
785                         Assert.AreEqual (40, sl1.Count, "#D1");
786                         for (int i = 45; i < 55; i++)
787                                 Assert.IsNull (sl1 ["kala " + i], "#D2:" + i);
788                 }
789
790                 [Test]
791                 public void TestRemoveAt ()
792                 {
793                         SortedList sl1 = new SortedList (24);
794                         int k;
795
796                         for (int i = 0; i < 50; i++) {
797                                 string s = string.Format ("{0:D2}", i);
798                                 sl1.Add ("kala " + s, i);
799                         }
800
801                         try {
802                                 sl1.RemoveAt (-1);
803                                 Assert.Fail ("#A");
804                         } catch (ArgumentOutOfRangeException) {
805                         }
806
807                         try {
808                                 sl1.RemoveAt (100);
809                                 Assert.Fail ("#B");
810                         } catch (ArgumentOutOfRangeException) {
811                         }
812
813                         k = sl1.Count;
814
815                         for (int i = 0; i < 20; i++)
816                                 sl1.RemoveAt (9);
817
818                         Assert.AreEqual (30, sl1.Count, 30, "#C1");
819                         for (int i = 0; i < 9; i++)
820                                 Assert.AreEqual (i, sl1 ["kala " + string.Format ("{0:D2}", i)], "#C2:" + i);
821                         for (int i = 9; i < 29; i++)
822                                 Assert.IsNull (sl1 ["kala " + string.Format ("{0:D2}", i)], "#C3:" + i);
823                         for (int i = 29; i < 50; i++)
824                                 Assert.AreEqual (i, sl1 ["kala " + string.Format ("{0:D2}", i)], "#C4:" + i);
825                 }
826
827                 [Test]
828                 public void TestSetByIndex ()
829                 {
830                         SortedList sl1 = new SortedList (24);
831                         for (int i = 49; i >= 0; i--) sl1.Add (100 + i, i);
832
833                         try {
834                                 sl1.SetByIndex (-1, 77);
835                                 Assert.Fail ("#A");
836                         } catch (ArgumentOutOfRangeException) {
837                         }
838
839                         try {
840                                 sl1.SetByIndex (100, 88);
841                                 Assert.Fail ("#B");
842                         } catch (ArgumentOutOfRangeException) {
843                         }
844
845                         for (int i = 5; i < 25; i++)
846                                 sl1.SetByIndex (i, -1);
847                         for (int i = 0; i < 5; i++)
848                                 Assert.AreEqual (i, sl1 [100 + i], "#C1");
849                         for (int i = 5; i < 25; i++)
850                                 Assert.AreEqual (-1, sl1 [100 + i], "#C2");
851                         for (int i = 25; i < 50; i++)
852                                 Assert.AreEqual (i, sl1 [100 + i], "#C3");
853                 }
854
855                 [Test]
856                 public void TestTrimToSize ()
857                 {
858                         SortedList sl1 = new SortedList (24);
859
860                         sl1.TrimToSize ();
861 #if !NET_2_0 // no such expectation as it is broken in .NET 2.0
862                         Assert.AreEqual (icap, sl1.Capacity, "#1");
863 #endif
864
865                         for (int i = 72; i >= 0; i--)
866                                 sl1.Add (100 + i, i);
867                         sl1.TrimToSize ();
868 #if !NET_2_0 // no such expectation as it is broken in .NET 2.0
869                         Assert.AreEqual (73, sl1.Capacity, "#2");
870 #endif
871                 }
872
873                 [Test]
874                 [Category ("TargetJvmNotWorking")]
875                 public void SerializeTest ()
876                 {
877                         SortedList sl1 = new SortedList ();
878                         sl1.Add (5, "A");
879                         sl1.Add (0, "B");
880                         sl1.Add (7, "C");
881
882 #if TARGET_JVM
883                         BinaryFormatter bf = (BinaryFormatter)vmw.@internal.remoting.BinaryFormatterUtils.CreateBinaryFormatter (false);
884 #else
885                         BinaryFormatter bf = new BinaryFormatter ();
886 #endif // TARGET_JVM
887                         bf.AssemblyFormat = FormatterAssemblyStyle.Full;
888                         MemoryStream ms = new MemoryStream ();
889                         bf.Serialize (ms, sl1);
890                         ms.Position = 0;
891
892                         SortedList sl2 = (SortedList) bf.Deserialize (ms);
893                         Assert.IsNotNull (sl2, "#1");
894                         Assert.AreEqual (3, sl2.Count, "#2");
895                         Assert.AreEqual (sl1 [0], sl2 [0], "#3");
896                         Assert.AreEqual (sl1 [1], sl2 [1], "#4");
897                         Assert.AreEqual (sl1 [2], sl2 [2], "#5");
898                 }
899
900                 [Test]
901                 [Category ("TargetJvmNotWorking")]
902                 public void Keys_Serialize ()
903                 {
904                         SortedList sl = new SortedList ();
905                         sl.Add (5, "A");
906                         sl.Add (0, "B");
907                         sl.Add (7, "C");
908
909                         IList keys1 = (IList) sl.Keys;
910 #if TARGET_JVM
911                         BinaryFormatter bf = (BinaryFormatter)vmw.@internal.remoting.BinaryFormatterUtils.CreateBinaryFormatter (false);
912 #else
913                         BinaryFormatter bf = new BinaryFormatter ();
914 #endif // TARGET_JVM
915                         bf.AssemblyFormat = FormatterAssemblyStyle.Full;
916                         MemoryStream ms = new MemoryStream ();
917                         bf.Serialize (ms, keys1);
918                         ms.Position = 0;
919
920                         IList keys2 = (IList) bf.Deserialize (ms);
921                         Assert.IsNotNull (keys2, "#1");
922                         Assert.AreEqual (3, keys2.Count, "#2");
923                         Assert.AreEqual (keys1 [0], keys2 [0], "#3");
924                         Assert.AreEqual (keys1 [1], keys2 [1], "#4");
925                         Assert.AreEqual (keys1 [2], keys2 [2], "#5");
926                 }
927
928                 [Test]
929                 [Category ("TargetJvmNotWorking")]
930                 public void Values_Serialize ()
931                 {
932                         SortedList sl = new SortedList ();
933                         sl.Add (5, "A");
934                         sl.Add (0, "B");
935                         sl.Add (7, "C");
936
937                         IList values1 = (IList) sl.Values;
938 #if TARGET_JVM
939                         BinaryFormatter bf = (BinaryFormatter)vmw.@internal.remoting.BinaryFormatterUtils.CreateBinaryFormatter (false);
940 #else
941                         BinaryFormatter bf = new BinaryFormatter ();
942 #endif // TARGET_JVM
943                         bf.AssemblyFormat = FormatterAssemblyStyle.Full;
944                         MemoryStream ms = new MemoryStream ();
945                         bf.Serialize (ms, values1);
946                         ms.Position = 0;
947
948                         IList values2 = (IList) bf.Deserialize (ms);
949                         Assert.IsNotNull (values2, "#1");
950                         Assert.AreEqual (3, values2.Count, "#2");
951                         Assert.AreEqual (values1 [0], values2 [0], "#3");
952                         Assert.AreEqual (values1 [1], values2 [1], "#4");
953                         Assert.AreEqual (values1 [2], values2 [2], "#5");
954                 }
955
956                 [Test]
957                 [Category ("NotWorking")]
958                 public void Values_Deserialize ()
959                 {
960 #if TARGET_JVM
961                         BinaryFormatter bf = (BinaryFormatter)vmw.@internal.remoting.BinaryFormatterUtils.CreateBinaryFormatter (false);
962 #else
963                         BinaryFormatter bf = new BinaryFormatter ();
964 #endif // TARGET_JVM
965
966                         MemoryStream ms = new MemoryStream ();
967                         ms.Write (_serializedValues, 0, _serializedValues.Length);
968                         ms.Position = 0;
969
970                         IList values = (IList) bf.Deserialize (ms);
971                         Assert.AreEqual (3, values.Count, "#1");
972                         Assert.AreEqual ("B", values [0], "#2");
973                         Assert.AreEqual ("A", values [1], "#3");
974                         Assert.AreEqual ("C", values [2], "#4");
975                 }
976
977                 [Test]
978                 [ExpectedException (typeof (InvalidOperationException))]
979                 public void SetIdenticalObjectException ()
980                 {
981                         // Even though the key/value pair being set are identical to
982                         // the existing one, it causes snapshot out of sync.
983                         SortedList sl = new SortedList ();
984                         sl ["foo"] = "bar";
985                         foreach (string s in sl.Keys)
986                                 sl ["foo"] = "bar";
987                 }
988
989                 [Test]
990                 public void Ctor_IComparer ()
991                 {
992                         SortedList sl = new SortedList (new SortedListComparer ());
993                         sl.Add (new object (), new object ());
994                 }
995
996                 [Test]
997                 public void Ctor_IComparer_Null ()
998                 {
999                         SortedList sl = new SortedList ((IComparer) null);
1000                         sl.Add (new object (), new object ());
1001                 }
1002
1003                 [Test]
1004                 public void Ctor_IDictionary_IComparer_Before ()
1005                 {
1006                         Hashtable ht = new Hashtable ();
1007                         ht.Add (2, "a");
1008                         ht.Add (1, "b");
1009                         // adding a non-IComparable in Hashtable
1010                         ht.Add (new object (), "c");
1011                         SortedList sl = new SortedList (ht, new SortedListComparer ());
1012                         Assert.AreEqual (3, sl.Count);
1013                 }
1014
1015                 [Test]
1016                 [ExpectedException (typeof (InvalidOperationException))]
1017                 public void Ctor_IDictionary_DefaultInvariant_Before ()
1018                 {
1019                         Hashtable ht = new Hashtable ();
1020                         ht.Add (2, "a");
1021                         ht.Add (1, "b");
1022                         // adding a non-IComparable in Hashtable
1023                         ht.Add (new object (), "c");
1024                         SortedList sl = new SortedList (ht, Comparer.DefaultInvariant);
1025                         Assert.AreEqual (3, sl.Count);
1026                 }
1027
1028                 [Test]
1029                 public void Ctor_IDictionary_IComparer_Null_Before_1item ()
1030                 {
1031                         Hashtable ht = new Hashtable ();
1032                         // adding a non-IComparable in Hashtable
1033                         ht.Add (new object (), "c");
1034                         SortedList sl = new SortedList (ht, null);
1035                         Assert.AreEqual (1, sl.Count);
1036                 }
1037
1038                 [Test]
1039                 [ExpectedException (typeof (InvalidOperationException))]
1040                 public void Ctor_IDictionary_IComparer_Null_Before_2items ()
1041                 {
1042                         Hashtable ht = new Hashtable ();
1043                         ht.Add (2, "a");
1044                         // adding a non-IComparable in Hashtable
1045                         ht.Add (new object (), "c");
1046                         SortedList sl = new SortedList (ht, null);
1047                         Assert.AreEqual (2, sl.Count);
1048                 }
1049
1050                 [Test]
1051                 public void Ctor_IDictionary_IComparer_After ()
1052                 {
1053                         Hashtable ht = new Hashtable ();
1054                         ht.Add (2, "a");
1055                         ht.Add (1, "b");
1056                         SortedList sl = new SortedList (ht, new SortedListComparer ());
1057                         Assert.AreEqual (2, sl.Count);
1058                         // adding a non-IComparable in SortedList
1059                         sl.Add (new object (), "c");
1060                 }
1061
1062                 [Test]
1063                 [ExpectedException (typeof (InvalidOperationException))]
1064                 public void Ctor_IDictionary_DefaultInvariant_After ()
1065                 {
1066                         Hashtable ht = new Hashtable ();
1067                         ht.Add (2, "a");
1068                         ht.Add (1, "b");
1069                         SortedList sl = new SortedList (ht, Comparer.DefaultInvariant);
1070                         Assert.AreEqual (2, sl.Count);
1071                         // adding a non-IComparable in SortedList
1072                         sl.Add (new object (), "c");
1073                 }
1074
1075                 [Test]
1076                 public void Ctor_IDictionary_IComparer_Null_After_1item ()
1077                 {
1078                         SortedList sl = new SortedList (new Hashtable (), null);
1079                         sl.Add (new object (), "b");
1080                 }
1081
1082                 [Test]
1083                 [ExpectedException (typeof (InvalidOperationException))]
1084                 public void Ctor_IDictionary_IComparer_Null_After_2items ()
1085                 {
1086                         SortedList sl = new SortedList (new Hashtable (), null);
1087                         sl.Add (2, "a");
1088                         sl.Add (new object (), "b");
1089                 }
1090
1091                 [Test]
1092                 public void IComparer_Clone ()
1093                 {
1094                         SortedList sl = new SortedList (new SortedListComparer ());
1095                         sl.Add (new object (), new object ());
1096                         SortedList clone = (SortedList) sl.Clone ();
1097                 }
1098
1099                 [Test]
1100                 public void IComparer_Null_Clone ()
1101                 {
1102                         SortedList sl = new SortedList ((IComparer) null);
1103                         sl.Add (new object (), new object ());
1104                         SortedList clone = (SortedList) sl.Clone ();
1105                 }
1106
1107                 sealed class StartsWithComparator : IComparer {
1108                         public static readonly StartsWithComparator Instance = new StartsWithComparator();
1109
1110                         public int Compare(object p, object w)
1111                         {
1112                                 string part = (string) p;
1113                                 string whole = (string) w;
1114                                 // let the default string comparer deal with null or when part is not smaller then whole
1115                                 if (part == null || whole == null || part.Length >= whole.Length)
1116                                         return String.Compare (part, whole);
1117
1118                                 // loop through all characters that part and whole have in common
1119                                 int pos = 0;
1120                                 bool match;
1121                                 do {
1122                                         match = (part[pos] == whole[pos]);
1123                                 } while (match && ++pos < part.Length);
1124
1125                                 // return result of last comparison
1126                                 return match ? 0 : (part[pos] < whole[pos] ? -1 : 1);
1127                         }
1128                 }
1129
1130                 sealed class StartsWithComparatorPartWholeCheck : IComparer
1131                 {
1132                         public static readonly StartsWithComparator Instance = new StartsWithComparator();
1133
1134                         public int Compare(object p, object w)
1135                         {
1136                                 string part = (string) p;
1137                                 string whole = (string) w;
1138                                 Assert.IsTrue(part == "Part", "#PWC0");
1139                                 Assert.IsTrue(whole == "Whole", "#PWC1");
1140
1141                                 // let the default string comparer deal with null or when part is not smaller then whole
1142                                 if (part == null || whole == null || part.Length >= whole.Length)
1143                                         return String.Compare(part, whole);
1144
1145                                 // loop through all characters that part and whole have in common
1146                                 int pos = 0;
1147                                 bool match;
1148                                 do {
1149                                         match = (part[pos] == whole[pos]);
1150                                 } while (match && ++pos < part.Length);
1151
1152                                 // return result of last comparison
1153                                 return match ? 0 : (part[pos] < whole[pos] ? -1 : 1);
1154                         }
1155                 }
1156
1157                 [Test]
1158                 public void ComparatorUsageTest()
1159                 {
1160                         SortedList sl = new SortedList(StartsWithComparator.Instance);
1161
1162                         sl.Add("Apples", "Value-Apples");
1163                         sl.Add("Bananas", "Value-Bananas");
1164                         sl.Add("Oranges", "Value-Oranges");
1165
1166                         // Ensure 3 objects exist in the collection
1167                         Assert.IsTrue(sl.Count == 3, "Count");
1168
1169                         // Complete Match Test Set
1170                         Assert.IsTrue(sl.ContainsKey("Apples"), "#A0");
1171                         Assert.IsTrue(sl.ContainsKey("Bananas"), "#A1");
1172                         Assert.IsTrue(sl.ContainsKey("Oranges"), "#A2");
1173
1174                         // Partial Match Test Set
1175                         Assert.IsTrue(sl.ContainsKey("Apples are great fruit!"), "#B0");
1176                         Assert.IsTrue(sl.ContainsKey("Bananas are better fruit."), "#B1");
1177                         Assert.IsTrue(sl.ContainsKey("Oranges are fun to peel."), "#B2");
1178
1179                         // Reversed Match Test Set
1180                         Assert.IsFalse(sl.ContainsKey("Value"), "#C0");
1181
1182                         // No match tests
1183                         Assert.IsFalse(sl.ContainsKey("I forgot to bring my bananas."), "#D0");
1184                         Assert.IsFalse(sl.ContainsKey("My apples are on vacation."), "#D0");
1185                         Assert.IsFalse(sl.ContainsKey("The oranges are not ripe yet."), "#D0");
1186
1187                 }
1188
1189                 [Test]
1190                 public void ComparatorPartWholeCheck()
1191                 {
1192                         SortedList sl = new SortedList (StartsWithComparatorPartWholeCheck.Instance);
1193                         sl.Add("Part", "Value-Part");
1194                         Assert.IsFalse(sl.ContainsKey("Whole"), "#PWC2");
1195                 }
1196
1197                 [Test]
1198                 public void NonComparatorStringCheck()
1199                 {
1200                         SortedList sl = new SortedList ();
1201
1202                         sl.Add("Oranges", "Value-Oranges");
1203                         sl.Add("Apples", "Value-Apples");
1204                         sl.Add("Bananas", "Value-Bananas");
1205
1206                         int i = 0;
1207                         Assert.IsTrue(sl.Count == 3, "NCSC #A0");
1208
1209                         Assert.IsTrue(sl.ContainsKey("Apples"), "NCSC #B1");
1210                         Assert.IsTrue(sl.ContainsKey("Bananas"), "NCSC #B2");
1211                         Assert.IsTrue(sl.ContainsKey("Oranges"), "NCSC #B3");
1212
1213                         Assert.IsFalse(sl.ContainsKey("XApples"), "NCSC #C1");
1214                         Assert.IsFalse(sl.ContainsKey("XBananas"), "NCSC #C2");
1215                         Assert.IsFalse(sl.ContainsKey("XOranges"), "NCSC #C3");
1216
1217                         string [] keys = new string [sl.Keys.Count];
1218                         sl.Keys.CopyTo (keys, 0);
1219                         Assert.IsTrue(keys [0] == "Apples", "NCSC #D1");
1220                         Assert.IsTrue(keys [1] == "Bananas", "NCSC #D2");
1221                         Assert.IsTrue(keys [2] == "Oranges", "NCSC #D3");
1222                 }
1223
1224                 private static byte [] _serializedValues = new byte [] {
1225                         0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
1226                         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
1227                         0x01, 0x00, 0x00, 0x00, 0x27, 0x53, 0x79, 0x73, 0x74,
1228                         0x65, 0x6d, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63,
1229                         0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x6f, 0x72,
1230                         0x74, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x2b, 0x56,
1231                         0x61, 0x6c, 0x75, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x01,
1232                         0x00, 0x00, 0x00, 0x0a, 0x73, 0x6f, 0x72, 0x74, 0x65,
1233                         0x64, 0x4c, 0x69, 0x73, 0x74, 0x03, 0x1d, 0x53, 0x79,
1234                         0x73, 0x74, 0x65, 0x6d, 0x2e, 0x43, 0x6f, 0x6c, 0x6c,
1235                         0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53,
1236                         0x6f, 0x72, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74,
1237                         0x09, 0x02, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00,
1238                         0x00, 0x1d, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e,
1239                         0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f,
1240                         0x6e, 0x73, 0x2e, 0x53, 0x6f, 0x72, 0x74, 0x65, 0x64,
1241                         0x4c, 0x69, 0x73, 0x74, 0x07, 0x00, 0x00, 0x00, 0x04,
1242                         0x6b, 0x65, 0x79, 0x73, 0x06, 0x76, 0x61, 0x6c, 0x75,
1243                         0x65, 0x73, 0x05, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x07,
1244                         0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x08, 0x63,
1245                         0x6f, 0x6d, 0x70, 0x61, 0x72, 0x65, 0x72, 0x07, 0x6b,
1246                         0x65, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x09, 0x76, 0x61,
1247                         0x6c, 0x75, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x05, 0x05,
1248                         0x00, 0x00, 0x03, 0x03, 0x03, 0x08, 0x08, 0x1b, 0x53,
1249                         0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x43, 0x6f, 0x6c,
1250                         0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
1251                         0x43, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x65, 0x72, 0x25,
1252                         0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x43, 0x6f,
1253                         0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
1254                         0x2e, 0x53, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x4c, 0x69,
1255                         0x73, 0x74, 0x2b, 0x4b, 0x65, 0x79, 0x4c, 0x69, 0x73,
1256                         0x74, 0x27, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e,
1257                         0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f,
1258                         0x6e, 0x73, 0x2e, 0x53, 0x6f, 0x72, 0x74, 0x65, 0x64,
1259                         0x4c, 0x69, 0x73, 0x74, 0x2b, 0x56, 0x61, 0x6c, 0x75,
1260                         0x65, 0x4c, 0x69, 0x73, 0x74, 0x09, 0x03, 0x00, 0x00,
1261                         0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
1262                         0x00, 0x03, 0x00, 0x00, 0x00, 0x09, 0x05, 0x00, 0x00,
1263                         0x00, 0x0a, 0x09, 0x01, 0x00, 0x00, 0x00, 0x10, 0x03,
1264                         0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x08,
1265                         0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x05, 0x00, 0x00,
1266                         0x00, 0x08, 0x08, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x0d,
1267                         0x10, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
1268                         0x06, 0x07, 0x00, 0x00, 0x00, 0x01, 0x42, 0x06, 0x08,
1269                         0x00, 0x00, 0x00, 0x01, 0x41, 0x06, 0x09, 0x00, 0x00,
1270                         0x00, 0x01, 0x43, 0x0d, 0x0d, 0x04, 0x05, 0x00, 0x00,
1271                         0x00, 0x1b, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e,
1272                         0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f,
1273                         0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x72,
1274                         0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x0b };
1275         }
1276 }