Skip to content

Commit 716d6dc

Browse files
committed
test(core): Add test for core
1 parent 9b8f8a9 commit 716d6dc

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

Maria.Tests/CoreTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Maria;
2+
using NUnit.Framework;
3+
4+
namespace Maria.Tests.Core
5+
{
6+
[TestFixture]
7+
public class Tests
8+
{
9+
[TestCase]
10+
public void TestClamp()
11+
{
12+
Assert.That(Algorithms.clamp(2, 0, 1), Is.EqualTo(1));
13+
Assert.That(Algorithms.clamp(-2, 0, 1), Is.EqualTo(0));
14+
Assert.That(Algorithms.clamp(2, 10, 10), Is.EqualTo(10));
15+
Assert.That(Algorithms.clamp(5, -20, -5), Is.EqualTo(-5));
16+
Assert.That(Algorithms.clamp(int.MaxValue, int.MinValue, int.MinValue), Is.EqualTo(int.MinValue));
17+
}
18+
}
19+
}

Maria.Tests/Maria.Tests.csproj

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
6+
<IsPackable>false</IsPackable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="nunit" Version="3.12.0" />
11+
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0"/>
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<ProjectReference Include="..\Maria.Core\Maria.Core.csproj" />
17+
</ItemGroup>
18+
19+
</Project>

Maria.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maria.Editor", "Maria.Edito
99
EndProject
1010
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maria.Platform", "Maria.Platform\Maria.Platform.csproj", "{4952A773-E7D7-45F8-9777-D48BF70E0712}"
1111
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maria.Tests", "Maria.Tests\Maria.Tests.csproj", "{8F996FCB-29BB-49BB-A4D6-29BAFCB03750}"
13+
EndProject
1214
Global
1315
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1416
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
2729
{4952A773-E7D7-45F8-9777-D48BF70E0712}.Debug|Any CPU.Build.0 = Debug|Any CPU
2830
{4952A773-E7D7-45F8-9777-D48BF70E0712}.Release|Any CPU.ActiveCfg = Release|Any CPU
2931
{4952A773-E7D7-45F8-9777-D48BF70E0712}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{8F996FCB-29BB-49BB-A4D6-29BAFCB03750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{8F996FCB-29BB-49BB-A4D6-29BAFCB03750}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{8F996FCB-29BB-49BB-A4D6-29BAFCB03750}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{8F996FCB-29BB-49BB-A4D6-29BAFCB03750}.Release|Any CPU.Build.0 = Release|Any CPU
3036
EndGlobalSection
3137
GlobalSection(SolutionProperties) = preSolution
3238
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)