From 191497b552d1d730d1d7736c815e788fc91684e7 Mon Sep 17 00:00:00 2001 From: Quake Date: Tue, 27 Feb 2024 23:46:06 +0100 Subject: [PATCH] feat: add dummy class and test for setting up testing pipeline --- .../Assets/Scripts/PipelineTesting.meta | 8 +++++++ .../Scripts/PipelineTesting/Calculator.cs | 12 ++++++++++ .../PipelineTesting/Calculator.cs.meta | 11 +++++++++ aplib.net-demo/Assets/Scripts/Scripts.asmdef | 3 +++ .../Assets/Scripts/Scripts.asmdef.meta | 7 ++++++ .../Assets/Testing/EditModeTests.meta | 8 +++++++ .../Testing/EditModeTests/CalculatorTests.cs | 20 ++++++++++++++++ .../EditModeTests/CalculatorTests.cs.meta | 11 +++++++++ .../EditModeTests/EditModeTests.asmdef | 24 +++++++++++++++++++ .../EditModeTests/EditModeTests.asmdef.meta | 7 ++++++ 10 files changed, 111 insertions(+) create mode 100644 aplib.net-demo/Assets/Scripts/PipelineTesting.meta create mode 100644 aplib.net-demo/Assets/Scripts/PipelineTesting/Calculator.cs create mode 100644 aplib.net-demo/Assets/Scripts/PipelineTesting/Calculator.cs.meta create mode 100644 aplib.net-demo/Assets/Scripts/Scripts.asmdef create mode 100644 aplib.net-demo/Assets/Scripts/Scripts.asmdef.meta create mode 100644 aplib.net-demo/Assets/Testing/EditModeTests.meta create mode 100644 aplib.net-demo/Assets/Testing/EditModeTests/CalculatorTests.cs create mode 100644 aplib.net-demo/Assets/Testing/EditModeTests/CalculatorTests.cs.meta create mode 100644 aplib.net-demo/Assets/Testing/EditModeTests/EditModeTests.asmdef create mode 100644 aplib.net-demo/Assets/Testing/EditModeTests/EditModeTests.asmdef.meta diff --git a/aplib.net-demo/Assets/Scripts/PipelineTesting.meta b/aplib.net-demo/Assets/Scripts/PipelineTesting.meta new file mode 100644 index 00000000..8299f636 --- /dev/null +++ b/aplib.net-demo/Assets/Scripts/PipelineTesting.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 62c73da0954d87b49a615624f1d9a87b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/aplib.net-demo/Assets/Scripts/PipelineTesting/Calculator.cs b/aplib.net-demo/Assets/Scripts/PipelineTesting/Calculator.cs new file mode 100644 index 00000000..c5fc4bb7 --- /dev/null +++ b/aplib.net-demo/Assets/Scripts/PipelineTesting/Calculator.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Calculator : MonoBehaviour +{ + public static int Add(int a, int b) + { + int c = a + b; + return c; + } +} diff --git a/aplib.net-demo/Assets/Scripts/PipelineTesting/Calculator.cs.meta b/aplib.net-demo/Assets/Scripts/PipelineTesting/Calculator.cs.meta new file mode 100644 index 00000000..74878530 --- /dev/null +++ b/aplib.net-demo/Assets/Scripts/PipelineTesting/Calculator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bd32598a3cf3ab448ba5312921797e34 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/aplib.net-demo/Assets/Scripts/Scripts.asmdef b/aplib.net-demo/Assets/Scripts/Scripts.asmdef new file mode 100644 index 00000000..2457ea94 --- /dev/null +++ b/aplib.net-demo/Assets/Scripts/Scripts.asmdef @@ -0,0 +1,3 @@ +{ + "name": "Scripts" +} diff --git a/aplib.net-demo/Assets/Scripts/Scripts.asmdef.meta b/aplib.net-demo/Assets/Scripts/Scripts.asmdef.meta new file mode 100644 index 00000000..b4a3a4d6 --- /dev/null +++ b/aplib.net-demo/Assets/Scripts/Scripts.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 34fb7501ee882484b8a3787bb50c16de +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/aplib.net-demo/Assets/Testing/EditModeTests.meta b/aplib.net-demo/Assets/Testing/EditModeTests.meta new file mode 100644 index 00000000..4100c30b --- /dev/null +++ b/aplib.net-demo/Assets/Testing/EditModeTests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8c245fda1308f5b4db410dcaead12c35 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/aplib.net-demo/Assets/Testing/EditModeTests/CalculatorTests.cs b/aplib.net-demo/Assets/Testing/EditModeTests/CalculatorTests.cs new file mode 100644 index 00000000..9863822a --- /dev/null +++ b/aplib.net-demo/Assets/Testing/EditModeTests/CalculatorTests.cs @@ -0,0 +1,20 @@ +using NUnit.Framework; + +public class NewTestScript +{ + [Test] + [TestCase(5, 10, 15)] + [TestCase(-2, 7, 5)] + [TestCase(0, 0, 0)] + public void Calculator_Addition(int a, int b, int expected) + { + // Arrange + // Handled in testcases + + // Act + int result = Calculator.Add(a, b); + + // Assert + Assert.AreEqual(expected, result); + } +} diff --git a/aplib.net-demo/Assets/Testing/EditModeTests/CalculatorTests.cs.meta b/aplib.net-demo/Assets/Testing/EditModeTests/CalculatorTests.cs.meta new file mode 100644 index 00000000..28662868 --- /dev/null +++ b/aplib.net-demo/Assets/Testing/EditModeTests/CalculatorTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8a29b348288568e48bd718ad2ed78af0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/aplib.net-demo/Assets/Testing/EditModeTests/EditModeTests.asmdef b/aplib.net-demo/Assets/Testing/EditModeTests/EditModeTests.asmdef new file mode 100644 index 00000000..156ca3b0 --- /dev/null +++ b/aplib.net-demo/Assets/Testing/EditModeTests/EditModeTests.asmdef @@ -0,0 +1,24 @@ +{ + "name": "EditModeTests", + "rootNamespace": "", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner", + "Scripts" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/aplib.net-demo/Assets/Testing/EditModeTests/EditModeTests.asmdef.meta b/aplib.net-demo/Assets/Testing/EditModeTests/EditModeTests.asmdef.meta new file mode 100644 index 00000000..a4d2a93e --- /dev/null +++ b/aplib.net-demo/Assets/Testing/EditModeTests/EditModeTests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 49050eb9259d4f948b5d6b773aeb125f +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: