diff --git a/source/FrodeTest/FrodeTest.csproj b/source/FrodeTest/FrodeTest.csproj index 8e06950b3..f32776bf7 100644 --- a/source/FrodeTest/FrodeTest.csproj +++ b/source/FrodeTest/FrodeTest.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 9.0.30729 + 9.0.21022 2.0 {DA1DFD9E-B80C-4304-BCBA-B313255F6B01} Exe @@ -68,6 +68,7 @@ + diff --git a/source/FrodeTest/Program.cs b/source/FrodeTest/Program.cs index e99d758c8..ba7989521 100644 --- a/source/FrodeTest/Program.cs +++ b/source/FrodeTest/Program.cs @@ -45,16 +45,17 @@ namespace FrodeTest //TEST FRAMEWORK Console.WriteLine("---- RUNNING PREDEFINED TESTS ----"); - Test.ConsoleTest.RunTest(); - Test.StringTest.RunTest(); + //Test.ConsoleTest.RunTest(); + //Test.StringTest.RunTest(); //Test.IPv4AddressTest.RunTest(); //Test.BasicTest.RunTest(); //Test.SwitchTest.RunTest(); //Console.ReadLine(); - Test.BoolTest.RunTest(); - Test.InterfaceTest.RunTest(); - Test.ExtensionMethodsTest.RunTest(); + //Test.BoolTest.RunTest(); + //Test.InterfaceTest.RunTest(); + //Test.ExtensionMethodsTest.RunTest(); //Test.BinaryHelperTest.RunTest(); + Test.BitConverterTest.RunTest(); //Test.TransmitStatusDescriptorTest.RunTest(); //Test.PacketHeaderTest.RunTest(); //Test.RAMBusTest.RunTest(); diff --git a/source/FrodeTest/Test/BitConverterTest.cs b/source/FrodeTest/Test/BitConverterTest.cs new file mode 100644 index 000000000..f1261f46b --- /dev/null +++ b/source/FrodeTest/Test/BitConverterTest.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace FrodeTest.Test +{ + class BitConverterTest + { + public static void RunTest() + { + Check.Text = "BitConverter.DoubleToInt64Bits"; + Check.Validate(BitConverter.DoubleToInt64Bits(123456.78) == 4683220298531686318); + Check.Text = "BitConverter.GetBytes(char)"; + Check.Validate(BitConverter.GetBytes('a')[0] == 97); + Check.Text = "BitConverter.ToBoolean"; + Check.Validate(BitConverter.ToBoolean(new byte[] { 1 }, 0) == true); + Check.Validate(BitConverter.ToBoolean(new byte[] { 0 }, 0) == false); + Check.Text = "BitConverter.ToString()"; + Check.Validate(BitConverter.ToString(new byte[] {1, 2, 3}).Equals("01-02-03")); + Check.Text = "BitConverter.ToUInt32"; + Check.Validate(BitConverter.ToUInt32(new byte[] { 1, 1, 0, 0 }, 0) == 257); + + } + } +} diff --git a/source/FrodeTest/Test/ExceptionTest.cs b/source/FrodeTest/Test/ExceptionTest.cs index a091c555f..e878cd22a 100644 --- a/source/FrodeTest/Test/ExceptionTest.cs +++ b/source/FrodeTest/Test/ExceptionTest.cs @@ -13,11 +13,11 @@ namespace FrodeTest.Test { public static void RunTest() { - string[] strings = new string[2]; + var strings = new string[2]; strings[0] = "Hello"; strings[1] = "World"; - string result = strings[CauseException()]; //Kills Qemu + var result = strings[CauseException()]; //Kills Qemu //try { // ThrowStaticExceptionReturnVoid(); //OK} diff --git a/source/FrodeTest/Test/ExtensionMethodsTest.cs b/source/FrodeTest/Test/ExtensionMethodsTest.cs index 6eb3a5817..fadb1b105 100644 --- a/source/FrodeTest/Test/ExtensionMethodsTest.cs +++ b/source/FrodeTest/Test/ExtensionMethodsTest.cs @@ -9,10 +9,11 @@ namespace FrodeTest.Test { public static void RunTest() { - Console.WriteLine("Testing C# 3.0 Extension Methods"); + Console.WriteLine("-- Testing Extension methods --"); - Int32 number = 10; - Console.WriteLine("Trippling " + number + " gives " + number.Tripple()); + const int number = 10; + Check.Text = "Extension Method"; + Check.Validate(number.Tripple() == 30); } } diff --git a/source/FrodeTest/Test/LinqTest.cs b/source/FrodeTest/Test/LinqTest.cs index d0df2fc3c..087dff9a4 100644 --- a/source/FrodeTest/Test/LinqTest.cs +++ b/source/FrodeTest/Test/LinqTest.cs @@ -17,7 +17,9 @@ namespace FrodeTest.Test where word == "LinqWorks" select word); - Console.WriteLine(result.Last()); + //Console.WriteLine(result.Last()); + Check.Text = "Linq"; + Check.Validate(result.Last().Equals("LinqWorks")); } } } \ No newline at end of file