mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 14:02:19 +00:00
Fixed string.IsNullOrWhitespace and fixed ProcessorTest kernel
This commit is contained in:
parent
0c2d88ce64
commit
5365e7287d
7 changed files with 71 additions and 22 deletions
33
Test.sln
33
Test.sln
|
|
@ -1,6 +1,6 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 15.0.27130.2010
|
VisualStudioVersion = 16.0.29728.190
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{DAEF99B5-22F0-4885-B45B-9B600B857E1C}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{DAEF99B5-22F0-4885-B45B-9B600B857E1C}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|
@ -162,6 +162,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.System.Tests", "Test
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Kernel.Tests.DiskManager", "Tests\Kernels\Cosmos.Kernel.Tests.DiskManager\Cosmos.Kernel.Tests.DiskManager.csproj", "{BB6A5306-4C7A-4973-A48E-9FE3E683EAEC}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Kernel.Tests.DiskManager", "Tests\Kernels\Cosmos.Kernel.Tests.DiskManager\Cosmos.Kernel.Tests.DiskManager.csproj", "{BB6A5306-4C7A-4973-A48E-9FE3E683EAEC}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProcessorTests", "Tests\Kernels\ProcessorTests\ProcessorTests.csproj", "{3F28939D-5E06-44AC-8FC6-ADBBB89AC97B}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -170,14 +172,6 @@ Global
|
||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{0CDB3F6E-7971-426B-81F8-38B966A54C2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{0CDB3F6E-7971-426B-81F8-38B966A54C2B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{0CDB3F6E-7971-426B-81F8-38B966A54C2B}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{0CDB3F6E-7971-426B-81F8-38B966A54C2B}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{0CDB3F6E-7971-426B-81F8-38B966A54C2B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{0CDB3F6E-7971-426B-81F8-38B966A54C2B}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{0CDB3F6E-7971-426B-81F8-38B966A54C2B}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{0CDB3F6E-7971-426B-81F8-38B966A54C2B}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
|
@ -539,14 +533,6 @@ Global
|
||||||
{FF46829E-B612-4D36-80BE-ED04521AD91A}.Release|Any CPU.Build.0 = Release|Any CPU
|
{FF46829E-B612-4D36-80BE-ED04521AD91A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{FF46829E-B612-4D36-80BE-ED04521AD91A}.Release|x86.ActiveCfg = Release|Any CPU
|
{FF46829E-B612-4D36-80BE-ED04521AD91A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{FF46829E-B612-4D36-80BE-ED04521AD91A}.Release|x86.Build.0 = Release|Any CPU
|
{FF46829E-B612-4D36-80BE-ED04521AD91A}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{D0EABA08-88C9-4F7C-BCA9-361B58B20D67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{D0EABA08-88C9-4F7C-BCA9-361B58B20D67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{D0EABA08-88C9-4F7C-BCA9-361B58B20D67}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{D0EABA08-88C9-4F7C-BCA9-361B58B20D67}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{D0EABA08-88C9-4F7C-BCA9-361B58B20D67}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{D0EABA08-88C9-4F7C-BCA9-361B58B20D67}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{D0EABA08-88C9-4F7C-BCA9-361B58B20D67}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{D0EABA08-88C9-4F7C-BCA9-361B58B20D67}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{D21A7C6C-A696-4EC3-84EB-70700C1E3B34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{D21A7C6C-A696-4EC3-84EB-70700C1E3B34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D21A7C6C-A696-4EC3-84EB-70700C1E3B34}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D21A7C6C-A696-4EC3-84EB-70700C1E3B34}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D21A7C6C-A696-4EC3-84EB-70700C1E3B34}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{D21A7C6C-A696-4EC3-84EB-70700C1E3B34}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
|
@ -635,12 +621,19 @@ Global
|
||||||
{BB6A5306-4C7A-4973-A48E-9FE3E683EAEC}.Release|Any CPU.Build.0 = Release|Any CPU
|
{BB6A5306-4C7A-4973-A48E-9FE3E683EAEC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{BB6A5306-4C7A-4973-A48E-9FE3E683EAEC}.Release|x86.ActiveCfg = Release|Any CPU
|
{BB6A5306-4C7A-4973-A48E-9FE3E683EAEC}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{BB6A5306-4C7A-4973-A48E-9FE3E683EAEC}.Release|x86.Build.0 = Release|Any CPU
|
{BB6A5306-4C7A-4973-A48E-9FE3E683EAEC}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{3F28939D-5E06-44AC-8FC6-ADBBB89AC97B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3F28939D-5E06-44AC-8FC6-ADBBB89AC97B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3F28939D-5E06-44AC-8FC6-ADBBB89AC97B}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{3F28939D-5E06-44AC-8FC6-ADBBB89AC97B}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{3F28939D-5E06-44AC-8FC6-ADBBB89AC97B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3F28939D-5E06-44AC-8FC6-ADBBB89AC97B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{3F28939D-5E06-44AC-8FC6-ADBBB89AC97B}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{3F28939D-5E06-44AC-8FC6-ADBBB89AC97B}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{0CDB3F6E-7971-426B-81F8-38B966A54C2B} = {E9CD521E-C386-466D-B5F7-A5EB19A61625}
|
|
||||||
{F74A4B2B-02DA-455A-89FB-803A442B5B2C} = {DAEF99B5-22F0-4885-B45B-9B600B857E1C}
|
{F74A4B2B-02DA-455A-89FB-803A442B5B2C} = {DAEF99B5-22F0-4885-B45B-9B600B857E1C}
|
||||||
{4F903492-CCA6-4FD9-A1B6-5E4CC0CE7767} = {C286932C-3F6D-47F0-BEEF-26843D1BB11B}
|
{4F903492-CCA6-4FD9-A1B6-5E4CC0CE7767} = {C286932C-3F6D-47F0-BEEF-26843D1BB11B}
|
||||||
{34AEEB7C-FD5D-4B15-A830-B429681844BD} = {C286932C-3F6D-47F0-BEEF-26843D1BB11B}
|
{34AEEB7C-FD5D-4B15-A830-B429681844BD} = {C286932C-3F6D-47F0-BEEF-26843D1BB11B}
|
||||||
|
|
@ -702,7 +695,6 @@ Global
|
||||||
{3DD192AF-2D72-449F-936C-ED8734225B18} = {C286932C-3F6D-47F0-BEEF-26843D1BB11B}
|
{3DD192AF-2D72-449F-936C-ED8734225B18} = {C286932C-3F6D-47F0-BEEF-26843D1BB11B}
|
||||||
{929EE8ED-6AD3-4442-A0C1-EC70665F2DCF} = {99192440-2DD7-4E71-B730-D44A73F46533}
|
{929EE8ED-6AD3-4442-A0C1-EC70665F2DCF} = {99192440-2DD7-4E71-B730-D44A73F46533}
|
||||||
{FF46829E-B612-4D36-80BE-ED04521AD91A} = {E9CD521E-C386-466D-B5F7-A5EB19A61625}
|
{FF46829E-B612-4D36-80BE-ED04521AD91A} = {E9CD521E-C386-466D-B5F7-A5EB19A61625}
|
||||||
{D0EABA08-88C9-4F7C-BCA9-361B58B20D67} = {E9CD521E-C386-466D-B5F7-A5EB19A61625}
|
|
||||||
{D21A7C6C-A696-4EC3-84EB-70700C1E3B34} = {ECEA7778-E786-4317-90B9-A2D4427CB91C}
|
{D21A7C6C-A696-4EC3-84EB-70700C1E3B34} = {ECEA7778-E786-4317-90B9-A2D4427CB91C}
|
||||||
{0DF97CAC-220B-4DAD-B397-42E394255763} = {ECEA7778-E786-4317-90B9-A2D4427CB91C}
|
{0DF97CAC-220B-4DAD-B397-42E394255763} = {ECEA7778-E786-4317-90B9-A2D4427CB91C}
|
||||||
{2992AA07-E126-4EE0-B31C-D0B2ADE3393A} = {0E67EFE8-5944-4F6C-8B47-C5E06D4C79F5}
|
{2992AA07-E126-4EE0-B31C-D0B2ADE3393A} = {0E67EFE8-5944-4F6C-8B47-C5E06D4C79F5}
|
||||||
|
|
@ -714,6 +706,7 @@ Global
|
||||||
{99E24E61-0743-47FF-AB0A-55A36C5E184C} = {52D81759-C7CC-427F-8C96-89CA10C914B5}
|
{99E24E61-0743-47FF-AB0A-55A36C5E184C} = {52D81759-C7CC-427F-8C96-89CA10C914B5}
|
||||||
{970C5E07-5D09-4882-949C-A8E876B22732} = {52D81759-C7CC-427F-8C96-89CA10C914B5}
|
{970C5E07-5D09-4882-949C-A8E876B22732} = {52D81759-C7CC-427F-8C96-89CA10C914B5}
|
||||||
{BB6A5306-4C7A-4973-A48E-9FE3E683EAEC} = {29EEC029-6A2B-478A-B6E5-D63A91388ABA}
|
{BB6A5306-4C7A-4973-A48E-9FE3E683EAEC} = {29EEC029-6A2B-478A-B6E5-D63A91388ABA}
|
||||||
|
{3F28939D-5E06-44AC-8FC6-ADBBB89AC97B} = {ECEA7778-E786-4317-90B9-A2D4427CB91C}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {4418C803-277E-448F-A0A0-52788FA215AD}
|
SolutionGuid = {4418C803-277E-448F-A0A0-52788FA215AD}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
<ProjectReference Include="..\Kernels\Cosmos.Kernel.Tests.Fat\Cosmos.Kernel.Tests.Fat.csproj" />
|
<ProjectReference Include="..\Kernels\Cosmos.Kernel.Tests.Fat\Cosmos.Kernel.Tests.Fat.csproj" />
|
||||||
<ProjectReference Include="..\Kernels\Cosmos.Kernel.Tests.IO\Cosmos.Kernel.Tests.IO.csproj" />
|
<ProjectReference Include="..\Kernels\Cosmos.Kernel.Tests.IO\Cosmos.Kernel.Tests.IO.csproj" />
|
||||||
<ProjectReference Include="..\Kernels\GraphicTest\GraphicTest.csproj" />
|
<ProjectReference Include="..\Kernels\GraphicTest\GraphicTest.csproj" />
|
||||||
|
<ProjectReference Include="..\Kernels\ProcessorTests\ProcessorTests.csproj" />
|
||||||
<ProjectReference Include="..\Kernels\MemoryOperationsTest\MemoryOperationsTest.csproj" />
|
<ProjectReference Include="..\Kernels\MemoryOperationsTest\MemoryOperationsTest.csproj" />
|
||||||
<ProjectReference Include="..\Kernels\SimpleStructsAndArraysTest\SimpleStructsAndArraysTest.csproj" />
|
<ProjectReference Include="..\Kernels\SimpleStructsAndArraysTest\SimpleStructsAndArraysTest.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ namespace Cosmos.TestRunner.Full
|
||||||
//yield return typeof(ConsoleTest.Kernel);
|
//yield return typeof(ConsoleTest.Kernel);
|
||||||
/* This is a bit slow and works only because ring check is disabled to decide if leave it enabled */
|
/* This is a bit slow and works only because ring check is disabled to decide if leave it enabled */
|
||||||
yield return typeof(MemoryOperationsTest.Kernel);
|
yield return typeof(MemoryOperationsTest.Kernel);
|
||||||
|
yield return typeof(ProcessorTests.Kernel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace ProcessorTests
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//TestVendorNameIsNotBlank();
|
TestVendorNameIsNotBlank();
|
||||||
TestCycleCount();
|
TestCycleCount();
|
||||||
TestCycleRateIsNotZero();
|
TestCycleRateIsNotZero();
|
||||||
|
|
||||||
|
|
@ -49,6 +49,7 @@ namespace ProcessorTests
|
||||||
public void TestCycleCount()
|
public void TestCycleCount()
|
||||||
{
|
{
|
||||||
ulong cycleCount = CPU.GetCPUUptime();
|
ulong cycleCount = CPU.GetCPUUptime();
|
||||||
|
mDebugger.Send($"CycleCount: {cycleCount}");
|
||||||
bool isCycleCountZero = cycleCount == 0;
|
bool isCycleCountZero = cycleCount == 0;
|
||||||
Assert.IsFalse(isCycleCountZero, "Processor cycle count is not zero.");
|
Assert.IsFalse(isCycleCountZero, "Processor cycle count is not zero.");
|
||||||
ulong secondCount = CPU.GetCPUUptime();
|
ulong secondCount = CPU.GetCPUUptime();
|
||||||
|
|
@ -58,6 +59,7 @@ namespace ProcessorTests
|
||||||
public void TestCycleRateIsNotZero()
|
public void TestCycleRateIsNotZero()
|
||||||
{
|
{
|
||||||
long cycleRate = CPU.GetCPUCycleSpeed();
|
long cycleRate = CPU.GetCPUCycleSpeed();
|
||||||
|
mDebugger.Send($"CycleRate: {cycleRate}");
|
||||||
bool isCycleRateZero = cycleRate == 0;
|
bool isCycleRateZero = cycleRate == 0;
|
||||||
Assert.IsFalse(isCycleRateZero, "Processor cycle rate is not zero.");
|
Assert.IsFalse(isCycleRateZero, "Processor cycle rate is not zero.");
|
||||||
Assert.IsTrue(CPU.GetCPUCycleSpeed() == cycleRate, "Processor cycle speed is not constant");
|
Assert.IsTrue(CPU.GetCPUCycleSpeed() == cycleRate, "Processor cycle speed is not constant");
|
||||||
|
|
|
||||||
13
Tests/Kernels/ProcessorTests/ProcessorTests.csproj
Normal file
13
Tests/Kernels/ProcessorTests/ProcessorTests.csproj
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\source\Cosmos.Debug.Kernel\Cosmos.Debug.Kernel.csproj" />
|
||||||
|
<ProjectReference Include="..\..\..\source\Cosmos.System2\Cosmos.System2.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Cosmos.TestRunner.TestController\Cosmos.TestRunner.TestController.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -40,7 +40,7 @@ namespace Cosmos.Core_Asm
|
||||||
public static int CanReadCPUID() => throw new NotImplementedException();
|
public static int CanReadCPUID() => throw new NotImplementedException();
|
||||||
|
|
||||||
[PlugMethod(Assembler = typeof(CPUReadCPUIDAsm))]
|
[PlugMethod(Assembler = typeof(CPUReadCPUIDAsm))]
|
||||||
public static void ReadCPUID(int type, ref int eax, ref int ebx, ref int ecx, ref int edx) => throw new NotImplementedException();
|
public static void ReadCPUID(uint type, ref int eax, ref int ebx, ref int ecx, ref int edx) => throw new NotImplementedException();
|
||||||
|
|
||||||
[PlugMethod(Assembler = typeof(CPUReadTimestampCounterAsm))]
|
[PlugMethod(Assembler = typeof(CPUReadTimestampCounterAsm))]
|
||||||
public static ulong ReadTimestampCounter() => throw new NotImplementedException();
|
public static ulong ReadTimestampCounter() => throw new NotImplementedException();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Text;
|
||||||
|
using IL2CPU.API.Attribs;
|
||||||
|
|
||||||
|
namespace Cosmos.Core_Plugs.System.Globalization
|
||||||
|
{
|
||||||
|
[Plug(Target = typeof(CharUnicodeInfo))]
|
||||||
|
class CharUnicodeInfoImpl
|
||||||
|
{
|
||||||
|
//TODO: Implement these more correctly
|
||||||
|
[PlugMethod(Signature = "System_Byte__System_Globalization_CharUnicodeInfo_InternalGetCategoryValue_System_Int32__System_Int32_")]
|
||||||
|
public static byte InternalGetCategoryValue(int ch, int offset)
|
||||||
|
{
|
||||||
|
return InternalGetUnicodeCategory(ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte InternalGetUnicodeCategory(int ch)
|
||||||
|
{
|
||||||
|
if (48 <= ch && ch <= 57)
|
||||||
|
{
|
||||||
|
return (byte)UnicodeCategory.DecimalDigitNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (65 <= ch && ch <= 90)
|
||||||
|
{
|
||||||
|
return (byte)UnicodeCategory.UppercaseLetter;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (97 <= ch && ch <= 122)
|
||||||
|
{
|
||||||
|
return (byte)UnicodeCategory.LowercaseLetter;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (byte)UnicodeCategory.OtherLetter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue