PageRenderTime 53ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/mcs/class/corlib/Test/System.Collections/SortedListTest.cs

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