Skip to content

Commit 85ede76

Browse files
authored
Merge pull request #8 from r-dh/tests
Tests
2 parents 9b8f8a9 + f899aaf commit 85ede76

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

Maria.Core/Maria.Core.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
9+
</ItemGroup>
610
<ItemGroup>
711
<Reference Include="UnityEditor, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
812
<HintPath>..\Libraries\Unity\UnityEditor.dll</HintPath>

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

appveyor.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,17 @@ skip_commits:
1818

1919
before_build:
2020
- nuget restore
21+
- nuget install OpenCover -OutputDirectory packages -Version 4.6.519
22+
- choco install codecov
23+
2124
build:
2225
project: Maria.sln
2326
verbosity: minimal
2427

28+
test_script:
29+
- .\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe -returntargetcode -register:user -target:"dotnet.exe" -targetargs:"test Maria.Tests\bin\Release\netcoreapp3.1\Maria.Tests.dll" -output:"coverage.xml" -filter:"+[Maria*]* -[Maria.Tests*]* "
30+
- codecov -f "coverage.xml"
31+
2532
before_package:
2633
- ps: .\BuildUnityPackages.ps1
2734

0 commit comments

Comments
 (0)