diff --git a/Assets/EditModeTests/EditModeTests.asmdef b/Assets/Accounts/Tests/AccountsTests.asmdef similarity index 75% rename from Assets/EditModeTests/EditModeTests.asmdef rename to Assets/Accounts/Tests/AccountsTests.asmdef index 8f5d1b5..0550adc 100644 --- a/Assets/EditModeTests/EditModeTests.asmdef +++ b/Assets/Accounts/Tests/AccountsTests.asmdef @@ -1,5 +1,5 @@ { - "name": "EditModeTests", + "name": "AccountsTests", "optionalUnityReferences": [ "TestAssemblies" ], diff --git a/Assets/EditModeTests/EditModeTests.asmdef.meta b/Assets/Accounts/Tests/AccountsTests.asmdef.meta similarity index 76% rename from Assets/EditModeTests/EditModeTests.asmdef.meta rename to Assets/Accounts/Tests/AccountsTests.asmdef.meta index 3fc17b7..6671d16 100644 --- a/Assets/EditModeTests/EditModeTests.asmdef.meta +++ b/Assets/Accounts/Tests/AccountsTests.asmdef.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b3d66002fb543bf3fa03c11006f8cb3a +guid: 8500f5aede7627729bd8c97b15e541c4 AssemblyDefinitionImporter: externalObjects: {} userData: diff --git a/Assets/EditModeTests/BasicTest.cs b/Assets/Accounts/Tests/BasicTest.cs similarity index 100% rename from Assets/EditModeTests/BasicTest.cs rename to Assets/Accounts/Tests/BasicTest.cs diff --git a/Assets/EditModeTests/BasicTest.cs.meta b/Assets/Accounts/Tests/BasicTest.cs.meta similarity index 83% rename from Assets/EditModeTests/BasicTest.cs.meta rename to Assets/Accounts/Tests/BasicTest.cs.meta index c08356d..6984645 100644 --- a/Assets/EditModeTests/BasicTest.cs.meta +++ b/Assets/Accounts/Tests/BasicTest.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 74f8b297e568e071198f12d32c3f32c0 +guid: 46a16de014fe6a35abc9039f24c34096 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Accounts/Tests/TestProgress.cs b/Assets/Accounts/Tests/TestProgress.cs deleted file mode 100644 index 42ba708..0000000 --- a/Assets/Accounts/Tests/TestProgress.cs +++ /dev/null @@ -1,239 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using UnityEngine; - -/// -/// Test the Progress class -/// -public class TestProgress : MonoBehaviour -{ - /// - /// A dummy serializable struct to perform test operations on - /// - [Serializable] - private struct SerializableStruct - { - public int r, g, b; - public float x, y, z; - } - - /// - /// A dummy non-serializable struct to perform test operations on - /// - private struct NonSerializableStruct - { - public int r, g, b; - public float x, y, z; - } - - /// - /// Helper method - /// - /// true if Progress.AddOrUpdate(...) throws a SerializationException - private bool AddNonSerializableStruct() - { - Progress progress = new Progress(); - NonSerializableStruct nss = new NonSerializableStruct(); - try { progress.AddOrUpdate("key", nss); } - catch (SerializationException) { return true; } - return false; - } - - /// - /// Helper method - /// - /// true if Progress.Get(...) throws a KeyNotFoundException - private bool AccessInvalidKey() - { - Progress progress = new Progress(); - try { progress.Get("non-existing key"); } - catch (KeyNotFoundException) { return true; } - return false; - } - - /// - /// Helper method - /// - /// true if Progress.Get(...) throws a InvalidCastException - private bool AccessInvalidType() - { - Progress progress = new Progress(); - progress.AddOrUpdate("key", 123456789); - try { progress.Get("key"); } - catch (InvalidCastException) { return true; } - return false; - } - - /// - /// Start is called before the first frame update - /// - void Start() - { - TestNewProgress(); - TestProgressAddInvalidData(); - TestProgressAddDuplicateKey(); - TestProgressAddInt(); - TestProgressAddDouble(); - TestProgressAddString(); - TestProgressAddSerializableStruct(); - TestProgressAddNonSerializableStruct(); - TestProgressGetInvalidKey(); - TestProgressGetInvalidType(); - TestProgressUpdate(); - TestProgressGetInt(); - TestProgressGetDouble(); - TestProgressGetString(); - TestProgressGetStruct(); - } - - /// - /// Test for creation of a new progress - /// - public void TestNewProgress() - { - Progress progress = new Progress(); - Debug.Assert(progress != null); - } - - /// - /// Test whether invalid data will not be added - /// - public void TestProgressAddInvalidData() - { - Progress progress = new Progress(); - Debug.Assert(!progress.AddOrUpdate("key", null)); - } - - /// - /// Test whether a duplicated key will be added - /// - public void TestProgressAddDuplicateKey() - { - Progress progress = new Progress(); - progress.AddOrUpdate("key 1", 0); - Debug.Assert(progress.AddOrUpdate("key 1", 1)); - } - - /// - /// Test whether a int value can be added - /// - public void TestProgressAddInt() - { - Progress progress = new Progress(); - Debug.Assert(progress.AddOrUpdate("key", 1)); - } - - /// - /// Test whether a double value can be added - /// - public void TestProgressAddDouble() - { - Progress progress = new Progress(); - Debug.Assert(progress.AddOrUpdate("key", 1.0)); - } - - /// - /// Test whether a string value can be added - /// - public void TestProgressAddString() - { - Progress progress = new Progress(); - Debug.Assert(progress.AddOrUpdate("key", "Hello World!")); - } - - /// - /// Test whether a serializable struct can be added - /// - public void TestProgressAddSerializableStruct() - { - Progress progress = new Progress(); - Debug.Assert(progress.AddOrUpdate("key", new SerializableStruct())); - } - - /// - /// Test whether a non-serializable struct will throw an error - /// - public void TestProgressAddNonSerializableStruct() - { - Debug.Assert(AddNonSerializableStruct()); - } - - /// - /// Test whether an invalid key will throw an error - /// - public void TestProgressGetInvalidKey() - { - Debug.Assert(AccessInvalidKey()); - } - - /// - /// Test whether an invalid type will throw an error - /// - public void TestProgressGetInvalidType() - { - Debug.Assert(AccessInvalidType()); - } - - /// - /// Test whether a value is correctly updated - /// - public void TestProgressUpdate() - { - Progress progress = new Progress(); - progress.AddOrUpdate("key", 1); - Debug.Assert(progress.Get("key") == 1); - progress.AddOrUpdate("key", 2); - Debug.Assert(progress.Get("key") == 2); - } - - /// - /// Test whether a int value can be read - /// - public void TestProgressGetInt() - { - Progress progress = new Progress(); - progress.AddOrUpdate("key", 1); - Debug.Assert(progress.Get("key") == 1); - } - - /// - /// Test whether a double value can be read - /// - public void TestProgressGetDouble() - { - Progress progress = new Progress(); - progress.AddOrUpdate("key", 1.0); - Debug.Assert(progress.Get("key") == 1.0); - } - - /// - /// Test whether a string value can be read - /// - public void TestProgressGetString() - { - Progress progress = new Progress(); - progress.AddOrUpdate("key", "Hello World!"); - Debug.Assert(progress.Get("key") == "Hello World!"); - } - - /// - /// Test whether a serializable struct can be read - /// - public void TestProgressGetStruct() - { - Progress progress = new Progress(); - - int R = 1, G = 10, B = 100; - float X = 0.1f, Y = 0.01f, Z = 0.001f; - SerializableStruct data = new SerializableStruct { r = R, g = G, b = B, x = X, y = Y, z = Z }; - progress.AddOrUpdate("key", data); - SerializableStruct result = progress.Get("key"); - Debug.Assert(result.r == R); - Debug.Assert(result.g == G); - Debug.Assert(result.b == B); - Debug.Assert(result.x == X); - Debug.Assert(result.y == Y); - Debug.Assert(result.z == Z); - } -} diff --git a/Assets/Accounts/Tests/TestProgress.cs.meta b/Assets/Accounts/Tests/TestProgress.cs.meta deleted file mode 100644 index b3a0933..0000000 --- a/Assets/Accounts/Tests/TestProgress.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 49445c42f43d1bb488f588623826a39e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Accounts/Tests/TestUser.cs b/Assets/Accounts/Tests/TestUser.cs deleted file mode 100644 index cdd2d97..0000000 --- a/Assets/Accounts/Tests/TestUser.cs +++ /dev/null @@ -1,168 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -/// -/// Test the User class -/// -public class TestUser : MonoBehaviour -{ - /// - /// Start is called before the first frame update - /// - void Start() - { - TestNewUser(); - TestUserAddCourse(); - TestUserAddMinigame(); - TestGetRecentCoursesEmpty(); - TestGetRecentCoursesAll(); - TestGetRecommendedCoursesEmpty(); - TestGetRecommendedCoursesAll(); - TestGetCourseProgressNull(); - TestGetCourseProgressValid(); - TestGetMinigameProgressNull(); - TestGetMinigameProgressValid(); - } - - /// - /// Test for the creation of a new user - /// - public void TestNewUser() - { - User user = new User(); - Debug.Assert(user != null); - Debug.Assert(user.courses.Count == 0); - Debug.Assert(user.minigames.Count == 0); - } - - /// - /// Test whether progress on a new course can be added - /// - public void TestUserAddCourse() - { - User user = new User(); - Progress p = new Progress(); - user.courses.Add(p); - Debug.Assert(user.courses.Count == 1); - Debug.Assert(user.minigames.Count == 0); - } - - /// - /// Test whether progress on a new minigame can be added - /// - public void TestUserAddMinigame() - { - User user = new User(); - Progress p = new Progress(); - user.minigames.Add(p); - Debug.Assert(user.courses.Count == 0); - Debug.Assert(user.minigames.Count == 1); - } - - /// - /// Test GetRecentCourses will return empty when no progress is stored - /// - public void TestGetRecentCoursesEmpty() - { - User user = new User(); - Debug.Assert(user.GetRecentCourses().Count == 0); - } - - /// - /// Temporary test for GetRecentCourses will return all progress that is stored - /// - public void TestGetRecentCoursesAll() - { - User user = new User(); - Progress p = new Progress(); - p.AddOrUpdate("courseIndex", CourseIndex.FINGERSPELLING); - p.AddOrUpdate("courseProgress", 0.5f); - user.courses.Add(p); - List> list = user.GetRecentCourses(); - Debug.Assert(list.Count == 1); - Debug.Assert(list[0].Item1 == CourseIndex.FINGERSPELLING); - Debug.Assert(list[0].Item2 == 0.5f); - } - - /// - /// Test GetRecommendedCourses will return Tuple when no progress is stored - /// - public void TestGetRecommendedCoursesEmpty() - { - User user = new User(); - List> list = user.GetRecommendedCourses(); - Debug.Assert(list.Count == 1); - Debug.Assert(list[0].Item1 == CourseIndex.FINGERSPELLING); - Debug.Assert(list[0].Item2 == 0.0f); - } - - /// - /// Temporary test for GetRecommenedCourses will return all progress that is stored - /// - public void TestGetRecommendedCoursesAll() - { - User user = new User(); - Progress p = new Progress(); - p.AddOrUpdate("courseIndex", CourseIndex.FINGERSPELLING); - p.AddOrUpdate("courseProgress", 0.5f); - user.courses.Add(p); - List> list = user.GetRecommendedCourses(); - Debug.Assert(list.Count == 1); - Debug.Assert(list[0].Item1 == CourseIndex.FINGERSPELLING); - Debug.Assert(list[0].Item2 == 0.5f); - } - - /// - /// Test GetCourseProgress returns null when course cannot be found - /// - public void TestGetCourseProgressNull() - { - User user = new User(); - Debug.Assert(user.GetCourseProgress(CourseIndex.FINGERSPELLING) == null); - Debug.Assert(user.GetCourseProgress((CourseIndex)100) == null); - } - - /// - /// Test GetCourseProgress returns correct progress object - /// - public void TestGetCourseProgressValid() - { - User user = new User(); - Progress p = new Progress(); - p.AddOrUpdate("courseIndex", CourseIndex.FINGERSPELLING); - p.AddOrUpdate("courseProgress", 3.14159265f); - user.courses.Add(p); - Progress q = user.GetCourseProgress(CourseIndex.FINGERSPELLING); - Debug.Assert(q.Get("courseIndex") == CourseIndex.FINGERSPELLING); - Debug.Assert(q.Get("courseProgress") == 3.14159265f); - } - - /// - /// Test GetMinigameProgress returns null when minigame cannot be found - /// - public void TestGetMinigameProgressNull() - { - User user = new User(); - Debug.Assert(user.GetMinigameProgress(MinigameIndex.SPELLING_BEE) == null); - Debug.Assert(user.GetMinigameProgress((MinigameIndex)100) == null); - - Progress p = new Progress(); - p.AddOrUpdate("minigameIndex", MinigameIndex.SPELLING_BEE); - user.minigames.Add(p); - Debug.Assert(user.GetMinigameProgress(MinigameIndex.HANGMAN) == null); - } - - /// - /// Test GetMinigameProgress returns correct progress object - /// - public void TestGetMinigameProgressValid() - { - User user = new User(); - Progress p = new Progress(); - p.AddOrUpdate("minigameIndex", MinigameIndex.SPELLING_BEE); - user.minigames.Add(p); - Progress q = user.GetMinigameProgress(MinigameIndex.SPELLING_BEE); - Debug.Assert(q.Get("minigameIndex") == CourseIndex.FINGERSPELLING); - } -} diff --git a/Assets/Accounts/Tests/TestUser.cs.meta b/Assets/Accounts/Tests/TestUser.cs.meta deleted file mode 100644 index 60f1ad2..0000000 --- a/Assets/Accounts/Tests/TestUser.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 97bd2549f1c48d34db7cbccca17fc336 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Accounts/Tests/TestUserCreationScreen.cs b/Assets/Accounts/Tests/TestUserCreationScreen.cs deleted file mode 100644 index 8eb4efd..0000000 --- a/Assets/Accounts/Tests/TestUserCreationScreen.cs +++ /dev/null @@ -1,39 +0,0 @@ -using UnityEngine; - -/// -/// Test the UserCreationScreen class -/// -public class TestUserCreationScreen : MonoBehaviour -{ - /// - /// Start is called before the first frame update - /// - void Start() - { - TestIsValidUsernameTrue(); - TestIsValidUsernameFalse(); - } - - /// - /// Tets IsValidUsername will return true for an valid username - /// - public void TestIsValidUsernameTrue() - { - foreach (char c in "abcdefghijklmnopqrstuvwxyz") - Debug.Assert(UserCreationScreen.IsValidUsername(c.ToString())); - - Debug.Assert(UserCreationScreen.IsValidUsername("abcdefghijkl")); - } - - /// - /// Tets IsValidUsername will return false for an invalid username - /// - public void TestIsValidUsernameFalse() - { - Debug.Assert(!UserCreationScreen.IsValidUsername(string.Empty)); - foreach (char c in " \n\t0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-*/%_(){}[]\\") - Debug.Assert(!UserCreationScreen.IsValidUsername(c.ToString())); - - Debug.Assert(!UserCreationScreen.IsValidUsername("abcdefghijklmnopqrstuvwxyz")); - } -} diff --git a/Assets/Common/Tests/BasicTest.cs b/Assets/Common/Tests/BasicTest.cs new file mode 100644 index 0000000..6c756b8 --- /dev/null +++ b/Assets/Common/Tests/BasicTest.cs @@ -0,0 +1,11 @@ +using NUnit.Framework; + +public class BasicTest +{ + // check if edit mode tests works + [Test] + public void AlwaysTrueTest() + { + Assert.True(true); + } +} diff --git a/Assets/Accounts/Tests/TestUserCreationScreen.cs.meta b/Assets/Common/Tests/BasicTest.cs.meta similarity index 83% rename from Assets/Accounts/Tests/TestUserCreationScreen.cs.meta rename to Assets/Common/Tests/BasicTest.cs.meta index f1659b3..56ffe4f 100644 --- a/Assets/Accounts/Tests/TestUserCreationScreen.cs.meta +++ b/Assets/Common/Tests/BasicTest.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b6dabaf99e10900459274641f4cc9010 +guid: b4acb5e526382aaea882209bd2f0a075 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Common/Tests/CommonTests.asmdef b/Assets/Common/Tests/CommonTests.asmdef new file mode 100644 index 0000000..eaf6894 --- /dev/null +++ b/Assets/Common/Tests/CommonTests.asmdef @@ -0,0 +1,9 @@ +{ + "name": "CommonTests", + "optionalUnityReferences": [ + "TestAssemblies" + ], + "includePlatforms": [ + "Editor" + ] +} \ No newline at end of file diff --git a/Assets/Common/Tests/CommonTests.asmdef.meta b/Assets/Common/Tests/CommonTests.asmdef.meta new file mode 100644 index 0000000..c1d43bb --- /dev/null +++ b/Assets/Common/Tests/CommonTests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 51e9387d41ea4c92e959a2181b19e568 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 9bcb37e..b1bb9b5 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -149,13 +149,16 @@ PlayerSettings: useHDRDisplay: 0 D3DHDRBitDepth: 0 m_ColorGamuts: 00000000 - targetPixelDensity: 0 + targetPixelDensity: 30 resolutionScalingMode: 0 resetResolutionOnWindowResize: 0 androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 applicationIdentifier: {} - buildNumber: {} + buildNumber: + Standalone: 0 + iPhone: 0 + tvOS: 0 overrideDefaultApplicationIdentifier: 0 AndroidBundleVersionCode: 1 AndroidMinSdkVersion: 22 @@ -173,10 +176,10 @@ PlayerSettings: StripUnusedMeshComponents: 0 VertexChannelCompressionMask: 4054 iPhoneSdkVersion: 988 - iOSTargetOSVersionString: + iOSTargetOSVersionString: 11.0 tvOSSdkVersion: 0 tvOSRequireExtendedGameController: 0 - tvOSTargetOSVersionString: + tvOSTargetOSVersionString: 11.0 uIPrerenderedIcon: 0 uIRequiresPersistentWiFi: 0 uIRequiresFullScreen: 1