diff --git a/README.md b/README.md index 8554f97..c1deef6 100644 --- a/README.md +++ b/README.md @@ -215,12 +215,14 @@ using RhythmGameUtilities; var value = Utilities.RoundUpToTheNearestMultiplier(12, 10); ``` -#### `Utilities.Lerp` +### Common + +#### `Common.Lerp` ```csharp using RhythmGameUtilities; -var value = Utilities.Lerp(0, 10, 0.5f); +var value = Common.Lerp(0, 10, 0.5f); ``` #### `Utilities.InverseLerp` @@ -228,7 +230,7 @@ var value = Utilities.Lerp(0, 10, 0.5f); ```csharp using RhythmGameUtilities; -var value = Utilities.InverseLerp(0, 10, 5); +var value = Common.InverseLerp(0, 10, 5); ``` ## Architecture diff --git a/RhythmGameUtilities.Tests/CommonTest.cs b/RhythmGameUtilities.Tests/CommonTest.cs new file mode 100644 index 0000000..65d88ce --- /dev/null +++ b/RhythmGameUtilities.Tests/CommonTest.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; + +namespace RhythmGameUtilities.Tests +{ + + public class CommonTest + { + + [Test] + public void TestLerp() + { + Assert.That(Common.Lerp(0, 10, 0), Is.EqualTo(0)); + Assert.That(Common.Lerp(0, 10, 0.5f), Is.EqualTo(5)); + Assert.That(Common.Lerp(0, 10, 1), Is.EqualTo(10)); + } + + [Test] + public void TestInverseLerp() + { + Assert.That(Common.InverseLerp(0, 10, 0), Is.EqualTo(0)); + Assert.That(Common.InverseLerp(0, 10, 5), Is.EqualTo(0.5f)); + Assert.That(Common.InverseLerp(0, 10, 10), Is.EqualTo(1)); + } + + } + +} diff --git a/RhythmGameUtilities.Tests/UtilitiesTest.cs b/RhythmGameUtilities.Tests/UtilitiesTest.cs index b8835b9..7677102 100644 --- a/RhythmGameUtilities.Tests/UtilitiesTest.cs +++ b/RhythmGameUtilities.Tests/UtilitiesTest.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using NUnit.Framework; @@ -52,22 +51,6 @@ public void TestRoundUpToTheNearestMultiplier() Assert.That(Utilities.RoundUpToTheNearestMultiplier(12, 10), Is.EqualTo(20)); } - [Test] - public void TestLerp() - { - Assert.That(Utilities.Lerp(0, 10, 0), Is.EqualTo(0)); - Assert.That(Utilities.Lerp(0, 10, 0.5f), Is.EqualTo(5)); - Assert.That(Utilities.Lerp(0, 10, 1), Is.EqualTo(10)); - } - - [Test] - public void TestInverseLerp() - { - Assert.That(Utilities.InverseLerp(0, 10, 0), Is.EqualTo(0)); - Assert.That(Utilities.InverseLerp(0, 10, 5), Is.EqualTo(0.5f)); - Assert.That(Utilities.InverseLerp(0, 10, 10), Is.EqualTo(1)); - } - [Test] public void TestCalculateBeatBars() { diff --git a/RhythmGameUtilities/Scripts/Common.cs b/RhythmGameUtilities/Scripts/Common.cs new file mode 100644 index 0000000..b5b48a4 --- /dev/null +++ b/RhythmGameUtilities/Scripts/Common.cs @@ -0,0 +1,44 @@ +using System.Runtime.InteropServices; + +namespace RhythmGameUtilities +{ + + public static class CommonInternal + { + +#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN + [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] +#elif MACOS_BUILD || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX + [DllImport("libRhythmGameUtilities.dylib", CallingConvention = CallingConvention.Cdecl)] +#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX + [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] +#endif + public static extern float Lerp(float a, float b, float t); + +#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN + [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] +#elif MACOS_BUILD || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX + [DllImport("libRhythmGameUtilities.dylib", CallingConvention = CallingConvention.Cdecl)] +#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX + [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] +#endif + public static extern float InverseLerp(float a, float b, float v); + + } + + public static class Common + { + + public static float Lerp(float a, float b, float t) + { + return CommonInternal.Lerp(a, b, t); + } + + public static float InverseLerp(float a, float b, float v) + { + return CommonInternal.InverseLerp(a, b, v); + } + + } + +} diff --git a/RhythmGameUtilities/Scripts/Utilities.cs b/RhythmGameUtilities/Scripts/Utilities.cs index c8db2d5..04cd5e9 100644 --- a/RhythmGameUtilities/Scripts/Utilities.cs +++ b/RhythmGameUtilities/Scripts/Utilities.cs @@ -46,24 +46,6 @@ public static extern int ConvertSecondsToTicksInternal(float seconds, int resolu #endif public static extern int RoundUpToTheNearestMultiplier(int value, int multiplier); -#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN - [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] -#elif MACOS_BUILD || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX - [DllImport("libRhythmGameUtilities.dylib", CallingConvention = CallingConvention.Cdecl)] -#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX - [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] -#endif - public static extern float Lerp(float a, float b, float t); - -#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN - [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] -#elif MACOS_BUILD || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX - [DllImport("libRhythmGameUtilities.dylib", CallingConvention = CallingConvention.Cdecl)] -#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX - [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] -#endif - public static extern float InverseLerp(float a, float b, float v); - #if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] #elif MACOS_BUILD || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX @@ -103,16 +85,6 @@ public static int RoundUpToTheNearestMultiplier(int value, int multiplier) return UtilitiesInternal.RoundUpToTheNearestMultiplier(value, multiplier); } - public static float Lerp(float a, float b, float t) - { - return UtilitiesInternal.Lerp(a, b, t); - } - - public static float InverseLerp(float a, float b, float v) - { - return UtilitiesInternal.InverseLerp(a, b, v); - } - public static List CalculateBeatBars(Dictionary bpmChanges, int resolution = 192, int ts = 4, bool includeHalfNotes = true) { diff --git a/UnityPackage/Editor/Tests/CommonTest.cs b/UnityPackage/Editor/Tests/CommonTest.cs new file mode 100644 index 0000000..65d88ce --- /dev/null +++ b/UnityPackage/Editor/Tests/CommonTest.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; + +namespace RhythmGameUtilities.Tests +{ + + public class CommonTest + { + + [Test] + public void TestLerp() + { + Assert.That(Common.Lerp(0, 10, 0), Is.EqualTo(0)); + Assert.That(Common.Lerp(0, 10, 0.5f), Is.EqualTo(5)); + Assert.That(Common.Lerp(0, 10, 1), Is.EqualTo(10)); + } + + [Test] + public void TestInverseLerp() + { + Assert.That(Common.InverseLerp(0, 10, 0), Is.EqualTo(0)); + Assert.That(Common.InverseLerp(0, 10, 5), Is.EqualTo(0.5f)); + Assert.That(Common.InverseLerp(0, 10, 10), Is.EqualTo(1)); + } + + } + +} diff --git a/UnityPackage/Editor/Tests/CommonTest.cs.meta b/UnityPackage/Editor/Tests/CommonTest.cs.meta new file mode 100644 index 0000000..2a956b9 --- /dev/null +++ b/UnityPackage/Editor/Tests/CommonTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c0a644445298c40438975bd463987717 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackage/Editor/Tests/UtilitiesTest.cs b/UnityPackage/Editor/Tests/UtilitiesTest.cs index b8835b9..7677102 100644 --- a/UnityPackage/Editor/Tests/UtilitiesTest.cs +++ b/UnityPackage/Editor/Tests/UtilitiesTest.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using NUnit.Framework; @@ -52,22 +51,6 @@ public void TestRoundUpToTheNearestMultiplier() Assert.That(Utilities.RoundUpToTheNearestMultiplier(12, 10), Is.EqualTo(20)); } - [Test] - public void TestLerp() - { - Assert.That(Utilities.Lerp(0, 10, 0), Is.EqualTo(0)); - Assert.That(Utilities.Lerp(0, 10, 0.5f), Is.EqualTo(5)); - Assert.That(Utilities.Lerp(0, 10, 1), Is.EqualTo(10)); - } - - [Test] - public void TestInverseLerp() - { - Assert.That(Utilities.InverseLerp(0, 10, 0), Is.EqualTo(0)); - Assert.That(Utilities.InverseLerp(0, 10, 5), Is.EqualTo(0.5f)); - Assert.That(Utilities.InverseLerp(0, 10, 10), Is.EqualTo(1)); - } - [Test] public void TestCalculateBeatBars() { diff --git a/UnityPackage/README.md b/UnityPackage/README.md index 8554f97..c1deef6 100644 --- a/UnityPackage/README.md +++ b/UnityPackage/README.md @@ -215,12 +215,14 @@ using RhythmGameUtilities; var value = Utilities.RoundUpToTheNearestMultiplier(12, 10); ``` -#### `Utilities.Lerp` +### Common + +#### `Common.Lerp` ```csharp using RhythmGameUtilities; -var value = Utilities.Lerp(0, 10, 0.5f); +var value = Common.Lerp(0, 10, 0.5f); ``` #### `Utilities.InverseLerp` @@ -228,7 +230,7 @@ var value = Utilities.Lerp(0, 10, 0.5f); ```csharp using RhythmGameUtilities; -var value = Utilities.InverseLerp(0, 10, 5); +var value = Common.InverseLerp(0, 10, 5); ``` ## Architecture diff --git a/UnityPackage/Scripts/Common.cs b/UnityPackage/Scripts/Common.cs new file mode 100644 index 0000000..b5b48a4 --- /dev/null +++ b/UnityPackage/Scripts/Common.cs @@ -0,0 +1,44 @@ +using System.Runtime.InteropServices; + +namespace RhythmGameUtilities +{ + + public static class CommonInternal + { + +#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN + [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] +#elif MACOS_BUILD || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX + [DllImport("libRhythmGameUtilities.dylib", CallingConvention = CallingConvention.Cdecl)] +#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX + [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] +#endif + public static extern float Lerp(float a, float b, float t); + +#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN + [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] +#elif MACOS_BUILD || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX + [DllImport("libRhythmGameUtilities.dylib", CallingConvention = CallingConvention.Cdecl)] +#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX + [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] +#endif + public static extern float InverseLerp(float a, float b, float v); + + } + + public static class Common + { + + public static float Lerp(float a, float b, float t) + { + return CommonInternal.Lerp(a, b, t); + } + + public static float InverseLerp(float a, float b, float v) + { + return CommonInternal.InverseLerp(a, b, v); + } + + } + +} diff --git a/UnityPackage/Scripts/Common.cs.meta b/UnityPackage/Scripts/Common.cs.meta new file mode 100644 index 0000000..d6f25a1 --- /dev/null +++ b/UnityPackage/Scripts/Common.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1e220e1e98c7b442d89c164a0d28ee49 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackage/Scripts/Utilities.cs b/UnityPackage/Scripts/Utilities.cs index c8db2d5..04cd5e9 100644 --- a/UnityPackage/Scripts/Utilities.cs +++ b/UnityPackage/Scripts/Utilities.cs @@ -46,24 +46,6 @@ public static extern int ConvertSecondsToTicksInternal(float seconds, int resolu #endif public static extern int RoundUpToTheNearestMultiplier(int value, int multiplier); -#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN - [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] -#elif MACOS_BUILD || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX - [DllImport("libRhythmGameUtilities.dylib", CallingConvention = CallingConvention.Cdecl)] -#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX - [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] -#endif - public static extern float Lerp(float a, float b, float t); - -#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN - [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] -#elif MACOS_BUILD || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX - [DllImport("libRhythmGameUtilities.dylib", CallingConvention = CallingConvention.Cdecl)] -#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX - [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] -#endif - public static extern float InverseLerp(float a, float b, float v); - #if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] #elif MACOS_BUILD || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX @@ -103,16 +85,6 @@ public static int RoundUpToTheNearestMultiplier(int value, int multiplier) return UtilitiesInternal.RoundUpToTheNearestMultiplier(value, multiplier); } - public static float Lerp(float a, float b, float t) - { - return UtilitiesInternal.Lerp(a, b, t); - } - - public static float InverseLerp(float a, float b, float v) - { - return UtilitiesInternal.InverseLerp(a, b, v); - } - public static List CalculateBeatBars(Dictionary bpmChanges, int resolution = 192, int ts = 4, bool includeHalfNotes = true) { diff --git a/includes/RhythmGameUtilities/Common.hpp b/includes/RhythmGameUtilities/Common.hpp new file mode 100644 index 0000000..d1eb60e --- /dev/null +++ b/includes/RhythmGameUtilities/Common.hpp @@ -0,0 +1,88 @@ +#pragma once + +#include +#include + +#ifdef _WIN32 +#define PACKAGE_API __declspec(dllexport) +#else +#define PACKAGE_API +#endif + +namespace RhythmGameUtilities +{ + +extern "C" +{ + + PACKAGE_API float Lerp(float a, float b, float t) + { + return (1 - t) * a + b * t; + } + + PACKAGE_API float InverseLerp(float a, float b, float v) + { + return std::clamp(((v - a) / (b - a)), 0.0f, 1.0f); + } +} +std::string Trim(const char *contents) +{ + return std::regex_replace(contents, std::regex("^\\s+|\\s+$"), ""); +} + +std::vector Split(const char *contents, const char delimiter) +{ + auto parts = std::vector(); + + std::stringstream input(contents); + + std::string str; + + while (std::getline(input, str, delimiter)) + { + parts.push_back(str); + } + + return parts; +} + +std::vector FindAllMatches(const char *contents, + std::regex pattern) +{ + auto currentMatch = + std::cregex_iterator(contents, contents + strlen(contents), pattern); + auto lastMatch = std::cregex_iterator(); + + auto matches = std::vector(); + + while (currentMatch != lastMatch) + { + auto match = *currentMatch; + + matches.push_back(match.str(0)); + + currentMatch++; + } + + return matches; +} + +std::vector FindMatchGroups(const char *contents, + std::regex pattern) +{ + auto currentMatch = + std::cregex_iterator(contents, contents + strlen(contents), pattern); + + auto matches = std::vector(); + + auto match = *currentMatch; + + for (auto i = 0; i < match.size(); i += 1) + { + matches.push_back(match.str(i)); + } + + return matches; +} + +} // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Parsers.hpp b/includes/RhythmGameUtilities/Parsers.hpp index 730f9ba..4147489 100644 --- a/includes/RhythmGameUtilities/Parsers.hpp +++ b/includes/RhythmGameUtilities/Parsers.hpp @@ -12,6 +12,7 @@ #include "Structs/Note.h" +#include "Common.hpp" #include "Utilities.hpp" #ifdef _WIN32 diff --git a/includes/RhythmGameUtilities/Utilities.hpp b/includes/RhythmGameUtilities/Utilities.hpp index abef558..6c9d225 100644 --- a/includes/RhythmGameUtilities/Utilities.hpp +++ b/includes/RhythmGameUtilities/Utilities.hpp @@ -2,9 +2,6 @@ #include #include -#include -#include -#include #include #include "Structs/BeatBar.h" @@ -115,7 +112,6 @@ std::vector CalculateBeatBars(std::map bpmChanges, extern "C" { - /** * Convert a tick to a 2D/3D position. * @@ -152,76 +148,6 @@ extern "C" { return (int)std::ceil((float)value / multiplier) * multiplier; } - - PACKAGE_API float Lerp(float a, float b, float t) - { - return (1 - t) * a + b * t; - } - - PACKAGE_API float InverseLerp(float a, float b, float v) - { - return std::clamp(((v - a) / (b - a)), 0.0f, 1.0f); - } -} - -std::string Trim(const char *contents) -{ - return std::regex_replace(contents, std::regex("^\\s+|\\s+$"), ""); -} - -std::vector Split(const char *contents, const char delimiter) -{ - auto parts = std::vector(); - - std::stringstream input(contents); - - std::string str; - - while (std::getline(input, str, delimiter)) - { - parts.push_back(str); - } - - return parts; -} - -std::vector FindAllMatches(const char *contents, - std::regex pattern) -{ - auto currentMatch = - std::cregex_iterator(contents, contents + strlen(contents), pattern); - auto lastMatch = std::cregex_iterator(); - - auto matches = std::vector(); - - while (currentMatch != lastMatch) - { - auto match = *currentMatch; - - matches.push_back(match.str(0)); - - currentMatch++; - } - - return matches; -} - -std::vector FindMatchGroups(const char *contents, - std::regex pattern) -{ - auto currentMatch = - std::cregex_iterator(contents, contents + strlen(contents), pattern); - - auto matches = std::vector(); - - auto match = *currentMatch; - - for (auto i = 0; i < match.size(); i += 1) - { - matches.push_back(match.str(i)); - } - - return matches; } } // namespace RhythmGameUtilities diff --git a/tests/RhythmGameUtilities/Common.cpp b/tests/RhythmGameUtilities/Common.cpp new file mode 100644 index 0000000..7e4b47d --- /dev/null +++ b/tests/RhythmGameUtilities/Common.cpp @@ -0,0 +1,58 @@ +#include +#include +#include +#include + +#include "RhythmGameUtilities/Common.hpp" + +using namespace RhythmGameUtilities; + +void testTrim() +{ + assert(Trim(" test ") == "test"); + + std::cout << "."; +} + +void testSplit() +{ + auto parts = Split("key=value", '='); + + assert(parts.size() == 2); + assert(parts[0] == "key"); + assert(parts[1] == "value"); + + std::cout << "."; +} + +void testFindAllMatches() +{ + std::regex pattern("\\w+"); + + auto sections = FindAllMatches("this is a test", pattern); + + assert(sections.size() == 4); + + std::cout << "."; +} + +void testFindMatchGroups() +{ + std::regex pattern("(\\w+)\\s+(\\w+)\\s+(\\w+)\\s+(\\w+)"); + + auto sections = FindMatchGroups("this is a test", pattern); + + assert(sections.size() == 5); + + std::cout << "."; +} + +int main() +{ + testTrim(); + testSplit(); + testFindAllMatches(); + testFindMatchGroups(); + + return 0; +} diff --git a/tests/RhythmGameUtilities/Utilities.cpp b/tests/RhythmGameUtilities/Utilities.cpp index 976bda2..59dd5c1 100644 --- a/tests/RhythmGameUtilities/Utilities.cpp +++ b/tests/RhythmGameUtilities/Utilities.cpp @@ -34,24 +34,6 @@ void testIsOnTheBeat() std::cout << "."; } -void testLerp() -{ - assert(0 == Lerp(0, 10, 0)); - assert(5 == Lerp(0, 10, 0.5f)); - assert(10 == Lerp(0, 10, 1)); - - std::cout << "."; -} - -void testInverseLerp() -{ - assert(0 == InverseLerp(0, 10, 0)); - assert(0.5f == InverseLerp(0, 10, 5)); - assert(1 == InverseLerp(0, 10, 10)); - - std::cout << "."; -} - void testRoundUpToTheNearestMultiplier() { assert(20 == RoundUpToTheNearestMultiplier(12, 10)); @@ -59,24 +41,6 @@ void testRoundUpToTheNearestMultiplier() std::cout << "."; } -void testTrim() -{ - assert(Trim(" test ") == "test"); - - std::cout << "."; -} - -void testSplit() -{ - auto parts = Split("key=value", '='); - - assert(parts.size() == 2); - assert(parts[0] == "key"); - assert(parts[1] == "value"); - - std::cout << "."; -} - void testGenerateAdjacentKeyPairs() { std::map bpmChanges = { @@ -105,43 +69,14 @@ void testCalculateBeatBars() std::cout << "."; } -void testFindAllMatches() -{ - std::regex pattern("\\w+"); - - auto sections = FindAllMatches("this is a test", pattern); - - assert(sections.size() == 4); - - std::cout << "."; -} - -void testFindMatchGroups() -{ - std::regex pattern("(\\w+)\\s+(\\w+)\\s+(\\w+)\\s+(\\w+)"); - - auto sections = FindMatchGroups("this is a test", pattern); - - assert(sections.size() == 5); - - std::cout << "."; -} - int main() { testConvertTickToPosition(); testConvertSecondsToTicks(); testIsOnTheBeat(); - testLerp(); - testInverseLerp(); testRoundUpToTheNearestMultiplier(); - - testTrim(); - testSplit(); testGenerateAdjacentKeyPairs(); testCalculateBeatBars(); - testFindAllMatches(); - testFindMatchGroups(); return 0; }