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