mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-21 13:28:41 +00:00
Added tests for System.BitConverter
This commit is contained in:
parent
6608dd88a5
commit
e3db6c576e
6 changed files with 43 additions and 12 deletions
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{DA1DFD9E-B80C-4304-BCBA-B313255F6B01}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
|
|
@ -68,6 +68,7 @@
|
|||
<Compile Include="Shell\Prompt.cs" />
|
||||
<Compile Include="Shell\Session.cs" />
|
||||
<Compile Include="Test\BinaryHelperTest.cs" />
|
||||
<Compile Include="Test\BitConverterTest.cs" />
|
||||
<Compile Include="Test\BoolTest.cs" />
|
||||
<Compile Include="Test\ConsoleTest.cs" />
|
||||
<Compile Include="Test\DirectoryInfoTest.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();
|
||||
|
|
|
|||
26
source/FrodeTest/Test/BitConverterTest.cs
Normal file
26
source/FrodeTest/Test/BitConverterTest.cs
Normal file
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue