forked from CosmosOS/Cosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/CosmosOS/Cosmos.git
- Loading branch information
Showing
34 changed files
with
899 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
Oops, something went wrong.