Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/CosmosOS/Cosmos.git
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbetros committed Mar 13, 2016
2 parents 0bef9a8 + c2566ed commit 8937b5c
Show file tree
Hide file tree
Showing 34 changed files with 899 additions and 48 deletions.
52 changes: 26 additions & 26 deletions Demos/Guess/Guess.Cosmos
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Profile>Bochs</Profile>
<Profile>VMware</Profile>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<Framework>MicrosoftNET</Framework>
<UseInternalAssembler>False</UseInternalAssembler>
<EnableGDB>False</EnableGDB>
<DebugMode>IL</DebugMode>
<DebugMode>Source</DebugMode>
<TraceMode>User</TraceMode>
<BuildTarget>PXE</BuildTarget>
<VMWareFlavor>Player</VMWareFlavor>
<StartCosmosGDB>False</StartCosmosGDB>
<VMwareEdition>Workstation</VMwareEdition>
<VMwareEdition>Player</VMwareEdition>
<VMwareDeploy>ISO</VMwareDeploy>
<IgnoreDebugStubAttribute>False</IgnoreDebugStubAttribute>
<Deployment>ISO</Deployment>
<Launch>Bochs</Launch>
<DebugEnabled>False</DebugEnabled>
<Launch>VMware</Launch>
<DebugEnabled>True</DebugEnabled>
<TraceAssemblies>All</TraceAssemblies>
<PXE_Deployment>PXE</PXE_Deployment>
<PXE_Launch>None</PXE_Launch>
Expand Down Expand Up @@ -62,13 +62,13 @@
<VMware_DebugEnabled>True</VMware_DebugEnabled>
<VMware_DebugMode>Source</VMware_DebugMode>
<VMware_IgnoreDebugStubAttribute>False</VMware_IgnoreDebugStubAttribute>
<VMware_VMwareEdition>Workstation</VMware_VMwareEdition>
<VMware_VMwareEdition>Player</VMware_VMwareEdition>
<VMware_OutputPath>bin\Debug\</VMware_OutputPath>
<VMware_Framework>MicrosoftNET</VMware_Framework>
<VMware_UseInternalAssembler>False</VMware_UseInternalAssembler>
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
<VMware_EnableGDB>True</VMware_EnableGDB>
<VMware_StartCosmosGDB>True</VMware_StartCosmosGDB>
<VMware_EnableGDB>False</VMware_EnableGDB>
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
<ISO_Deployment>ISO</ISO_Deployment>
<ISO_Launch>None</ISO_Launch>
<ISO_DebugEnabled>False</ISO_DebugEnabled>
Expand All @@ -82,7 +82,7 @@
<ISO_EnableGDB>False</ISO_EnableGDB>
<ISO_StartCosmosGDB>false</ISO_StartCosmosGDB>
<Name>Guess</Name>
<Description>Use Bochs emulator to deploy and debug.</Description>
<Description>Use VMware Player or Workstation to deploy and debug.</Description>
<ISO_Name>User 001</ISO_Name>
<ISO_Description>Creates a bootable ISO image which can be burned to a DVD. After running the selected project, an explorer window will open containing the ISO file. The ISO file can then be burned to a CD or DVD and used to boot a physical or virtual system.</ISO_Description>
<USB_Name>Guess</USB_Name>
Expand Down Expand Up @@ -129,8 +129,8 @@
<ISO_VisualStudioDebugPort>Pipe: Cosmos\Serial</ISO_VisualStudioDebugPort>
<PXE_ShowLaunchConsole>False</PXE_ShowLaunchConsole>
<PXE_VisualStudioDebugPort>Pipe: Cosmos\Serial</PXE_VisualStudioDebugPort>
<StackCorruptionDetectionEnabled>True</StackCorruptionDetectionEnabled>
<VMware_StackCorruptionDetectionEnabled>True</VMware_StackCorruptionDetectionEnabled>
<StackCorruptionDetectionEnabled>False</StackCorruptionDetectionEnabled>
<VMware_StackCorruptionDetectionEnabled>False</VMware_StackCorruptionDetectionEnabled>
<Bochs_Name>Guess</Bochs_Name>
<Bochs_Description>Use Bochs emulator to deploy and debug.</Bochs_Description>
<Bochs_Deployment>ISO</Bochs_Deployment>
Expand All @@ -150,8 +150,8 @@
<Bochs_TraceAssemblies>All</Bochs_TraceAssemblies>
<Bochs_EnableGDB>False</Bochs_EnableGDB>
<Bochs_StartCosmosGDB>False</Bochs_StartCosmosGDB>
<EnableBochsDebug>True</EnableBochsDebug>
<Bochs_EnableBochsDebug>True</Bochs_EnableBochsDebug>
<EnableBochsDebug>False</EnableBochsDebug>
<Bochs_EnableBochsDebug>False</Bochs_EnableBochsDebug>
<PXE_StackCorruptionDetectionEnabled>False</PXE_StackCorruptionDetectionEnabled>
<PXE_EnableBochsDebug>False</PXE_EnableBochsDebug>
<VMware_EnableBochsDebug>False</VMware_EnableBochsDebug>
Expand Down Expand Up @@ -181,23 +181,23 @@
<USB_EnableBochsDebug>False</USB_EnableBochsDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Profile>Bochs</Profile>
<Profile>VMware</Profile>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<Framework>MicrosoftNET</Framework>
<UseInternalAssembler>False</UseInternalAssembler>
<EnableGDB>False</EnableGDB>
<DebugMode>IL</DebugMode>
<DebugMode>Source</DebugMode>
<TraceMode>User</TraceMode>
<BuildTarget>PXE</BuildTarget>
<VMWareFlavor>Player</VMWareFlavor>
<StartCosmosGDB>False</StartCosmosGDB>
<VMwareEdition>Workstation</VMwareEdition>
<VMwareEdition>Player</VMwareEdition>
<VMwareDeploy>ISO</VMwareDeploy>
<IgnoreDebugStubAttribute>False</IgnoreDebugStubAttribute>
<Deployment>ISO</Deployment>
<Launch>Bochs</Launch>
<DebugEnabled>False</DebugEnabled>
<Launch>VMware</Launch>
<DebugEnabled>True</DebugEnabled>
<TraceAssemblies>All</TraceAssemblies>
<PXE_Deployment>PXE</PXE_Deployment>
<PXE_Launch>None</PXE_Launch>
Expand Down Expand Up @@ -228,13 +228,13 @@
<VMware_DebugEnabled>True</VMware_DebugEnabled>
<VMware_DebugMode>Source</VMware_DebugMode>
<VMware_IgnoreDebugStubAttribute>False</VMware_IgnoreDebugStubAttribute>
<VMware_VMwareEdition>Workstation</VMware_VMwareEdition>
<VMware_VMwareEdition>Player</VMware_VMwareEdition>
<VMware_OutputPath>bin\Debug\</VMware_OutputPath>
<VMware_Framework>MicrosoftNET</VMware_Framework>
<VMware_UseInternalAssembler>False</VMware_UseInternalAssembler>
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
<VMware_EnableGDB>True</VMware_EnableGDB>
<VMware_StartCosmosGDB>True</VMware_StartCosmosGDB>
<VMware_EnableGDB>False</VMware_EnableGDB>
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
<ISO_Deployment>ISO</ISO_Deployment>
<ISO_Launch>None</ISO_Launch>
<ISO_DebugEnabled>False</ISO_DebugEnabled>
Expand All @@ -248,7 +248,7 @@
<ISO_EnableGDB>False</ISO_EnableGDB>
<ISO_StartCosmosGDB>false</ISO_StartCosmosGDB>
<Name>Guess</Name>
<Description>Use Bochs emulator to deploy and debug.</Description>
<Description>Use VMware Player or Workstation to deploy and debug.</Description>
<ISO_Name>User 001</ISO_Name>
<ISO_Description>Creates a bootable ISO image which can be burned to a DVD. After running the selected project, an explorer window will open containing the ISO file. The ISO file can then be burned to a CD or DVD and used to boot a physical or virtual system.</ISO_Description>
<USB_Name>Guess</USB_Name>
Expand Down Expand Up @@ -301,8 +301,8 @@
<VMware_ShowLaunchConsole>False</VMware_ShowLaunchConsole>
<ISO_ShowLaunchConsole>False</ISO_ShowLaunchConsole>
<PXE_ShowLaunchConsole>False</PXE_ShowLaunchConsole>
<StackCorruptionDetectionEnabled>True</StackCorruptionDetectionEnabled>
<VMware_StackCorruptionDetectionEnabled>True</VMware_StackCorruptionDetectionEnabled>
<StackCorruptionDetectionEnabled>False</StackCorruptionDetectionEnabled>
<VMware_StackCorruptionDetectionEnabled>False</VMware_StackCorruptionDetectionEnabled>
<Bochs_Name>Guess</Bochs_Name>
<Bochs_Description>Use Bochs emulator to deploy and debug.</Bochs_Description>
<Bochs_Deployment>ISO</Bochs_Deployment>
Expand All @@ -322,8 +322,8 @@
<Bochs_TraceAssemblies>All</Bochs_TraceAssemblies>
<Bochs_EnableGDB>False</Bochs_EnableGDB>
<Bochs_StartCosmosGDB>False</Bochs_StartCosmosGDB>
<EnableBochsDebug>True</EnableBochsDebug>
<Bochs_EnableBochsDebug>True</Bochs_EnableBochsDebug>
<EnableBochsDebug>False</EnableBochsDebug>
<Bochs_EnableBochsDebug>False</Bochs_EnableBochsDebug>
<PXE_StackCorruptionDetectionEnabled>False</PXE_StackCorruptionDetectionEnabled>
<PXE_EnableBochsDebug>False</PXE_EnableBochsDebug>
<VMware_EnableBochsDebug>False</VMware_EnableBochsDebug>
Expand Down
4 changes: 2 additions & 2 deletions Demos/Guess/GuessOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ namespace GuessKernel
public class GuessOS : Sys.Kernel
{
protected int mCount = 0;


protected int mMagicNo = 22;

public GuessOS()
{
// Didnt check if tickcount is working yet.. can change this later
//var xRandom = new Random(234243534);
//mMagicNo = xRandom.Next(1, 100);
}
}

protected override void BeforeRun()
{
Expand Down
12 changes: 12 additions & 0 deletions Tests/Cosmos.Compiler.Tests.Bcl/Cosmos.Compiler.Tests.Bcl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,22 @@
<ItemGroup>
<Compile Include="Kernel.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="System\BooleanTest.cs" />
<Compile Include="System\ByteTest.cs" />
<Compile Include="System\CharTest.cs" />
<Compile Include="System\Collections\Generic\ListTest.cs" />
<Compile Include="System\Collections\Generic\QueueTest.cs" />
<Compile Include="System\DecimalTest.cs" />
<Compile Include="System\DelegatesTest.cs" />
<Compile Include="System\DoubleTest.cs" />
<Compile Include="System\Int16Test.cs" />
<Compile Include="System\Int32Test.cs" />
<Compile Include="System\Int64Test.cs" />
<Compile Include="System\SByteTest.cs" />
<Compile Include="System\SingleTest.cs" />
<Compile Include="System\StringTest.cs" />
<Compile Include="System\UInt16Test.cs" />
<Compile Include="System\UInt32Test.cs" />
<Compile Include="System\UInt64Test.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Profile>VMware</Profile>
<Profile>Bochs</Profile>
<!-- Looks like this was a mispelled attribute. Replaced by DebugEnabled below.
<DebugEnable>true</DebugEnable>
-->
Expand All @@ -22,10 +22,32 @@
<VMWareEdition>Player</VMWareEdition>
<OutputPath>bin\Debug\</OutputPath>
<Name>Cosmos.Compiler.Tests.BclBoot</Name>
<Description>Use VMware Player or Workstation to deploy and debug.</Description>
<Description>Use Bochs emulator to deploy and debug.</Description>
<Deployment>ISO</Deployment>
<Launch>VMware</Launch>
<Launch>Bochs</Launch>
<VisualStudioDebugPort>Pipe: Cosmos\Serial</VisualStudioDebugPort>
<VMware_Name>Cosmos.Compiler.Tests.BclBoot</VMware_Name>
<VMware_Description>Use VMware Player or Workstation to deploy and debug.</VMware_Description>
<VMware_Deployment>ISO</VMware_Deployment>
<VMware_Launch>VMware</VMware_Launch>
<VMware_DebugEnabled>true</VMware_DebugEnabled>
<VMware_DebugMode>Source</VMware_DebugMode>
<VMware_VisualStudioDebugPort>Pipe: Cosmos\Serial</VMware_VisualStudioDebugPort>
<VMware_VMwareEdition>Player</VMware_VMwareEdition>
<VMware_OutputPath>bin\Debug\</VMware_OutputPath>
<VMware_EnableGDB>False</VMware_EnableGDB>
<VMware_StartCosmosGDB>false</VMware_StartCosmosGDB>
<Bochs_Name>Cosmos.Compiler.Tests.BclBoot</Bochs_Name>
<Bochs_Description>Use Bochs emulator to deploy and debug.</Bochs_Description>
<Bochs_Deployment>ISO</Bochs_Deployment>
<Bochs_Launch>Bochs</Bochs_Launch>
<Bochs_DebugEnabled>true</Bochs_DebugEnabled>
<Bochs_DebugMode>Source</Bochs_DebugMode>
<Bochs_VisualStudioDebugPort>Pipe: Cosmos\Serial</Bochs_VisualStudioDebugPort>
<Bochs_VMwareEdition>Player</Bochs_VMwareEdition>
<Bochs_OutputPath>bin\Debug\</Bochs_OutputPath>
<Bochs_EnableGDB>False</Bochs_EnableGDB>
<Bochs_StartCosmosGDB>false</Bochs_StartCosmosGDB>
</PropertyGroup>
<ItemGroup>
<Reference Include="Cosmos.Core.Plugs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
Expand Down
49 changes: 37 additions & 12 deletions Tests/Cosmos.Compiler.Tests.Bcl/Kernel.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,56 @@
using System;
using System.Collections.Generic;
using System.Text;
using Cosmos.Debug.Kernel;
using Cosmos.TestRunner;
using Sys = Cosmos.System;

namespace Cosmos.Compiler.Tests.Bcl
{
using Cosmos.Compiler.Tests.Bcl.System;

public class Kernel : Sys.Kernel
{
protected override void BeforeRun()
{
Console.WriteLine("Cosmos booted successfully. Type a line of text to get it echoed back.");
Console.WriteLine("Cosmos booted successfully. Starting BCL tests now please wait...");
}

public readonly Debugger mDebugger = new Debugger("User", "Test");

protected override void Run()
{
char x = 'a';
string y = "a";
Assert.IsTrue(x.ToString() == y, "x.ToString() == y");
System.StringTest.Execute();
System.Collections.Generic.ListTest.Execute();
System.Collections.Generic.QueueTest.Execute();
System.DelegatesTest.Execute();
//System.UInt64Test.Execute();
TestController.Completed();
try
{
mDebugger.Send("Run");

StringTest.Execute();
ByteTest.Execute();
SByteTest.Execute();
Int16Test.Execute();
UInt16Test.Execute();
Int32Test.Execute();
UInt32Test.Execute();
Int64Test.Execute();
UInt64Test.Execute();
CharTest.Execute();
BooleanTest.Execute();
SingleTest.Execute();
DoubleTest.Execute();
DecimalTest.Execute();
System.Collections.Generic.ListTest.Execute();
System.Collections.Generic.QueueTest.Execute();
System.DelegatesTest.Execute();
System.UInt64Test.Execute();
TestController.Completed();
}
catch (Exception e)
{
Console.WriteLine("Exception occurred");
Console.WriteLine(e.Message);
mDebugger.Send("Exception occurred: " + e.Message);
TestController.Failed();
}
}
}
}
}
50 changes: 50 additions & 0 deletions Tests/Cosmos.Compiler.Tests.Bcl/System/BooleanTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Cosmos.TestRunner;

namespace Cosmos.Compiler.Tests.Bcl.System
{
class BooleanTest
{
public static void Execute()
{
Boolean value;
String result;
String expectedResult;

value = true;

result = value.ToString();
expectedResult = "True";

Assert.IsTrue((result == expectedResult), "Boolean.ToString doesn't work");

// Cosmos blocks again and never returns (?)
// Now let's try to concat to a String using '+' operator
result = "The value of the Boolean is " + value;
expectedResult = "The value of the Boolean is True";

Assert.IsTrue((result == expectedResult), "String concat (Boolean) doesn't work");

// Now let's try to use '$ instead of '+'
result = $"The value of the Boolean is {value}";
// Actually 'expectedResult' should be the same so...
Assert.IsTrue((result == expectedResult), "String format (Boolean) doesn't work");

// Now let's Get the HashCode of a value
int resultAsInt = value.GetHashCode();

// actually the Hash Code of a Bool is 1 for true and 0 for false
Assert.IsTrue((resultAsInt == 1), "Boolean.GetHashCode() doesn't work");

#if false
// Now let's try ToString() again but printed in hex (this test fails for now!)
result = value.ToString("X2");
expectedResult = "0x7FFFFFFF";

Assert.IsTrue((result == expectedResult), "Int32.ToString(X2) doesn't work");
#endif
}
}
}
Loading

0 comments on commit 8937b5c

Please sign in to comment.