|
| 1 | +// |
| 2 | +// Copyright (c) .NET Foundation and Contributors |
| 3 | +// Portions Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 | +// See LICENSE file in the project root for full license information. |
| 5 | +// |
| 6 | + |
| 7 | +using nanoFramework.TestFramework; |
| 8 | +using System; |
| 9 | + |
| 10 | +namespace NFUnitTestTypes |
| 11 | +{ |
| 12 | + [TestClass] |
| 13 | + class UnitTestTypes |
| 14 | + { |
| 15 | + [TestMethod] |
| 16 | + public void TypeTestsArrays_00() |
| 17 | + { |
| 18 | + ushort[] array = new ushort[10]; |
| 19 | + var ushortArrayType = array.GetType(); |
| 20 | + Assert.AreEqual(ushortArrayType.FullName, "System.UInt16[]"); |
| 21 | + |
| 22 | + short[] array2 = new short[10]; |
| 23 | + var shortArrayType = array2.GetType(); |
| 24 | + Assert.AreEqual(shortArrayType.FullName, "System.Int16[]"); |
| 25 | + |
| 26 | + int[] array3 = new int[10]; |
| 27 | + var intArrayType = array3.GetType(); |
| 28 | + Assert.AreEqual(intArrayType.FullName, "System.Int32[]"); |
| 29 | + |
| 30 | + uint[] array4 = new uint[10]; |
| 31 | + var uintArrayType = array4.GetType(); |
| 32 | + Assert.AreEqual(uintArrayType.FullName, "System.UInt32[]"); |
| 33 | + |
| 34 | + ulong[] array5 = new ulong[10]; |
| 35 | + var ulongArrayType = array5.GetType(); |
| 36 | + Assert.AreEqual(ulongArrayType.FullName, "System.UInt64[]"); |
| 37 | + |
| 38 | + long[] array6 = new long[10]; |
| 39 | + var longArrayType = array6.GetType(); |
| 40 | + Assert.AreEqual(longArrayType.FullName, "System.Int64[]"); |
| 41 | + |
| 42 | + float[] array7 = new float[10]; |
| 43 | + var floatArrayType = array7.GetType(); |
| 44 | + Assert.AreEqual(floatArrayType.FullName, "System.Single[]"); |
| 45 | + |
| 46 | + double[] array8 = new double[10]; |
| 47 | + var doubleArrayType = array8.GetType(); |
| 48 | + Assert.AreEqual(doubleArrayType.FullName, "System.Double[]"); |
| 49 | + } |
| 50 | + |
| 51 | + [TestMethod] |
| 52 | + public void TypeTestsArrays_01() |
| 53 | + { |
| 54 | + Assert.AreEqual(typeof(short[]).FullName, "System.Int16[]"); |
| 55 | + Assert.AreEqual(typeof(ushort[]).FullName, "System.UInt16[]"); |
| 56 | + Assert.AreEqual(typeof(int[]).FullName, "System.Int32[]"); |
| 57 | + Assert.AreEqual(typeof(uint[]).FullName, "System.UInt32[]"); |
| 58 | + Assert.AreEqual(typeof(long[]).FullName, "System.Int64[]"); |
| 59 | + Assert.AreEqual(typeof(ulong[]).FullName, "System.UInt64[]"); |
| 60 | + Assert.AreEqual(typeof(float[]).FullName, "System.Single[]"); |
| 61 | + Assert.AreEqual(typeof(double[]).FullName, "System.Double[]"); |
| 62 | + Assert.AreEqual(typeof(char[]).FullName, "System.Char[]"); |
| 63 | + Assert.AreEqual(typeof(byte[]).FullName, "System.Byte[]"); |
| 64 | + Assert.AreEqual(typeof(sbyte[]).FullName, "System.SByte[]"); |
| 65 | + Assert.AreEqual(typeof(bool[]).FullName, "System.Boolean[]"); |
| 66 | + Assert.AreEqual(typeof(string[]).FullName, "System.String[]"); |
| 67 | + Assert.AreEqual(typeof(object[]).FullName, "System.Object[]"); |
| 68 | + } |
| 69 | + |
| 70 | + [TestMethod] |
| 71 | + public void TypeTestsBaseTypes() |
| 72 | + { |
| 73 | + Assert.AreEqual(typeof(short).FullName, "System.Int16"); |
| 74 | + Assert.AreEqual(typeof(ushort).FullName, "System.UInt16"); |
| 75 | + Assert.AreEqual(typeof(int).FullName, "System.Int32"); |
| 76 | + Assert.AreEqual(typeof(uint).FullName, "System.UInt32"); |
| 77 | + Assert.AreEqual(typeof(long).FullName, "System.Int64"); |
| 78 | + Assert.AreEqual(typeof(ulong).FullName, "System.UInt64"); |
| 79 | + Assert.AreEqual(typeof(float).FullName, "System.Single"); |
| 80 | + Assert.AreEqual(typeof(double).FullName, "System.Double"); |
| 81 | + Assert.AreEqual(typeof(char).FullName, "System.Char"); |
| 82 | + Assert.AreEqual(typeof(byte).FullName, "System.Byte"); |
| 83 | + Assert.AreEqual(typeof(sbyte).FullName, "System.SByte"); |
| 84 | + Assert.AreEqual(typeof(bool).FullName, "System.Boolean"); |
| 85 | + Assert.AreEqual(typeof(string).FullName, "System.String"); |
| 86 | + Assert.AreEqual(typeof(object).FullName, "System.Object"); |
| 87 | + } |
| 88 | + } |
| 89 | +} |
0 commit comments