Skip to content

Commit

Permalink
Merge pull request #8 from r-dh/tests
Browse files Browse the repository at this point in the history
Tests
  • Loading branch information
r-dh authored Aug 7, 2020
2 parents 9b8f8a9 + f899aaf commit 85ede76
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Maria.Core/Maria.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="UnityEditor, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\Libraries\Unity\UnityEditor.dll</HintPath>
Expand Down
19 changes: 19 additions & 0 deletions Maria.Tests/CoreTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Maria;
using NUnit.Framework;

namespace Maria.Tests.Core
{
[TestFixture]
public class Tests
{
[TestCase]
public void TestClamp()
{
Assert.That(Algorithms.clamp(2, 0, 1), Is.EqualTo(1));
Assert.That(Algorithms.clamp(-2, 0, 1), Is.EqualTo(0));
Assert.That(Algorithms.clamp(2, 10, 10), Is.EqualTo(10));
Assert.That(Algorithms.clamp(5, -20, -5), Is.EqualTo(-5));
Assert.That(Algorithms.clamp(int.MaxValue, int.MinValue, int.MinValue), Is.EqualTo(int.MinValue));
}
}
}
19 changes: 19 additions & 0 deletions Maria.Tests/Maria.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Maria.Core\Maria.Core.csproj" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions Maria.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maria.Editor", "Maria.Edito
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maria.Platform", "Maria.Platform\Maria.Platform.csproj", "{4952A773-E7D7-45F8-9777-D48BF70E0712}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maria.Tests", "Maria.Tests\Maria.Tests.csproj", "{8F996FCB-29BB-49BB-A4D6-29BAFCB03750}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -27,6 +29,10 @@ Global
{4952A773-E7D7-45F8-9777-D48BF70E0712}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4952A773-E7D7-45F8-9777-D48BF70E0712}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4952A773-E7D7-45F8-9777-D48BF70E0712}.Release|Any CPU.Build.0 = Release|Any CPU
{8F996FCB-29BB-49BB-A4D6-29BAFCB03750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F996FCB-29BB-49BB-A4D6-29BAFCB03750}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F996FCB-29BB-49BB-A4D6-29BAFCB03750}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F996FCB-29BB-49BB-A4D6-29BAFCB03750}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
7 changes: 7 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ skip_commits:

before_build:
- nuget restore
- nuget install OpenCover -OutputDirectory packages -Version 4.6.519
- choco install codecov

build:
project: Maria.sln
verbosity: minimal

test_script:
- .\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*]* "
- codecov -f "coverage.xml"

before_package:
- ps: .\BuildUnityPackages.ps1

Expand Down

0 comments on commit 85ede76

Please sign in to comment.