[mono-api-info] First filter, then order, and use ordinal comparison.
[mono-project.git] / mono / tests / binwritter.cs
blobc8adfcc181686d83aea3557254bde81fab74f9e2
1 using System;
2 using System.IO;
4 public class BinaryWrTest {
5 public static int Main () {
6 MemoryStream mr = new MemoryStream();
7 BinaryWriter wr = new BinaryWriter(mr);
9 wr.Write ((byte) 1);
10 wr.Write ((int) 1);
11 wr.Write ((int) -1);
13 byte [] arr = mr.ToArray();
15 Console.Write ("Array (should be: 1 1 0 0 0 ff ff ff ff): ");
17 for (int a = 0; a != arr.Length; a++)
18 Console.Write(arr[a].ToString("x") + " ");
20 Console.WriteLine();
22 if (arr.Length != 9)
23 return 4;
25 if (arr[0] != 1)
26 return 1;
28 if (arr[1] != 1 && arr[2] != 0 && arr[3] != 0 && arr[4] != 0)
29 return 2;
31 if (arr[5] != 0xff && arr[6] != 0xff && arr[7] != 0xff && arr[8] != 0xff)
32 return 3;
34 Console.WriteLine("test-ok");
36 return 0;