mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 12:30:32 +00:00
Basic test harness
This commit is contained in:
parent
1b182f0cf2
commit
cc4f82c95a
9 changed files with 259 additions and 2 deletions
|
|
@ -79,9 +79,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoitoiusTest", "MoitoiusTes
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JoelBTest", "JoelBTest\JoelBTest.csproj", "{AEC28E7E-1ABB-4ABC-8CE1-B74D9DC9B80E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestSuite", "TestSuite", "{7EB6E2FF-74C8-4F59-9923-EB8EF1DE098E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestKernel", "TestKernel\TestKernel.csproj", "{8F2D5231-CDE5-48FA-9D26-D4305B01FD3C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(TeamFoundationVersionControl) = preSolution
|
||||
SccNumberOfProjects = 33
|
||||
SccNumberOfProjects = 34
|
||||
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
|
||||
SccTeamFoundationServer = https://tfs04.codeplex.com/
|
||||
SccLocalPath0 = .
|
||||
|
|
@ -213,6 +217,10 @@ Global
|
|||
SccProjectTopLevelParentUniqueName32 = Cosmos.sln
|
||||
SccProjectName32 = Cosmos.Build.Tasks
|
||||
SccLocalPath32 = Cosmos.Build.Tasks
|
||||
SccProjectUniqueName33 = TestKernel\\TestKernel.csproj
|
||||
SccProjectTopLevelParentUniqueName33 = Cosmos.sln
|
||||
SccProjectName33 = TestKernel
|
||||
SccLocalPath33 = TestKernel
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -344,6 +352,10 @@ Global
|
|||
{AEC28E7E-1ABB-4ABC-8CE1-B74D9DC9B80E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AEC28E7E-1ABB-4ABC-8CE1-B74D9DC9B80E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AEC28E7E-1ABB-4ABC-8CE1-B74D9DC9B80E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8F2D5231-CDE5-48FA-9D26-D4305B01FD3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8F2D5231-CDE5-48FA-9D26-D4305B01FD3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8F2D5231-CDE5-48FA-9D26-D4305B01FD3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8F2D5231-CDE5-48FA-9D26-D4305B01FD3C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -383,5 +395,7 @@ Global
|
|||
{605F8D53-66FA-4BEC-844E-F63209B855C9} = {EBF602FE-8AFC-408D-A9F1-560C35651090}
|
||||
{B69B89D4-54FC-41DF-B5D7-EE674CF60343} = {EBF602FE-8AFC-408D-A9F1-560C35651090}
|
||||
{AEC28E7E-1ABB-4ABC-8CE1-B74D9DC9B80E} = {EBF602FE-8AFC-408D-A9F1-560C35651090}
|
||||
{7EB6E2FF-74C8-4F59-9923-EB8EF1DE098E} = {EBF602FE-8AFC-408D-A9F1-560C35651090}
|
||||
{8F2D5231-CDE5-48FA-9D26-D4305B01FD3C} = {7EB6E2FF-74C8-4F59-9923-EB8EF1DE098E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ namespace Indy.IL2CPU.IL.X86 {
|
|||
}
|
||||
|
||||
public static void Assemble(CPU.Assembler aAssembler, int aElementSize) {
|
||||
new CPUx86.Call("_CODE_REQUESTED_BREAK_");
|
||||
aAssembler.StackContents.Pop();
|
||||
aAssembler.StackContents.Pop();
|
||||
aAssembler.StackContents.Push(new StackContent(4, typeof(uint)));
|
||||
|
|
|
|||
26
source/TestKernel/Attributes.cs
Normal file
26
source/TestKernel/Attributes.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace TestKernel {
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class TestAttribute: Attribute {
|
||||
public TestAttribute() {
|
||||
}
|
||||
|
||||
public string TestGroup {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string Description {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool IsExperimental {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
64
source/TestKernel/Program.cs
Normal file
64
source/TestKernel/Program.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Cosmos.Build.Windows;
|
||||
|
||||
namespace TestKernel {
|
||||
class Program {
|
||||
[STAThread]
|
||||
public static void Main(string[] aArgs) {
|
||||
if (aArgs.Length == 0) {
|
||||
var xBuilder = new Builder();
|
||||
xBuilder.Build();
|
||||
} else {
|
||||
List<KeyValuePair<string, TestAttribute>> xTests = new List<KeyValuePair<string, TestAttribute>>();
|
||||
#region detect all current tests
|
||||
foreach (var xType in typeof(Program).Assembly.GetTypes()) {
|
||||
foreach (var xMethod in xType.GetMethods()) {
|
||||
var xAttrib = xMethod.GetCustomAttributes(typeof(TestAttribute), true).FirstOrDefault() as TestAttribute;
|
||||
if (xAttrib != null) {
|
||||
xTests.Add(new KeyValuePair<string, TestAttribute>(xType.FullName.Replace('+', '.') + "." + xMethod.Name, xAttrib));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
Console.WriteLine("public static void Init() {");
|
||||
Console.WriteLine("string xTestResult=null;");
|
||||
foreach (var xTest in (from item in xTests
|
||||
where item.Value.TestGroup == aArgs[0] && ((!item.Value.IsExperimental) || ((aArgs.Length > 1) && (aArgs[1] == "-experimental")))
|
||||
select item)) {
|
||||
Console.WriteLine("Console.WriteLine(\"Running test '{0}'\");", xTest.Value.Description);
|
||||
Console.WriteLine("xTestResult = {0}();", xTest.Key);
|
||||
Console.WriteLine("Console.Write(\" \");");
|
||||
Console.WriteLine("if (xTestResult == null) {");
|
||||
Console.WriteLine("Console.WriteLine(\"Success\");");
|
||||
Console.WriteLine("} else {");
|
||||
Console.WriteLine("Console.Write(\"Error: \");");
|
||||
Console.WriteLine("Console.WriteLine(xTestResult);}");
|
||||
}
|
||||
|
||||
Console.WriteLine("Console.WriteLine(\"All tests executed!\");");
|
||||
Console.WriteLine("while (true)");
|
||||
Console.WriteLine(";");
|
||||
Console.WriteLine("}");
|
||||
}
|
||||
}
|
||||
|
||||
public static void Init() {
|
||||
string xTestResult = null;
|
||||
Console.WriteLine("Running test 'System.String_EmbeddedStringContents'");
|
||||
xTestResult = TestKernel.Tests.NoInit.StringTests.TestEmbedded();
|
||||
Console.Write(" ");
|
||||
if (xTestResult == null) {
|
||||
Console.WriteLine("Success");
|
||||
} else {
|
||||
Console.Write("Error: ");
|
||||
Console.WriteLine(xTestResult);
|
||||
}
|
||||
Console.WriteLine("All tests executed!");
|
||||
while (true)
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
source/TestKernel/Properties/AssemblyInfo.cs
Normal file
36
source/TestKernel/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TestKernel")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TestKernel")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("afb65b51-4aa0-407c-9c36-42fe4c90ef63")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
9
source/TestKernel/TestGroups.cs
Normal file
9
source/TestKernel/TestGroups.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace TestKernel {
|
||||
public static class TestGroups {
|
||||
public const string NoInit = "NoInit";
|
||||
}
|
||||
}
|
||||
72
source/TestKernel/TestKernel.csproj
Normal file
72
source/TestKernel/TestKernel.csproj
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{8F2D5231-CDE5-48FA-9D26-D4305B01FD3C}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TestKernel</RootNamespace>
|
||||
<AssemblyName>TestKernel</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Attributes.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestGroups.cs" />
|
||||
<Compile Include="Tests\NoInit\StringTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Cosmos.Build.Windows\Cosmos.Build.Windows.csproj">
|
||||
<Project>{1F0EDE86-F6D4-4355-9A97-10E90457770C}</Project>
|
||||
<Name>Cosmos.Build.Windows</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
10
source/TestKernel/TestKernel.csproj.vspscc
Normal file
10
source/TestKernel/TestKernel.csproj.vspscc
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
27
source/TestKernel/Tests/NoInit/StringTests.cs
Normal file
27
source/TestKernel/Tests/NoInit/StringTests.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace TestKernel.Tests.NoInit {
|
||||
public static class StringTests {
|
||||
[Test(TestGroup=TestGroups.NoInit, Description="System.String_EmbeddedStringContents", IsExperimental=false)]
|
||||
public static string TestEmbedded() {
|
||||
string MyString = "Hello";
|
||||
if (MyString == null)
|
||||
return "MyString is null";
|
||||
if (MyString.Length != 5)
|
||||
return "MyString Length is not 5";
|
||||
if (MyString[0] != 'H')
|
||||
return "MyString[0] != 'H'";
|
||||
if (MyString[1] != 'e')
|
||||
return "MyString[1] != 'e'";
|
||||
if (MyString[2] != 'l')
|
||||
return "MyString[2] != 'l'";
|
||||
if (MyString[3] != 'l')
|
||||
return "MyString[3] != 'l'";
|
||||
if (MyString[4] != 'o')
|
||||
return "MyString[4] != 'o'";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue