diff --git a/Maria.Core/Maria.Core.csproj b/Maria.Core/Maria.Core.csproj index 422c63c..5b8db07 100644 --- a/Maria.Core/Maria.Core.csproj +++ b/Maria.Core/Maria.Core.csproj @@ -3,6 +3,10 @@ netstandard2.0 + + + + ..\Libraries\Unity\UnityEditor.dll diff --git a/Maria.Tests/CoreTests.cs b/Maria.Tests/CoreTests.cs new file mode 100644 index 0000000..72f6086 --- /dev/null +++ b/Maria.Tests/CoreTests.cs @@ -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)); + } + } +} \ No newline at end of file diff --git a/Maria.Tests/Maria.Tests.csproj b/Maria.Tests/Maria.Tests.csproj new file mode 100644 index 0000000..62f1307 --- /dev/null +++ b/Maria.Tests/Maria.Tests.csproj @@ -0,0 +1,19 @@ + + + + netcoreapp3.1 + + false + + + + + + + + + + + + + diff --git a/Maria.sln b/Maria.sln index 4bbe3b5..6324d53 100644 --- a/Maria.sln +++ b/Maria.sln @@ -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 @@ -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 diff --git a/appveyor.yml b/appveyor.yml index 98eab01..eafc575 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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