From 716d6dc491711e8c3d2e2eaaa77c7b0a490b5a4d Mon Sep 17 00:00:00 2001 From: r_dh Date: Fri, 7 Aug 2020 13:17:18 +0200 Subject: [PATCH 1/5] test(core): Add test for core --- Maria.Tests/CoreTests.cs | 19 +++++++++++++++++++ Maria.Tests/Maria.Tests.csproj | 19 +++++++++++++++++++ Maria.sln | 6 ++++++ 3 files changed, 44 insertions(+) create mode 100644 Maria.Tests/CoreTests.cs create mode 100644 Maria.Tests/Maria.Tests.csproj 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 From f2ddc5697c09b2dce71e8ded6aacef0a179281bd Mon Sep 17 00:00:00 2001 From: r_dh Date: Fri, 7 Aug 2020 13:35:31 +0200 Subject: [PATCH 2/5] ci(tests): Update appveyor config --- appveyor.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 98eab01..b04d605 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,11 +22,16 @@ build: project: Maria.sln verbosity: minimal +test: + assemblies: + - '**\Maria.Tests.dll' + before_package: - ps: .\BuildUnityPackages.ps1 artifacts: - path: '*.unitypackage' +- path: '*Maria*\bin\Release\*\*Maria*' cache: '%APPDATA%\npm' From 42a28cd9f38fe90a12f2c76061522c9304f071b5 Mon Sep 17 00:00:00 2001 From: r_dh Date: Fri, 7 Aug 2020 14:37:18 +0200 Subject: [PATCH 3/5] ci(tests): Try to show test results --- Maria.Core/Maria.Core.csproj | 4 ++++ appveyor.yml | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) 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/appveyor.yml b/appveyor.yml index b04d605..1c361d2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,20 +18,28 @@ skip_commits: before_build: - nuget restore + - nuget install OpenCover -OutputDirectory packages -Version 4.6.519 + build: project: Maria.sln verbosity: minimal -test: - assemblies: - - '**\Maria.Tests.dll' +test_script: + - .\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe -returntargetcode -register:user -target:"nunit3-console.exe" -targetargs:"Maria.Tests\bin\Release\netcoreapp3.1\Maria.Tests.dll" -output:"coverage.xml" -filter:"+[Maria*]* -[Maria.Tests*]* " + + +after_test: + - ps: | + $env:PATH = 'C:\msys64\usr\bin;' + $env:PATH + Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh + bash codecov.sh -f "coverage.xml" + before_package: - ps: .\BuildUnityPackages.ps1 artifacts: - path: '*.unitypackage' -- path: '*Maria*\bin\Release\*\*Maria*' cache: '%APPDATA%\npm' From 4e96d3511cff1caf8fbf5a660b279249bf881cbe Mon Sep 17 00:00:00 2001 From: r_dh Date: Fri, 7 Aug 2020 14:53:24 +0200 Subject: [PATCH 4/5] ci(tests): Switch to dotnet due to error NUnit.Engine.NUnitEngineException : The NUnit 3 driver encountered an error while executing reflected code --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 1c361d2..1aa6ff6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,13 +19,13 @@ skip_commits: before_build: - nuget restore - nuget install OpenCover -OutputDirectory packages -Version 4.6.519 - + build: project: Maria.sln verbosity: minimal test_script: - - .\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe -returntargetcode -register:user -target:"nunit3-console.exe" -targetargs:"Maria.Tests\bin\Release\netcoreapp3.1\Maria.Tests.dll" -output:"coverage.xml" -filter:"+[Maria*]* -[Maria.Tests*]* " + - .\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*]* " after_test: From f899aafc9e93bc16307ecdfc792c9fd8768954ca Mon Sep 17 00:00:00 2001 From: r_dh Date: Fri, 7 Aug 2020 14:59:44 +0200 Subject: [PATCH 5/5] ci(test): Use different command for uploading --- appveyor.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 1aa6ff6..eafc575 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,6 +19,7 @@ skip_commits: before_build: - nuget restore - nuget install OpenCover -OutputDirectory packages -Version 4.6.519 + - choco install codecov build: project: Maria.sln @@ -26,14 +27,7 @@ build: 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*]* " - - -after_test: - - ps: | - $env:PATH = 'C:\msys64\usr\bin;' + $env:PATH - Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh - bash codecov.sh -f "coverage.xml" - + - codecov -f "coverage.xml" before_package: - ps: .\BuildUnityPackages.ps1