Resolve WES-113 "Write tests"
This commit is contained in:
committed by
Dries Van Schuylenbergh
parent
96fb3c89c3
commit
f6e6afe340
17
Assets/Accounts/Scripts/AccountsScripts.asmdef
Normal file
17
Assets/Accounts/Scripts/AccountsScripts.asmdef
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "AccountsScripts",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:df9d7b70293a2e14d9d3a018c3956f7a"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3d66002fb543bf3fa03c11006f8cb3a
|
||||
guid: 1631ed2680c61245b8211d943c1639a8
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e901944427bb1104a881881efebd3737
|
||||
guid: bf5ea73aa43049e45a0ad926db15f315
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
27
Assets/Accounts/Tests/AccountsTests.asmdef
Normal file
27
Assets/Accounts/Tests/AccountsTests.asmdef
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "AccountsTests",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"UnityEngine.TestRunner",
|
||||
"UnityEditor.TestRunner",
|
||||
"AccountsScripts",
|
||||
"InterfacesScripts"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": true,
|
||||
"precompiledReferences": [
|
||||
"nunit.framework.dll",
|
||||
"nunit.framework.dll"
|
||||
],
|
||||
"autoReferenced": false,
|
||||
"defineConstraints": [
|
||||
"UNITY_INCLUDE_TESTS",
|
||||
"UNITY_INCLUDE_TESTS"
|
||||
],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a55a1703b7efe449be66773a42e7ff0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
guid: 8500f5aede7627729bd8c97b15e541c4
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
@@ -1,3 +1,4 @@
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
@@ -90,6 +91,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test for creation of a new progress
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestNewProgress()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
@@ -99,6 +101,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether invalid data will not be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddInvalidData()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
@@ -108,6 +111,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether a duplicated key will be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddDuplicateKey()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
@@ -118,6 +122,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether a <c>int</c> value can be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddInt()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
@@ -127,6 +132,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether a <c>double</c> value can be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddDouble()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
@@ -136,6 +142,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether a <c>string</c> value can be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddString()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
@@ -145,6 +152,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether a serializable struct can be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddSerializableStruct()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
@@ -154,6 +162,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether a non-serializable struct will throw an error
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddNonSerializableStruct()
|
||||
{
|
||||
Debug.Assert(AddNonSerializableStruct());
|
||||
@@ -162,6 +171,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether an invalid key will throw an error
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetInvalidKey()
|
||||
{
|
||||
Debug.Assert(AccessInvalidKey());
|
||||
@@ -170,6 +180,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether an invalid type will throw an error
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetInvalidType()
|
||||
{
|
||||
Debug.Assert(AccessInvalidType());
|
||||
@@ -178,6 +189,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether a value is correctly updated
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressUpdate()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
@@ -190,6 +202,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether a <c>int</c> value can be read
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetInt()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
@@ -200,6 +213,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether a <c>double</c> value can be read
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetDouble()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
@@ -210,6 +224,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether a <c>string</c> value can be read
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetString()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
@@ -220,6 +235,7 @@ public class TestProgress : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Test whether a serializable struct can be read
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetStruct()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ec4b51665a3e7b499aa9c64fc9c7462
|
||||
guid: e88996685ebf2274ea70a64e08b7ddd7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ac4eb825ce7bf5499f083eaf34d5d4d
|
||||
guid: a5bf21dee022ed0489face1c734359de
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
3
Assets/Common/Interfaces/InterfacesScripts.asmdef
Normal file
3
Assets/Common/Interfaces/InterfacesScripts.asmdef
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "InterfacesScripts"
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55cd80546e3f9d043b59677c12f0e891
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
guid: df9d7b70293a2e14d9d3a018c3956f7a
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44a1fb926248fe240bed2d5c3820630b
|
||||
guid: 97282ff3b465e3c4682d218b3819b2e8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
12
Assets/Common/Interfaces/Score.cs
Normal file
12
Assets/Common/Interfaces/Score.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Score class TODO: Move to separate file
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Score
|
||||
{
|
||||
public int scoreValue;
|
||||
public string time;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efccb8a8c7f87c9629872169190107db
|
||||
guid: 295706da5995d69468daf35ad5527089
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
19
Assets/Common/Scripts/CommonScripts.asmdef
Normal file
19
Assets/Common/Scripts/CommonScripts.asmdef
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "CommonScripts",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:63c63e721f65ebb7d871cb9ef49f4752",
|
||||
"GUID:1631ed2680c61245b8211d943c1639a8",
|
||||
"GUID:df9d7b70293a2e14d9d3a018c3956f7a"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/Common/Scripts/CommonScripts.asmdef.meta
Normal file
7
Assets/Common/Scripts/CommonScripts.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3444c67d5a3a93e5a95a48906078c372
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -107,7 +107,7 @@ public class MinigameActivityScreen : MonoBehaviour
|
||||
int index = minigameList.currentMinigameIndex;
|
||||
Minigame minigame = minigameList.minigames[index];
|
||||
|
||||
List<Tuple<string, Sprite, GameController.Score>> allScores = new List<Tuple<string, Sprite, GameController.Score>>();
|
||||
List<Tuple<string, Sprite, Score>> allScores = new List<Tuple<string, Sprite, Score>>();
|
||||
foreach (User user in userList.GetUsers())
|
||||
{
|
||||
// Get user's progress for this minigame
|
||||
@@ -115,10 +115,10 @@ public class MinigameActivityScreen : MonoBehaviour
|
||||
if (progress != null)
|
||||
{
|
||||
// Add scores to dictionary
|
||||
List<GameController.Score> scores = progress.Get<List<GameController.Score>>("scores");
|
||||
foreach (GameController.Score score in scores)
|
||||
List<Score> scores = progress.Get<List<Score>>("scores");
|
||||
foreach (Score score in scores)
|
||||
{
|
||||
allScores.Add(new Tuple<string, Sprite, GameController.Score>(user.username, user.avatar, score));
|
||||
allScores.Add(new Tuple<string, Sprite, Score>(user.username, user.avatar, score));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,11 +127,11 @@ public class MinigameActivityScreen : MonoBehaviour
|
||||
allScores.Sort((a, b) => b.Item3.scoreValue.CompareTo(a.Item3.scoreValue));
|
||||
|
||||
// Instantiate scoreboard entries
|
||||
foreach (Tuple<string, Sprite, GameController.Score> tup in allScores.Take(3))
|
||||
foreach (Tuple<string, Sprite, Score> tup in allScores.Take(3))
|
||||
{
|
||||
string username = tup.Item1;
|
||||
Sprite sprite = tup.Item2;
|
||||
GameController.Score score = tup.Item3;
|
||||
Score score = tup.Item3;
|
||||
|
||||
GameObject instance = GameObject.Instantiate(prefab, userContainer);
|
||||
instance.transform.Find("Title").GetComponent<TMP_Text>().text = username;
|
||||
|
||||
18
Assets/Courses/Scripts/CourseScripts.asmdef
Normal file
18
Assets/Courses/Scripts/CourseScripts.asmdef
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "CourseScripts",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"Unity.TextMeshPro",
|
||||
"AccountsScripts",
|
||||
"InterfacesScripts"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/Courses/Scripts/CourseScripts.asmdef.meta
Normal file
7
Assets/Courses/Scripts/CourseScripts.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63c63e721f65ebb7d871cb9ef49f4752
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,11 +0,0 @@
|
||||
using NUnit.Framework;
|
||||
|
||||
public class BasicTest
|
||||
{
|
||||
// check if edit mode tests works
|
||||
[Test]
|
||||
public void AlwaysTrueTest()
|
||||
{
|
||||
Assert.True(true);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"name": "EditModeTests",
|
||||
"optionalUnityReferences": [
|
||||
"TestAssemblies"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
]
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GameController : MonoBehaviour
|
||||
public partial class GameController : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// All of the words that can be used in this session
|
||||
@@ -191,16 +191,6 @@ public class GameController : MonoBehaviour
|
||||
/// </summary>
|
||||
public GameObject scoreboardEntry;
|
||||
|
||||
/// <summary>
|
||||
/// Score class TODO: Move to separate file
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Score
|
||||
{
|
||||
public int scoreValue;
|
||||
public string time;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
|
||||
14
Assets/SpellingBee/Scripts/Score.cs
Normal file
14
Assets/SpellingBee/Scripts/Score.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
public partial class GameController
|
||||
{
|
||||
/// <summary>
|
||||
/// Score class TODO: Move to separate file
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Score
|
||||
{
|
||||
public int scoreValue;
|
||||
public string time;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74f8b297e568e071198f12d32c3f32c0
|
||||
guid: 44c1f8e0fa862b44485ebaa3c81698fc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
19
Assets/SpellingBee/Scripts/SpellingBeeScripts.asmdef
Normal file
19
Assets/SpellingBee/Scripts/SpellingBeeScripts.asmdef
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "SpellingBeeScripts",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:1631ed2680c61245b8211d943c1639a8",
|
||||
"GUID:3444c67d5a3a93e5a95a48906078c372",
|
||||
"GUID:df9d7b70293a2e14d9d3a018c3956f7a"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49d8025a5c8c313cea12c9a1de36c09b
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,167 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class CalculatorGraphTest
|
||||
{
|
||||
private const string _ValidConfigText = @"node {
|
||||
calculator: ""PassThroughCalculator""
|
||||
input_stream: ""in""
|
||||
output_stream: ""out1""
|
||||
}
|
||||
node {
|
||||
calculator: ""PassThroughCalculator""
|
||||
input_stream: ""out1""
|
||||
output_stream: ""out""
|
||||
}
|
||||
input_stream: ""in""
|
||||
output_stream: ""out""
|
||||
";
|
||||
|
||||
#region Constructor
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiateCalculatorGraph_When_CalledWithNoArguments()
|
||||
{
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
var graph = new CalculatorGraph();
|
||||
graph.Dispose();
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiateCalculatorGraph_When_CalledWithConfigText()
|
||||
{
|
||||
using (var graph = new CalculatorGraph(_ValidConfigText))
|
||||
{
|
||||
var config = graph.Config();
|
||||
Assert.AreEqual("in", config.InputStream[0]);
|
||||
Assert.AreEqual("out", config.OutputStream[0]);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var graph = new CalculatorGraph())
|
||||
{
|
||||
Assert.False(graph.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var graph = new CalculatorGraph();
|
||||
graph.Dispose();
|
||||
|
||||
Assert.True(graph.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Initialize
|
||||
[Test]
|
||||
public void Initialize_ShouldReturnOk_When_CalledWithConfig_And_ConfigIsNotSet()
|
||||
{
|
||||
using (var graph = new CalculatorGraph())
|
||||
{
|
||||
using (var status = graph.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ValidConfigText)))
|
||||
{
|
||||
Assert.True(status.Ok());
|
||||
}
|
||||
|
||||
var config = graph.Config();
|
||||
Assert.AreEqual("in", config.InputStream[0]);
|
||||
Assert.AreEqual("out", config.OutputStream[0]);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Initialize_ShouldReturnInternalError_When_CalledWithConfig_And_ConfigIsSet()
|
||||
{
|
||||
using (var graph = new CalculatorGraph(_ValidConfigText))
|
||||
{
|
||||
using (var status = graph.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ValidConfigText)))
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.Internal, status.Code());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Initialize_ShouldReturnOk_When_CalledWithConfigAndSidePacket_And_ConfigIsNotSet()
|
||||
{
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
sidePacket.Emplace("flag", new BoolPacket(true));
|
||||
|
||||
using (var graph = new CalculatorGraph())
|
||||
{
|
||||
var config = CalculatorGraphConfig.Parser.ParseFromTextFormat(_ValidConfigText);
|
||||
|
||||
using (var status = graph.Initialize(config, sidePacket))
|
||||
{
|
||||
Assert.True(status.Ok());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Initialize_ShouldReturnInternalError_When_CalledWithConfigAndSidePacket_And_ConfigIsSet()
|
||||
{
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
sidePacket.Emplace("flag", new BoolPacket(true));
|
||||
|
||||
using (var graph = new CalculatorGraph(_ValidConfigText))
|
||||
{
|
||||
var config = CalculatorGraphConfig.Parser.ParseFromTextFormat(_ValidConfigText);
|
||||
|
||||
using (var status = graph.Initialize(config, sidePacket))
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.Internal, status.Code());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region lifecycle
|
||||
[Test]
|
||||
public void LifecycleMethods_ShouldControlGraphLifeCycle()
|
||||
{
|
||||
using (var graph = new CalculatorGraph(_ValidConfigText))
|
||||
{
|
||||
Assert.True(graph.StartRun().Ok());
|
||||
Assert.False(graph.GraphInputStreamsClosed());
|
||||
|
||||
Assert.True(graph.WaitUntilIdle().Ok());
|
||||
Assert.True(graph.CloseAllPacketSources().Ok());
|
||||
Assert.True(graph.GraphInputStreamsClosed());
|
||||
Assert.True(graph.WaitUntilDone().Ok());
|
||||
Assert.False(graph.HasError());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Cancel_ShouldCancelGraph()
|
||||
{
|
||||
using (var graph = new CalculatorGraph(_ValidConfigText))
|
||||
{
|
||||
Assert.True(graph.StartRun().Ok());
|
||||
graph.Cancel();
|
||||
Assert.AreEqual(Status.StatusCode.Cancelled, graph.WaitUntilDone().Code());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 083c8421f4820d09290f0de495a23ec2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,256 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Unity.Collections;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class ImageFrameTest
|
||||
{
|
||||
#region Constructor
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiateImageFrame_When_CalledWithNoArguments()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame())
|
||||
{
|
||||
Assert.AreEqual(ImageFormat.Types.Format.Unknown, imageFrame.Format());
|
||||
Assert.AreEqual(0, imageFrame.Width());
|
||||
Assert.AreEqual(0, imageFrame.Height(), 0);
|
||||
Assert.AreEqual(0, imageFrame.ChannelSize());
|
||||
Assert.AreEqual(0, imageFrame.NumberOfChannels());
|
||||
Assert.AreEqual(0, imageFrame.ByteDepth());
|
||||
Assert.AreEqual(0, imageFrame.WidthStep());
|
||||
Assert.AreEqual(0, imageFrame.PixelDataSize());
|
||||
Assert.AreEqual(0, imageFrame.PixelDataSizeStoredContiguously());
|
||||
Assert.True(imageFrame.IsEmpty());
|
||||
Assert.False(imageFrame.IsContiguous());
|
||||
Assert.False(imageFrame.IsAligned(16));
|
||||
Assert.AreEqual(IntPtr.Zero, imageFrame.MutablePixelData());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiateImageFrame_When_CalledWithFormat()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Sbgra, 640, 480))
|
||||
{
|
||||
Assert.AreEqual(ImageFormat.Types.Format.Sbgra, imageFrame.Format());
|
||||
Assert.AreEqual(640, imageFrame.Width());
|
||||
Assert.AreEqual(480, imageFrame.Height());
|
||||
Assert.AreEqual(1, imageFrame.ChannelSize());
|
||||
Assert.AreEqual(4, imageFrame.NumberOfChannels());
|
||||
Assert.AreEqual(1, imageFrame.ByteDepth());
|
||||
Assert.AreEqual(640 * 4, imageFrame.WidthStep());
|
||||
Assert.AreEqual(640 * 480 * 4, imageFrame.PixelDataSize());
|
||||
Assert.AreEqual(640 * 480 * 4, imageFrame.PixelDataSizeStoredContiguously());
|
||||
Assert.False(imageFrame.IsEmpty());
|
||||
Assert.True(imageFrame.IsContiguous());
|
||||
Assert.True(imageFrame.IsAligned(16));
|
||||
Assert.AreNotEqual(IntPtr.Zero, imageFrame.MutablePixelData());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiateImageFrame_When_CalledWithFormatAndAlignmentBoundary()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Gray8, 100, 100, 8))
|
||||
{
|
||||
Assert.AreEqual(100, imageFrame.Width());
|
||||
Assert.AreEqual(1, imageFrame.NumberOfChannels());
|
||||
Assert.AreEqual(104, imageFrame.WidthStep());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiateImageFrame_When_CalledWithPixelData()
|
||||
{
|
||||
var pixelData = new NativeArray<byte>(32, Allocator.Temp, NativeArrayOptions.UninitializedMemory);
|
||||
var srcBytes = new byte[] {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
};
|
||||
pixelData.CopyFrom(srcBytes);
|
||||
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Sbgra, 4, 2, 16, pixelData))
|
||||
{
|
||||
Assert.AreEqual(4, imageFrame.Width());
|
||||
Assert.AreEqual(2, imageFrame.Height());
|
||||
Assert.False(imageFrame.IsEmpty());
|
||||
|
||||
var bytes = new byte[32];
|
||||
imageFrame.CopyToBuffer(bytes);
|
||||
Assert.IsEmpty(bytes.Where((x, i) => x != srcBytes[i]));
|
||||
}
|
||||
}
|
||||
|
||||
[Test, SignalAbort]
|
||||
public void Ctor_ShouldThrowMediaPipeException_When_CalledWithInvalidArgument()
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<MediaPipeException>(() => { new ImageFrame(ImageFormat.Types.Format.Sbgra, 640, 480, 0); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame())
|
||||
{
|
||||
Assert.False(imageFrame.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var imageFrame = new ImageFrame();
|
||||
imageFrame.Dispose();
|
||||
|
||||
Assert.True(imageFrame.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #SetToZero
|
||||
[Test]
|
||||
public void SetToZero_ShouldSetZeroToAllBytes()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Gray8, 10, 10))
|
||||
{
|
||||
imageFrame.SetToZero();
|
||||
var bytes = new byte[100];
|
||||
imageFrame.CopyToBuffer(bytes);
|
||||
Assert.True(bytes.All((x) => x == 0));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #SetAlignmentPaddingAreas
|
||||
[Test]
|
||||
public void SetAlignmentPaddingAreas_ShouldNotThrow()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Gray8, 10, 10, 16))
|
||||
{
|
||||
Assert.DoesNotThrow(() => { imageFrame.SetAlignmentPaddingAreas(); });
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CopyToBuffer
|
||||
[Test, SignalAbort]
|
||||
public void CopyToByteBuffer_ShouldThrowException_When_BufferDepthIsWrong()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Gray16, 10, 10))
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<MediaPipeException>(() => { imageFrame.CopyToBuffer(new byte[100]); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyToByteBuffer_ShouldReturnByteArray_When_BufferSizeIsLargeEnough()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Gray8, 10, 10))
|
||||
{
|
||||
var normalBuffer = new byte[100];
|
||||
var largeBuffer = new byte[120];
|
||||
imageFrame.CopyToBuffer(normalBuffer);
|
||||
imageFrame.CopyToBuffer(largeBuffer);
|
||||
|
||||
Assert.IsEmpty(normalBuffer.Where((x, i) => x != largeBuffer[i]));
|
||||
}
|
||||
}
|
||||
|
||||
[Test, SignalAbort]
|
||||
public void CopyToByteBuffer_ShouldThrowException_When_BufferSizeIsTooSmall()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Gray8, 10, 10))
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<MediaPipeException>(() => { imageFrame.CopyToBuffer(new byte[99]); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
|
||||
[Test, SignalAbort]
|
||||
public void CopyToUshortBuffer_ShouldThrowException_When_BufferDepthIsWrong()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Gray8, 10, 10))
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<MediaPipeException>(() => { imageFrame.CopyToBuffer(new ushort[100]); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyToUshortBuffer_ShouldReturnUshortArray_When_BufferSizeIsLargeEnough()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Gray16, 10, 10))
|
||||
{
|
||||
var normalBuffer = new ushort[100];
|
||||
var largeBuffer = new ushort[120];
|
||||
imageFrame.CopyToBuffer(normalBuffer);
|
||||
imageFrame.CopyToBuffer(largeBuffer);
|
||||
|
||||
Assert.IsEmpty(normalBuffer.Where((x, i) => x != largeBuffer[i]));
|
||||
}
|
||||
}
|
||||
|
||||
[Test, SignalAbort]
|
||||
public void CopyToUshortBuffer_ShouldThrowException_When_BufferSizeIsTooSmall()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Gray16, 10, 10))
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<MediaPipeException>(() => { imageFrame.CopyToBuffer(new ushort[99]); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
|
||||
[Test, SignalAbort]
|
||||
public void CopyToFloatBuffer_ShouldThrowException_When_BufferDepthIsWrong()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Gray8, 10, 10))
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<MediaPipeException>(() => { imageFrame.CopyToBuffer(new float[100]); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyToFloatBuffer_ShouldReturnFloatArray_When_BufferSizeIsLargeEnough()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Vec32F1, 10, 10))
|
||||
{
|
||||
var normalBuffer = new float[100];
|
||||
var largeBuffer = new float[120];
|
||||
imageFrame.CopyToBuffer(normalBuffer);
|
||||
imageFrame.CopyToBuffer(largeBuffer);
|
||||
|
||||
Assert.IsEmpty(normalBuffer.Where((x, i) => Math.Abs(x - largeBuffer[i]) > 1e-9));
|
||||
}
|
||||
}
|
||||
|
||||
[Test, SignalAbort]
|
||||
public void CopyToFloatBuffer_ShouldThrowException_When_BufferSizeIsTooSmall()
|
||||
{
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Vec32F1, 10, 10))
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<MediaPipeException>(() => { imageFrame.CopyToBuffer(new float[99]); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class BoolPacketTest
|
||||
{
|
||||
#region Constructor
|
||||
[Test, SignalAbort]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithNoArguments()
|
||||
{
|
||||
using (var packet = new BoolPacket())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.AreEqual(Status.StatusCode.Internal, packet.ValidateAsType().Code());
|
||||
Assert.Throws<MediaPipeException>(() => { packet.Get(); });
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithTrue()
|
||||
{
|
||||
using (var packet = new BoolPacket(true))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.True(packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithFalse()
|
||||
{
|
||||
using (var packet = new BoolPacket(false))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.False(packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithValueAndTimestamp()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
using (var packet = new BoolPacket(true, timestamp))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.True(packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var packet = new BoolPacket())
|
||||
{
|
||||
Assert.False(packet.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var packet = new BoolPacket();
|
||||
packet.Dispose();
|
||||
|
||||
Assert.True(packet.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #At
|
||||
[Test]
|
||||
public void At_ShouldReturnNewPacketWithTimestamp()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
var packet = new BoolPacket(true).At(timestamp);
|
||||
Assert.True(packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
|
||||
using (var newTimestamp = new Timestamp(2))
|
||||
{
|
||||
var newPacket = packet.At(newTimestamp);
|
||||
Assert.True(newPacket.Get());
|
||||
Assert.AreEqual(newTimestamp, newPacket.Timestamp());
|
||||
}
|
||||
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Consume
|
||||
[Test]
|
||||
public void Consume_ShouldThrowNotSupportedException()
|
||||
{
|
||||
using (var packet = new BoolPacket())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<NotSupportedException>(() => { packet.Consume(); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #ValidateAsType
|
||||
[Test]
|
||||
public void ValidateAsType_ShouldReturnOk_When_ValueIsSet()
|
||||
{
|
||||
using (var packet = new BoolPacket(true))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b59151b6708d204ee970450f8028d00b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,137 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class FloatArrayPacketTest
|
||||
{
|
||||
#region Constructor
|
||||
[Test, SignalAbort]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithNoArguments()
|
||||
{
|
||||
using (var packet = new FloatArrayPacket())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
packet.length = 0;
|
||||
Assert.AreEqual(Status.StatusCode.Internal, packet.ValidateAsType().Code());
|
||||
Assert.Throws<MediaPipeException>(() => { packet.Get(); });
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithEmptyArray()
|
||||
{
|
||||
float[] array = { };
|
||||
using (var packet = new FloatArrayPacket(array))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(array, packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithArray()
|
||||
{
|
||||
float[] array = { 0.01f };
|
||||
using (var packet = new FloatArrayPacket(array))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(array, packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithValueAndTimestamp()
|
||||
{
|
||||
float[] array = { 0.01f, 0.02f };
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
using (var packet = new FloatArrayPacket(array, timestamp))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(array, packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var packet = new FloatArrayPacket())
|
||||
{
|
||||
Assert.False(packet.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var packet = new FloatArrayPacket();
|
||||
packet.Dispose();
|
||||
|
||||
Assert.True(packet.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #At
|
||||
[Test]
|
||||
public void At_ShouldReturnNewPacketWithTimestamp()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
float[] array = { 0.0f };
|
||||
var packet = new FloatArrayPacket(array).At(timestamp);
|
||||
Assert.AreEqual(array, packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
|
||||
using (var newTimestamp = new Timestamp(2))
|
||||
{
|
||||
var newPacket = packet.At(newTimestamp);
|
||||
Assert.AreEqual(array, newPacket.Get());
|
||||
Assert.AreEqual(newTimestamp, newPacket.Timestamp());
|
||||
}
|
||||
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Consume
|
||||
[Test]
|
||||
public void Consume_ShouldThrowNotSupportedException()
|
||||
{
|
||||
using (var packet = new FloatArrayPacket())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<NotSupportedException>(() => { packet.Consume(); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #ValidateAsType
|
||||
[Test]
|
||||
public void ValidateAsType_ShouldReturnOk_When_ValueIsSet()
|
||||
{
|
||||
float[] array = { 0.01f };
|
||||
using (var packet = new FloatArrayPacket(array))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43430c0ef642804f9a6347fce4ec497a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,120 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class FloatPacketTest
|
||||
{
|
||||
#region Constructor
|
||||
[Test, SignalAbort]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithNoArguments()
|
||||
{
|
||||
using (var packet = new FloatPacket())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.AreEqual(Status.StatusCode.Internal, packet.ValidateAsType().Code());
|
||||
Assert.Throws<MediaPipeException>(() => { packet.Get(); });
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithValue()
|
||||
{
|
||||
using (var packet = new FloatPacket(0.01f))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(0.01f, packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithValueAndTimestamp()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
using (var packet = new FloatPacket(0.01f, timestamp))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(0.01f, packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var packet = new FloatPacket())
|
||||
{
|
||||
Assert.False(packet.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var packet = new FloatPacket();
|
||||
packet.Dispose();
|
||||
|
||||
Assert.True(packet.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #At
|
||||
[Test]
|
||||
public void At_ShouldReturnNewPacketWithTimestamp()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
var packet = new FloatPacket(0).At(timestamp);
|
||||
Assert.AreEqual(0.0f, packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
|
||||
using (var newTimestamp = new Timestamp(2))
|
||||
{
|
||||
var newPacket = packet.At(newTimestamp);
|
||||
Assert.AreEqual(0.0f, newPacket.Get());
|
||||
Assert.AreEqual(newTimestamp, newPacket.Timestamp());
|
||||
}
|
||||
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Consume
|
||||
[Test]
|
||||
public void Consume_ShouldThrowNotSupportedException()
|
||||
{
|
||||
using (var packet = new FloatPacket())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<NotSupportedException>(() => { packet.Consume(); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #ValidateAsType
|
||||
[Test]
|
||||
public void ValidateAsType_ShouldReturnOk_When_ValueIsSet()
|
||||
{
|
||||
using (var packet = new FloatPacket(0.01f))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39a81137616a1218b9b2b11d2feeadd0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,176 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class FloatVectorPacketTest
|
||||
{
|
||||
#region Constructor
|
||||
[Test, SignalAbort]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithNoArguments()
|
||||
{
|
||||
using (var packet = new FloatVectorPacket())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.AreEqual(Status.StatusCode.Internal, packet.ValidateAsType().Code());
|
||||
Assert.Throws<MediaPipeException>(() => { packet.Get(); });
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithEmptyArray()
|
||||
{
|
||||
float[] data = { };
|
||||
using (var packet = new FloatVectorPacket(data))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(data, packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithArray()
|
||||
{
|
||||
float[] data = { 0.01f };
|
||||
using (var packet = new FloatVectorPacket(data))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(data, packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithValueAndTimestamp()
|
||||
{
|
||||
float[] data = { 0.01f, 0.02f };
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
using (var packet = new FloatVectorPacket(data, timestamp))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(data, packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithEmptyList()
|
||||
{
|
||||
var data = new List<float>();
|
||||
using (var packet = new FloatVectorPacket(data))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(data, packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithList()
|
||||
{
|
||||
var data = new List<float>() { 0.01f };
|
||||
using (var packet = new FloatVectorPacket(data))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(data, packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithListAndTimestamp()
|
||||
{
|
||||
var data = new List<float>() { 0.01f, 0.02f };
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
using (var packet = new FloatVectorPacket(data, timestamp))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(data, packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var packet = new FloatVectorPacket())
|
||||
{
|
||||
Assert.False(packet.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var packet = new FloatVectorPacket();
|
||||
packet.Dispose();
|
||||
|
||||
Assert.True(packet.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #At
|
||||
[Test]
|
||||
public void At_ShouldReturnNewPacketWithTimestamp()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
var data = new List<float>() { 0.0f };
|
||||
var packet = new FloatVectorPacket(data).At(timestamp);
|
||||
Assert.AreEqual(data, packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
|
||||
using (var newTimestamp = new Timestamp(2))
|
||||
{
|
||||
var newPacket = packet.At(newTimestamp);
|
||||
Assert.AreEqual(data, newPacket.Get());
|
||||
Assert.AreEqual(newTimestamp, newPacket.Timestamp());
|
||||
}
|
||||
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Consume
|
||||
[Test]
|
||||
public void Consume_ShouldThrowNotSupportedException()
|
||||
{
|
||||
using (var packet = new FloatVectorPacket())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<NotSupportedException>(() => { packet.Consume(); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #ValidateAsType
|
||||
[Test]
|
||||
public void ValidateAsType_ShouldReturnOk_When_ValueIsSet()
|
||||
{
|
||||
float[] array = { 0.01f };
|
||||
using (var packet = new FloatVectorPacket(array))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a567519c65348c47ae2c5784431179e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,178 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class ImageFramePacketTest
|
||||
{
|
||||
#region Constructor
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithNoArguments()
|
||||
{
|
||||
using (var packet = new ImageFramePacket())
|
||||
{
|
||||
using (var statusOrImageFrame = packet.Consume())
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.Internal, packet.ValidateAsType().Code());
|
||||
Assert.AreEqual(Status.StatusCode.Internal, statusOrImageFrame.status.Code());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithValue()
|
||||
{
|
||||
var srcImageFrame = new ImageFrame();
|
||||
|
||||
using (var packet = new ImageFramePacket(srcImageFrame))
|
||||
{
|
||||
Assert.True(srcImageFrame.isDisposed);
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
|
||||
using (var statusOrImageFrame = packet.Consume())
|
||||
{
|
||||
Assert.True(statusOrImageFrame.Ok());
|
||||
|
||||
using (var imageFrame = statusOrImageFrame.Value())
|
||||
{
|
||||
Assert.AreEqual(ImageFormat.Types.Format.Unknown, imageFrame.Format());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithValueAndTimestamp()
|
||||
{
|
||||
var srcImageFrame = new ImageFrame();
|
||||
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
using (var packet = new ImageFramePacket(srcImageFrame, timestamp))
|
||||
{
|
||||
Assert.True(srcImageFrame.isDisposed);
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
|
||||
using (var statusOrImageFrame = packet.Consume())
|
||||
{
|
||||
Assert.True(statusOrImageFrame.Ok());
|
||||
|
||||
using (var imageFrame = statusOrImageFrame.Value())
|
||||
{
|
||||
Assert.AreEqual(ImageFormat.Types.Format.Unknown, imageFrame.Format());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var packet = new ImageFramePacket())
|
||||
{
|
||||
Assert.False(packet.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var packet = new ImageFramePacket();
|
||||
packet.Dispose();
|
||||
|
||||
Assert.True(packet.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #At
|
||||
[Test]
|
||||
public void At_ShouldReturnNewPacketWithTimestamp()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
var packet = new ImageFramePacket(new ImageFrame(ImageFormat.Types.Format.Srgba, 10, 10)).At(timestamp);
|
||||
Assert.AreEqual(10, packet.Get().Width());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
|
||||
using (var newTimestamp = new Timestamp(2))
|
||||
{
|
||||
var newPacket = packet.At(newTimestamp);
|
||||
Assert.AreEqual(10, newPacket.Get().Width());
|
||||
Assert.AreEqual(newTimestamp, newPacket.Timestamp());
|
||||
}
|
||||
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Get
|
||||
[Test, SignalAbort]
|
||||
public void Get_ShouldThrowMediaPipeException_When_DataIsEmpty()
|
||||
{
|
||||
using (var packet = new ImageFramePacket())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<MediaPipeException>(() => { packet.Get(); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
|
||||
public void Get_ShouldReturnImageFrame_When_DataIsNotEmpty()
|
||||
{
|
||||
using (var packet = new ImageFramePacket(new ImageFrame(ImageFormat.Types.Format.Sbgra, 10, 10)))
|
||||
{
|
||||
using (var imageFrame = packet.Get())
|
||||
{
|
||||
Assert.AreEqual(ImageFormat.Types.Format.Sbgra, imageFrame.Format());
|
||||
Assert.AreEqual(10, imageFrame.Width());
|
||||
Assert.AreEqual(10, imageFrame.Height());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Consume
|
||||
[Test]
|
||||
public void Consume_ShouldReturnImageFrame()
|
||||
{
|
||||
using (var packet = new ImageFramePacket(new ImageFrame(ImageFormat.Types.Format.Sbgra, 10, 10)))
|
||||
{
|
||||
using (var statusOrImageFrame = packet.Consume())
|
||||
{
|
||||
Assert.True(statusOrImageFrame.Ok());
|
||||
|
||||
using (var imageFrame = statusOrImageFrame.Value())
|
||||
{
|
||||
Assert.AreEqual(ImageFormat.Types.Format.Sbgra, imageFrame.Format());
|
||||
Assert.AreEqual(10, imageFrame.Width());
|
||||
Assert.AreEqual(10, imageFrame.Height());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #ValidateAsType
|
||||
[Test]
|
||||
public void ValidateAsType_ShouldReturnOk_When_ValueIsSet()
|
||||
{
|
||||
using (var packet = new ImageFramePacket(new ImageFrame()))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3eb7f3538d626cd68495da48b11e6f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,111 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class MatrixPacketTest
|
||||
{
|
||||
#region Constructor
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithValue()
|
||||
{
|
||||
var matrix = CreateMatrixInputData();
|
||||
using (var packet = new MatrixPacket(matrix))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual(matrix, packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var packet = new MatrixPacket())
|
||||
{
|
||||
Assert.False(packet.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var packet = new MatrixPacket();
|
||||
packet.Dispose();
|
||||
|
||||
Assert.True(packet.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #At
|
||||
[Test]
|
||||
public void At_ShouldReturnNewPacketWithTimestamp()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
var matrix = CreateMatrixInputData();
|
||||
var packet = new MatrixPacket(matrix).At(timestamp);
|
||||
Assert.AreEqual(matrix, packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
|
||||
using (var newTimestamp = new Timestamp(2))
|
||||
{
|
||||
var newPacket = packet.At(newTimestamp);
|
||||
Assert.AreEqual(matrix, newPacket.Get());
|
||||
Assert.AreEqual(newTimestamp, newPacket.Timestamp());
|
||||
}
|
||||
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Consume
|
||||
[Test]
|
||||
public void Consume_ShouldThrowNotSupportedException()
|
||||
{
|
||||
using (var packet = new MatrixPacket())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<NotSupportedException>(() => { packet.Consume(); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #ValidateAsType
|
||||
[Test]
|
||||
public void ValidateAsType_ShouldReturnOk_When_ValueIsSet()
|
||||
{
|
||||
using (var packet = new MatrixPacket(CreateMatrixInputData()))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private static MatrixData CreateMatrixInputData()
|
||||
{
|
||||
var matrix = new MatrixData();
|
||||
matrix.PackedData.Add(0);
|
||||
matrix.PackedData.Add(1);
|
||||
matrix.PackedData.Add(2);
|
||||
matrix.PackedData.Add(3);
|
||||
matrix.PackedData.Add(4);
|
||||
matrix.PackedData.Add(5);
|
||||
|
||||
matrix.Rows = 2;
|
||||
matrix.Cols = 3;
|
||||
return matrix;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3a4963f37dcdcc43a8292c2493c19bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,57 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class PacketTest
|
||||
{
|
||||
#region #DebugString
|
||||
[Test]
|
||||
public void DebugString_ShouldReturnDebugString_When_InstantiatedWithDefaultConstructor()
|
||||
{
|
||||
using (var packet = new BoolPacket())
|
||||
{
|
||||
Assert.AreEqual("mediapipe::Packet with timestamp: Timestamp::Unset() and no data", packet.DebugString());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #DebugTypeName
|
||||
[Test]
|
||||
public void DebugTypeName_ShouldReturnTypeName_When_ValueIsNotSet()
|
||||
{
|
||||
using (var packet = new BoolPacket())
|
||||
{
|
||||
Assert.AreEqual("{empty}", packet.DebugTypeName());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #RegisteredTypeName
|
||||
[Test]
|
||||
public void RegisteredTypeName_ShouldReturnEmptyString()
|
||||
{
|
||||
using (var packet = new BoolPacket())
|
||||
{
|
||||
Assert.AreEqual("", packet.RegisteredTypeName());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #ValidateAsProtoMessageLite
|
||||
[Test]
|
||||
public void ValidateAsProtoMessageLite_ShouldReturnInvalidArgument_When_ValueIsBool()
|
||||
{
|
||||
using (var packet = new BoolPacket(true))
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.InvalidArgument, packet.ValidateAsProtoMessageLite().Code());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c8b062f481adfe73be16b679e3c1cca
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,129 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class SidePacketTest
|
||||
{
|
||||
#region #size
|
||||
[Test]
|
||||
public void Size_ShouldReturnZero_When_Initialized()
|
||||
{
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
Assert.AreEqual(0, sidePacket.size);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Size_ShouldReturnSize_When_AfterPacketsAreEmplaced()
|
||||
{
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
var flagPacket = new BoolPacket(true);
|
||||
var valuePacket = new FloatPacket(1.0f);
|
||||
sidePacket.Emplace("flag", flagPacket);
|
||||
sidePacket.Emplace("value", valuePacket);
|
||||
|
||||
Assert.AreEqual(2, sidePacket.size);
|
||||
Assert.True(flagPacket.isDisposed);
|
||||
Assert.True(valuePacket.isDisposed);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Emplace
|
||||
[Test]
|
||||
public void Emplace_ShouldInsertAndDisposePacket()
|
||||
{
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
Assert.AreEqual(0, sidePacket.size);
|
||||
Assert.IsNull(sidePacket.At<FloatPacket, float>("value"));
|
||||
|
||||
var flagPacket = new FloatPacket(1.0f);
|
||||
sidePacket.Emplace("value", flagPacket);
|
||||
|
||||
Assert.AreEqual(1, sidePacket.size);
|
||||
Assert.AreEqual(1.0f, sidePacket.At<FloatPacket, float>("value").Get());
|
||||
Assert.True(flagPacket.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Emplace_ShouldIgnoreValue_When_KeyExists()
|
||||
{
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
var oldValuePacket = new FloatPacket(1.0f);
|
||||
sidePacket.Emplace("value", oldValuePacket);
|
||||
Assert.AreEqual(1.0f, sidePacket.At<FloatPacket, float>("value").Get());
|
||||
|
||||
var newValuePacket = new FloatPacket(2.0f);
|
||||
sidePacket.Emplace("value", newValuePacket);
|
||||
Assert.AreEqual(1.0f, sidePacket.At<FloatPacket, float>("value").Get());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Erase
|
||||
[Test]
|
||||
public void Erase_ShouldDoNothing_When_KeyDoesNotExist()
|
||||
{
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
var count = sidePacket.Erase("value");
|
||||
|
||||
Assert.AreEqual(0, sidePacket.size);
|
||||
Assert.AreEqual(0, count);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Erase_ShouldEraseKey_When_KeyExists()
|
||||
{
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
sidePacket.Emplace("value", new BoolPacket(true));
|
||||
Assert.AreEqual(1, sidePacket.size);
|
||||
|
||||
var count = sidePacket.Erase("value");
|
||||
Assert.AreEqual(0, sidePacket.size);
|
||||
Assert.AreEqual(1, count);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Clear
|
||||
[Test]
|
||||
public void Clear_ShouldDoNothing_When_SizeIsZero()
|
||||
{
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
sidePacket.Clear();
|
||||
|
||||
Assert.AreEqual(0, sidePacket.size);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Clear_ShouldClearAllKeys_When_SizeIsNotZero()
|
||||
{
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
sidePacket.Emplace("flag", new BoolPacket(true));
|
||||
sidePacket.Emplace("value", new FloatPacket(1.0f));
|
||||
Assert.AreEqual(2, sidePacket.size);
|
||||
|
||||
sidePacket.Clear();
|
||||
Assert.AreEqual(0, sidePacket.size);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 148809b5633f2f8cd9f277e01bb7b0ca
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,177 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class StringPacketTest
|
||||
{
|
||||
#region Constructor
|
||||
[Test, SignalAbort]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithNoArguments()
|
||||
{
|
||||
using (var packet = new StringPacket())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.AreEqual(Status.StatusCode.Internal, packet.ValidateAsType().Code());
|
||||
Assert.Throws<MediaPipeException>(() => { packet.Get(); });
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithString()
|
||||
{
|
||||
using (var packet = new StringPacket("test"))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual("test", packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithByteArray()
|
||||
{
|
||||
var bytes = new byte[] { (byte)'t', (byte)'e', (byte)'s', (byte)'t' };
|
||||
using (var packet = new StringPacket(bytes))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual("test", packet.Get());
|
||||
Assert.AreEqual(Timestamp.Unset(), packet.Timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithStringAndTimestamp()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
using (var packet = new StringPacket("test", timestamp))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual("test", packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiatePacket_When_CalledWithByteArrayAndTimestamp()
|
||||
{
|
||||
var bytes = new byte[] { (byte)'t', (byte)'e', (byte)'s', (byte)'t' };
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
using (var packet = new StringPacket(bytes, timestamp))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
Assert.AreEqual("test", packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var packet = new StringPacket())
|
||||
{
|
||||
Assert.False(packet.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var packet = new StringPacket();
|
||||
packet.Dispose();
|
||||
|
||||
Assert.True(packet.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #At
|
||||
[Test]
|
||||
public void At_ShouldReturnNewPacketWithTimestamp()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
var str = "str";
|
||||
var packet = new StringPacket(str).At(timestamp);
|
||||
Assert.AreEqual(str, packet.Get());
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
|
||||
using (var newTimestamp = new Timestamp(2))
|
||||
{
|
||||
var newPacket = packet.At(newTimestamp);
|
||||
Assert.AreEqual(str, newPacket.Get());
|
||||
Assert.AreEqual(newTimestamp, newPacket.Timestamp());
|
||||
}
|
||||
|
||||
Assert.AreEqual(timestamp, packet.Timestamp());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #GetByteArray
|
||||
[Test]
|
||||
public void GetByteArray_ShouldReturnByteArray()
|
||||
{
|
||||
var bytes = new byte[] { (byte)'a', (byte)'b', 0, (byte)'c' };
|
||||
using (var packet = new StringPacket(bytes))
|
||||
{
|
||||
Assert.AreEqual(bytes, packet.GetByteArray());
|
||||
Assert.AreEqual("ab", packet.Get());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Consume
|
||||
[Test]
|
||||
public void Consume_ShouldReturnStatusOrString_When_PacketIsEmpty()
|
||||
{
|
||||
using (var packet = new StringPacket())
|
||||
{
|
||||
using (var statusOrString = packet.Consume())
|
||||
{
|
||||
Assert.False(statusOrString.Ok());
|
||||
Assert.AreEqual(Status.StatusCode.Internal, statusOrString.status.Code());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Consume_ShouldReturnStatusOrString_When_PacketIsNotEmpty()
|
||||
{
|
||||
using (var packet = new StringPacket("abc"))
|
||||
{
|
||||
using (var statusOrString = packet.Consume())
|
||||
{
|
||||
Assert.True(statusOrString.Ok());
|
||||
Assert.AreEqual("abc", statusOrString.Value());
|
||||
}
|
||||
Assert.True(packet.IsEmpty());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #ValidateAsType
|
||||
[Test]
|
||||
public void ValidateAsType_ShouldReturnOk_When_ValueIsSet()
|
||||
{
|
||||
using (var packet = new StringPacket("test"))
|
||||
{
|
||||
Assert.True(packet.ValidateAsType().Ok());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fc360374ea123c28b7da8b9b81ebac6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 62cf7906c5d34b94b984c3b13300b589
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,61 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class StatusOrGpuResourcesTest
|
||||
{
|
||||
#region #status
|
||||
[Test, GpuOnly]
|
||||
public void Status_ShouldReturnOk_When_StatusIsOk()
|
||||
{
|
||||
using (var statusOrGpuResources = GpuResources.Create())
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.Ok, statusOrGpuResources.status.Code());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test, GpuOnly]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var statusOrGpuResources = GpuResources.Create())
|
||||
{
|
||||
Assert.False(statusOrGpuResources.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test, GpuOnly]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var statusOrGpuResources = GpuResources.Create();
|
||||
statusOrGpuResources.Dispose();
|
||||
|
||||
Assert.True(statusOrGpuResources.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Value
|
||||
[Test, GpuOnly]
|
||||
public void Value_ShouldReturnGpuResources_When_StatusIsOk()
|
||||
{
|
||||
using (var statusOrGpuResources = GpuResources.Create())
|
||||
{
|
||||
Assert.True(statusOrGpuResources.Ok());
|
||||
|
||||
using (var gpuResources = statusOrGpuResources.Value())
|
||||
{
|
||||
Assert.IsInstanceOf<GpuResources>(gpuResources);
|
||||
Assert.True(statusOrGpuResources.isDisposed);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 744f3edd2e0a5c864b1e59a13c017bbd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,71 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class StatusOrImageFrameTest
|
||||
{
|
||||
#region #status
|
||||
[Test]
|
||||
public void Status_ShouldReturnOk_When_StatusIsOk()
|
||||
{
|
||||
using (var statusOrImageFrame = InitializeSubject())
|
||||
{
|
||||
Assert.True(statusOrImageFrame.Ok());
|
||||
Assert.AreEqual(Status.StatusCode.Ok, statusOrImageFrame.status.Code());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var statusOrImageFrame = InitializeSubject())
|
||||
{
|
||||
Assert.False(statusOrImageFrame.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var statusOrImageFrame = InitializeSubject();
|
||||
statusOrImageFrame.Dispose();
|
||||
|
||||
Assert.True(statusOrImageFrame.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Value
|
||||
[Test]
|
||||
public void Value_ShouldReturnImageFrame_When_StatusIsOk()
|
||||
{
|
||||
using (var statusOrImageFrame = InitializeSubject())
|
||||
{
|
||||
Assert.True(statusOrImageFrame.Ok());
|
||||
|
||||
using (var imageFrame = statusOrImageFrame.Value())
|
||||
{
|
||||
Assert.AreEqual(10, imageFrame.Width());
|
||||
Assert.AreEqual(10, imageFrame.Height());
|
||||
Assert.True(statusOrImageFrame.isDisposed);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private StatusOrImageFrame InitializeSubject()
|
||||
{
|
||||
var imageFrame = new ImageFrame(ImageFormat.Types.Format.Sbgra, 10, 10);
|
||||
var packet = new ImageFramePacket(imageFrame, new Timestamp(1));
|
||||
|
||||
return (StatusOrImageFrame)packet.Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 466caabcab9db68b9bf6cd8b2ea6829a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,87 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class StatusOrStringTest
|
||||
{
|
||||
#region #status
|
||||
[Test]
|
||||
public void Status_ShouldReturnOk_When_StatusIsOk()
|
||||
{
|
||||
using (var statusOrString = InitializeSubject(""))
|
||||
{
|
||||
Assert.True(statusOrString.Ok());
|
||||
Assert.AreEqual(Status.StatusCode.Ok, statusOrString.status.Code());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var statusOrString = InitializeSubject(""))
|
||||
{
|
||||
Assert.False(statusOrString.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var statusOrString = InitializeSubject("");
|
||||
statusOrString.Dispose();
|
||||
|
||||
Assert.True(statusOrString.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Value
|
||||
[Test]
|
||||
public void Value_ShouldReturnString_When_StatusIsOk()
|
||||
{
|
||||
var bytes = new byte[] { (byte)'a', (byte)'b', 0, (byte)'c' };
|
||||
using (var statusOrString = InitializeSubject(bytes))
|
||||
{
|
||||
Assert.True(statusOrString.Ok());
|
||||
Assert.AreEqual("ab", statusOrString.Value());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #ValueAsByteArray
|
||||
[Test]
|
||||
public void ValueAsByteArray_ShouldReturnByteArray_When_StatusIsOk()
|
||||
{
|
||||
var bytes = new byte[] { (byte)'a', (byte)'b', 0, (byte)'c' };
|
||||
using (var statusOrString = InitializeSubject(bytes))
|
||||
{
|
||||
Assert.True(statusOrString.Ok());
|
||||
Assert.AreEqual(bytes, statusOrString.ValueAsByteArray());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private StatusOrString InitializeSubject(string str)
|
||||
{
|
||||
using (var packet = new StringPacket(str))
|
||||
{
|
||||
return (StatusOrString)packet.Consume();
|
||||
}
|
||||
}
|
||||
|
||||
private StatusOrString InitializeSubject(byte[] bytes)
|
||||
{
|
||||
using (var packet = new StringPacket(bytes))
|
||||
{
|
||||
return (StatusOrString)packet.Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 033bc341009a18e46920a405cd163bfb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,286 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class StatusTest
|
||||
{
|
||||
#region #Code
|
||||
[Test]
|
||||
public void Code_ShouldReturnStatusCode_When_StatusIsOk()
|
||||
{
|
||||
using (var status = Status.Ok())
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.Ok, status.Code());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Code_ShouldReturnStatusCode_When_StatusIsFailedPrecondition()
|
||||
{
|
||||
using (var status = Status.FailedPrecondition())
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.FailedPrecondition, status.Code());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var status = Status.Ok())
|
||||
{
|
||||
Assert.False(status.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var status = Status.Ok();
|
||||
status.Dispose();
|
||||
|
||||
Assert.True(status.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #RawCode
|
||||
[Test]
|
||||
public void RawCode_ShouldReturnRawCode_When_StatusIsOk()
|
||||
{
|
||||
using (var status = Status.Ok())
|
||||
{
|
||||
Assert.AreEqual(0, status.RawCode());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RawCode_ShouldReturnRawCode_When_StatusIsFailedPrecondition()
|
||||
{
|
||||
using (var status = Status.FailedPrecondition())
|
||||
{
|
||||
Assert.AreEqual(9, status.RawCode());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Ok
|
||||
[Test]
|
||||
public void Ok_ShouldReturnTrue_When_StatusIsOk()
|
||||
{
|
||||
using (var status = Status.Ok())
|
||||
{
|
||||
Assert.True(status.Ok());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ok_ShouldReturnFalse_When_StatusIsFailedPrecondition()
|
||||
{
|
||||
using (var status = Status.FailedPrecondition())
|
||||
{
|
||||
Assert.False(status.Ok());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #AssertOk
|
||||
[Test]
|
||||
public void AssertOk_ShouldNotThrow_When_StatusIsOk()
|
||||
{
|
||||
using (var status = Status.Ok())
|
||||
{
|
||||
Assert.DoesNotThrow(() => { status.AssertOk(); });
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AssertOk_ShouldThrow_When_StatusIsNotOk()
|
||||
{
|
||||
using (var status = Status.FailedPrecondition())
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<MediaPipeException>(() => { status.AssertOk(); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #ToString
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsOk()
|
||||
{
|
||||
using (var status = Status.Ok())
|
||||
{
|
||||
Assert.AreEqual("OK", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsCancelled()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.Cancelled(message))
|
||||
{
|
||||
Assert.AreEqual($"CANCELLED: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsUnknown()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.Unknown(message))
|
||||
{
|
||||
Assert.AreEqual($"UNKNOWN: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsInvalidArgument()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.InvalidArgument(message))
|
||||
{
|
||||
Assert.AreEqual($"INVALID_ARGUMENT: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsDeadlineExceeded()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.DeadlineExceeded(message))
|
||||
{
|
||||
Assert.AreEqual($"DEADLINE_EXCEEDED: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsNotFound()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.NotFound(message))
|
||||
{
|
||||
Assert.AreEqual($"NOT_FOUND: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsAlreadyExists()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.AlreadyExists(message))
|
||||
{
|
||||
Assert.AreEqual($"ALREADY_EXISTS: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsPermissionDenied()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.PermissionDenied(message))
|
||||
{
|
||||
Assert.AreEqual($"PERMISSION_DENIED: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsResourceExhausted()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.ResourceExhausted(message))
|
||||
{
|
||||
Assert.AreEqual($"RESOURCE_EXHAUSTED: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsFailedPrecondition()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.FailedPrecondition(message))
|
||||
{
|
||||
Assert.AreEqual($"FAILED_PRECONDITION: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsAborted()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.Aborted(message))
|
||||
{
|
||||
Assert.AreEqual($"ABORTED: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsOutOfRange()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.OutOfRange(message))
|
||||
{
|
||||
Assert.AreEqual($"OUT_OF_RANGE: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsUnimplemented()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.Unimplemented(message))
|
||||
{
|
||||
Assert.AreEqual($"UNIMPLEMENTED: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsInternal()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.Internal(message))
|
||||
{
|
||||
Assert.AreEqual($"INTERNAL: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsUnavailable()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.Unavailable(message))
|
||||
{
|
||||
Assert.AreEqual($"UNAVAILABLE: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsDataLoss()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.DataLoss(message))
|
||||
{
|
||||
Assert.AreEqual($"DATA_LOSS: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString_ShouldReturnMessage_When_StatusIsUnauthenticated()
|
||||
{
|
||||
var message = "Some error";
|
||||
using (var status = Status.Unauthenticated(message))
|
||||
{
|
||||
Assert.AreEqual($"UNAUTHENTICATED: {message}", status.ToString());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb9c4c0cb4b7c323db90d8592b4684cb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,254 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class TimestampTest
|
||||
{
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
Assert.False(timestamp.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var timestamp = new Timestamp(1);
|
||||
timestamp.Dispose();
|
||||
|
||||
Assert.True(timestamp.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Value
|
||||
[Test]
|
||||
public void Value_ShouldReturnValue()
|
||||
{
|
||||
using (var timestamp = new Timestamp(10))
|
||||
{
|
||||
Assert.AreEqual(10, timestamp.Value());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Seconds
|
||||
[Test]
|
||||
public void Seconds_ShouldReturnValueInSeconds()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1_000_000))
|
||||
{
|
||||
Assert.AreEqual(1d, timestamp.Seconds(), 1e-9);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Microseconds
|
||||
[Test]
|
||||
public void Microseconds_ShouldReturnValueInMicroseconds()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1_000_000))
|
||||
{
|
||||
Assert.AreEqual(1_000_000, timestamp.Microseconds());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #IsSpecialValue
|
||||
[Test]
|
||||
public void IsSpecialValue_ShouldReturnFalse_When_ValueIsInRange()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
Assert.False(timestamp.IsSpecialValue());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsSpecialValue_ShouldReturnTrue_When_TimestampIsUnset()
|
||||
{
|
||||
using (var timestamp = Timestamp.Unset())
|
||||
{
|
||||
Assert.True(timestamp.IsSpecialValue());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsSpecialValue_ShouldReturnTrue_When_TimestampIsUnstarted()
|
||||
{
|
||||
using (var timestamp = Timestamp.Unstarted())
|
||||
{
|
||||
Assert.True(timestamp.IsSpecialValue());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #IsRangeValue
|
||||
[Test]
|
||||
public void IsRangeValue_ShouldReturnTrue_When_ValueIsInRange()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
Assert.True(timestamp.IsRangeValue());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsRangeValue_ShouldReturnFalse_When_TimestampIsPreStream()
|
||||
{
|
||||
using (var timestamp = Timestamp.PreStream())
|
||||
{
|
||||
Assert.False(timestamp.IsRangeValue());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsRangeValue_ShouldReturnFalse_When_TimestampIsPostStream()
|
||||
{
|
||||
using (var timestamp = Timestamp.PostStream())
|
||||
{
|
||||
Assert.False(timestamp.IsRangeValue());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsRangeValue_ShouldReturnTrue_When_TimestampIsMin()
|
||||
{
|
||||
using (var timestamp = Timestamp.Min())
|
||||
{
|
||||
Assert.True(timestamp.IsRangeValue());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsRangeValue_ShouldReturnTrue_When_TimestampIsMax()
|
||||
{
|
||||
using (var timestamp = Timestamp.Max())
|
||||
{
|
||||
Assert.True(timestamp.IsRangeValue());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #IsAllowedInStream
|
||||
[Test]
|
||||
public void IsAllowedInStream_ShouldReturnTrue_When_ValueIsInRange()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
Assert.True(timestamp.IsAllowedInStream());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsAllowedInStream_ShouldReturnFalse_When_TimestampIsOneOverPostStream()
|
||||
{
|
||||
using (var timestamp = Timestamp.OneOverPostStream())
|
||||
{
|
||||
Assert.False(timestamp.IsAllowedInStream());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsAllowedInStream_ShouldReturnFalse_When_TimestampIsDone()
|
||||
{
|
||||
using (var timestamp = Timestamp.Done())
|
||||
{
|
||||
Assert.False(timestamp.IsAllowedInStream());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #DebugString
|
||||
[Test]
|
||||
public void DebugString_ShouldReturnDebugString()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
Assert.AreEqual("1", timestamp.DebugString());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DebugString_ShouldReturnDebugString_When_TimestampIsUnset()
|
||||
{
|
||||
using (var timestamp = Timestamp.Unset())
|
||||
{
|
||||
Assert.AreEqual("Timestamp::Unset()", timestamp.DebugString());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #NextAllowedInStream
|
||||
[Test]
|
||||
public void NextAllowedInStream_ShouldReturnNextTimestamp_When_ValueIsInRange()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
using (var nextTimestamp = timestamp.NextAllowedInStream())
|
||||
{
|
||||
Assert.AreEqual(2, nextTimestamp.Microseconds());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NextAllowedInStream_ShouldReturnOneOverPostStream_When_TimestampIsPostStream()
|
||||
{
|
||||
using (var timestamp = Timestamp.PostStream())
|
||||
{
|
||||
using (var nextTimestamp = timestamp.NextAllowedInStream())
|
||||
{
|
||||
Assert.AreEqual(Timestamp.OneOverPostStream(), nextTimestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #PreviousAllowedInStream
|
||||
[Test]
|
||||
public void PreviousAllowedInStream_ShouldReturnPreviousTimestamp_When_ValueIsInRange()
|
||||
{
|
||||
using (var timestamp = new Timestamp(1))
|
||||
{
|
||||
using (var nextTimestamp = timestamp.PreviousAllowedInStream())
|
||||
{
|
||||
Assert.AreEqual(0, nextTimestamp.Microseconds());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PreviousAllowedInStream_ShouldReturnUnstarted_When_TimestampIsPreStream()
|
||||
{
|
||||
using (var timestamp = Timestamp.PreStream())
|
||||
{
|
||||
using (var nextTimestamp = timestamp.PreviousAllowedInStream())
|
||||
{
|
||||
Assert.AreEqual(Timestamp.Unstarted(), nextTimestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #FromSeconds
|
||||
[Test]
|
||||
public void FromSeconds_ShouldReturnTimestamp()
|
||||
{
|
||||
using (var timestamp = Timestamp.FromSeconds(1d))
|
||||
{
|
||||
Assert.AreEqual(1_000_000, timestamp.Microseconds());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a89b44de17930bf6bcbf5f75f57c100
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b737c0d514315064ebd2a4180cc065a3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,156 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class NameUtilTest
|
||||
{
|
||||
[TestCase("{}", "base", "base")]
|
||||
[TestCase(@"{""node"":[{""name"":""a""}]}", "base", "base")]
|
||||
[TestCase(@"{""node"":[{},{}]}", "", "")]
|
||||
[TestCase(@"{""node"":[{""name"":""base""},{""name"":""base_02""}]}", "base", "base_03")]
|
||||
public void GetUnusedNodeName_ShouldReturnUniqueName(string configJson, string nameBase, string uniqueName)
|
||||
{
|
||||
var config = CalculatorGraphConfig.Parser.ParseJson(configJson);
|
||||
Assert.AreEqual(uniqueName, Tool.GetUnusedNodeName(config, nameBase));
|
||||
}
|
||||
|
||||
[TestCase("{}", "base", "base")]
|
||||
[TestCase(@"{""node"":[{""input_side_packet"":[""a""]}]}", "base", "base")]
|
||||
[TestCase(@"{""node"":[{},{""input_side_packet"":[]}]}", "", "")]
|
||||
[TestCase(@"{""node"":[{""input_side_packet"":[""base""]},{""input_side_packet"":[""TAG:base_02""]}]}", "base", "base_03")]
|
||||
public void GetUnusedSidePacketName_ShouldReturnUniqueName(string configJson, string nameBase, string uniqueName)
|
||||
{
|
||||
var config = CalculatorGraphConfig.Parser.ParseJson(configJson);
|
||||
Assert.AreEqual(uniqueName, Tool.GetUnusedSidePacketName(config, nameBase));
|
||||
}
|
||||
|
||||
[TestCase(@"{""node"":[{""name"":""x""}]}", 0, "x")]
|
||||
[TestCase(@"{""node"":[{""name"":""x""},{""name"":""x""},{""name"":""y""},{""name"":""x""}]}", 0, "x_1")]
|
||||
[TestCase(@"{""node"":[{""name"":""x""},{""name"":""x""},{""name"":""y""},{""name"":""x""}]}", 1, "x_2")]
|
||||
[TestCase(@"{""node"":[{""name"":""x""},{""name"":""x""},{""name"":""y""},{""name"":""x""}]}", 2, "y")]
|
||||
[TestCase(@"{""node"":[{""name"":""x""},{""name"":""x""},{""name"":""y""},{""name"":""x""}]}", 3, "x_3")]
|
||||
[TestCase(@"{""node"":[{""calculator"":""x""},{""name"":""x""}]}", 0, "x_1")]
|
||||
[TestCase(@"{""node"":[{""calculator"":""x""},{""name"":""x""}]}", 1, "x_2")]
|
||||
[TestCase(@"{""node"":[{""name"":""x""},{""calculator"":""x""}]}", 0, "x_1")]
|
||||
[TestCase(@"{""node"":[{""name"":""x""},{""calculator"":""x""}]}", 1, "x_2")]
|
||||
public void CanonicalNodeName_ShouldReturnCanonicalNodeName_When_NodeIdIsValid(string configJson, int nodeId, string name)
|
||||
{
|
||||
var config = CalculatorGraphConfig.Parser.ParseJson(configJson);
|
||||
Assert.AreEqual(name, Tool.CanonicalNodeName(config, nodeId));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanonicalNodeName_ShouldThrow_When_NodeIdIsNegative()
|
||||
{
|
||||
var config = CalculatorGraphConfig.Parser.ParseJson(@"{""node"":[{""name"":""name""}]}");
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => { Tool.CanonicalNodeName(config, -1); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanonicalNodeName_ShouldThrow_When_NodeIdIsInvalid()
|
||||
{
|
||||
var config = CalculatorGraphConfig.Parser.ParseJson(@"{""node"":[{""name"":""name""}]}");
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => { Tool.CanonicalNodeName(config, 1); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanonicalNodeName_ShouldThrow_When_NodeIsEmpty()
|
||||
{
|
||||
var config = CalculatorGraphConfig.Parser.ParseJson("{}");
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => { Tool.CanonicalNodeName(config, 0); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
|
||||
[TestCase("stream", "stream")]
|
||||
[TestCase("TAG:x", "x")]
|
||||
[TestCase("TAG:1:x", "x")]
|
||||
public void ParseNameFromStream_ShouldReturnName_When_InputIsValid(string stream, string name)
|
||||
{
|
||||
Assert.AreEqual(name, Tool.ParseNameFromStream(stream));
|
||||
}
|
||||
|
||||
[TestCase(":stream")]
|
||||
[TestCase("TAG::stream")]
|
||||
[TestCase("TAG:1:")]
|
||||
public void ParseNameFromStream_ShouldThrow_When_InputIsInvalid(string stream)
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentException>(() => { Tool.ParseNameFromStream(stream); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
|
||||
[TestCase("", "", 0)]
|
||||
[TestCase("TAG", "TAG", 0)]
|
||||
[TestCase(":1", "", 1)]
|
||||
[TestCase("TAG:1", "TAG", 1)]
|
||||
public void ParseTagIndex_ShouldReturnTagIndexPair_When_InputIsValid(string tagIndex, string tag, int index)
|
||||
{
|
||||
var output = Tool.ParseTagIndex(tagIndex);
|
||||
|
||||
Assert.AreEqual(tag, output.Item1);
|
||||
Assert.AreEqual(index, output.Item2);
|
||||
}
|
||||
|
||||
[TestCase("tag")]
|
||||
[TestCase(":")]
|
||||
[TestCase("TAG:")]
|
||||
[TestCase("1")]
|
||||
public void ParseTagIndex_ShouldThrow_When_InputIsInvalid(string tagIndex)
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentException>(() => { Tool.ParseTagIndex(tagIndex); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
|
||||
[TestCase("stream", "", -1)]
|
||||
[TestCase("TAG:x", "TAG", 0)]
|
||||
[TestCase("TAG:1:x", "TAG", 1)]
|
||||
public void ParseTagIndexFromStream_ShouldReturnTagIndexPair_When_InputIsValid(string stream, string tag, int index)
|
||||
{
|
||||
var output = Tool.ParseTagIndexFromStream(stream);
|
||||
|
||||
Assert.AreEqual(tag, output.Item1);
|
||||
Assert.AreEqual(index, output.Item2);
|
||||
}
|
||||
|
||||
[TestCase(":stream")]
|
||||
[TestCase("TAG::stream")]
|
||||
[TestCase("TAG:1:")]
|
||||
public void ParseTagIndexFromStream_ShouldThrow_When_InputIsInvalid(string stream)
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentException>(() => { Tool.ParseTagIndexFromStream(stream); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
|
||||
[TestCase("", -1, "")]
|
||||
[TestCase("", 1, "")]
|
||||
[TestCase("TAG", -1, "TAG")]
|
||||
[TestCase("TAG", 1, "TAG:1")]
|
||||
public void CatTag_ShouldReturnTag(string tag, int index, string output)
|
||||
{
|
||||
Assert.AreEqual(output, Tool.CatTag(tag, index));
|
||||
}
|
||||
|
||||
[TestCase("", -1, "x", "x")]
|
||||
[TestCase("", 1, "x", "x")]
|
||||
[TestCase("TAG", -1, "x", "TAG:x")]
|
||||
[TestCase("TAG", 1, "x", "TAG:1:x")]
|
||||
public void CatStream_ShouldReturnStream(string tag, int index, string name, string output)
|
||||
{
|
||||
Assert.AreEqual(output, Tool.CatStream((tag, index), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7707b1c1356d57b29b1ad8932beca1a4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,290 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class ValidateNameTest
|
||||
{
|
||||
#region .ValidateName
|
||||
[TestCase("humphrey")]
|
||||
[TestCase("humphrey_bogart")]
|
||||
[TestCase("humphrey_bogart_1899")]
|
||||
[TestCase("aa")]
|
||||
[TestCase("b1")]
|
||||
[TestCase("_1")]
|
||||
public void ValidateName_ShouldNotThrow_WhenNameIsValid(string name)
|
||||
{
|
||||
Assert.DoesNotThrow(() => { Tool.ValidateName(name); });
|
||||
}
|
||||
|
||||
[TestCase("")]
|
||||
[TestCase("humphrey bogart")]
|
||||
[TestCase("humphreyBogart")]
|
||||
[TestCase("humphrey-bogart")]
|
||||
[TestCase("humphrey/bogart")]
|
||||
[TestCase("humphrey.bogart")]
|
||||
[TestCase("humphrey:bogart")]
|
||||
[TestCase("1ST")]
|
||||
[TestCase("7_ELEVEN")]
|
||||
[TestCase("401K")]
|
||||
[TestCase("0")]
|
||||
[TestCase("1")]
|
||||
[TestCase("11")]
|
||||
[TestCase("92091")]
|
||||
[TestCase("1st")]
|
||||
[TestCase("7_eleven")]
|
||||
[TestCase("401k")]
|
||||
[TestCase("\0contains_escapes\t")]
|
||||
public void ValidateName_ShouldThrow_WhenNameIsInvalid(string name)
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentException>(() => { Tool.ValidateName(name); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region .ValidateNumber
|
||||
[TestCase("0")]
|
||||
[TestCase("10")]
|
||||
[TestCase("1234567890")]
|
||||
public void ValidateNumber_ShouldNotThrow_WhenNumberIsValid(string number)
|
||||
{
|
||||
Assert.DoesNotThrow(() => { Tool.ValidateNumber(number); });
|
||||
}
|
||||
|
||||
[TestCase("01")]
|
||||
[TestCase("1a")]
|
||||
public void ValidateNumber_ShouldThrow_WhenNumberIsInvalid(string number)
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentException>(() => { Tool.ValidateNumber(number); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region .ValidateTag
|
||||
[TestCase("MALE")]
|
||||
[TestCase("MALE_ACTOR")]
|
||||
[TestCase("ACTOR_1899")]
|
||||
[TestCase("AA")]
|
||||
[TestCase("B1")]
|
||||
[TestCase("_1")]
|
||||
public void ValidateTag_ShouldNotThrow_WhenTagIsValid(string tag)
|
||||
{
|
||||
Assert.DoesNotThrow(() => { Tool.ValidateTag(tag); });
|
||||
}
|
||||
|
||||
[TestCase("")]
|
||||
[TestCase("MALE ACTOR")]
|
||||
[TestCase("MALEaCTOR")]
|
||||
[TestCase("MALE-ACTOR")]
|
||||
[TestCase("MALE/ACTOR")]
|
||||
[TestCase("MALE.ACTOR")]
|
||||
[TestCase("MALE:ACTOR")]
|
||||
[TestCase("0")]
|
||||
[TestCase("1")]
|
||||
[TestCase("11")]
|
||||
[TestCase("92091")]
|
||||
[TestCase("1ST")]
|
||||
[TestCase("7_ELEVEN")]
|
||||
[TestCase("401K")]
|
||||
[TestCase("\0CONTAINS_ESCAPES\t")]
|
||||
public void ValidateTag_ShouldThrow_WhenTagIsInvalid(string tag)
|
||||
{
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentException>(() => { Tool.ValidateTag(tag); });
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region .ParseTagAndName
|
||||
[TestCase("MALE:humphrey", "MALE", "humphrey")]
|
||||
[TestCase("ACTOR:humphrey_bogart", "ACTOR", "humphrey_bogart")]
|
||||
[TestCase("ACTOR_1899:humphrey_1899", "ACTOR_1899", "humphrey_1899")]
|
||||
[TestCase("humphrey_bogart", "", "humphrey_bogart")]
|
||||
[TestCase("ACTOR:humphrey", "ACTOR", "humphrey")]
|
||||
public void ParseTagAndName_ShouldParseInput_When_InputIsValid(string input, string expectedTag, string expectedName)
|
||||
{
|
||||
Tool.ParseTagAndName(input, out var tag, out var name);
|
||||
|
||||
Assert.AreEqual(expectedTag, tag);
|
||||
Assert.AreEqual(expectedName, name);
|
||||
}
|
||||
|
||||
[TestCase(":humphrey")]
|
||||
[TestCase("humphrey bogart")]
|
||||
[TestCase("actor:humphrey")]
|
||||
[TestCase("actor:humphrey")]
|
||||
[TestCase("ACTOR:HUMPHREY")]
|
||||
public void ParseTagAndName_ShouldThrow_When_InputIsInvalid(string input)
|
||||
{
|
||||
var tag = "UNTOUCHED";
|
||||
var name = "untouched";
|
||||
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentException>(() => { Tool.ParseTagAndName(input, out tag, out name); });
|
||||
Assert.AreEqual("UNTOUCHED", tag);
|
||||
Assert.AreEqual("untouched", name);
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseTagAndName_ShouldThrow_When_InputIncludesBadCharacters(
|
||||
[Values(' ', '-', '/', '.', ':')] char ch,
|
||||
[Values("MALE$0ACTOR:humphrey", "ACTOR:humphrey$0:bogart")] string str
|
||||
)
|
||||
{
|
||||
ParseTagAndName_ShouldThrow_When_InputIsInvalid(str.Replace("$0", $"{ch}"));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region .ParseTagIndexName
|
||||
[TestCase("MALE:humphrey", "MALE", 0, "humphrey")]
|
||||
[TestCase("ACTOR:humphrey_bogart", "ACTOR", 0, "humphrey_bogart")]
|
||||
[TestCase("ACTOR_1899:humphrey_1899", "ACTOR_1899", 0, "humphrey_1899")]
|
||||
[TestCase("humphrey_bogart", "", -1, "humphrey_bogart")]
|
||||
[TestCase("ACTRESS:3:mieko_harada", "ACTRESS", 3, "mieko_harada")]
|
||||
[TestCase("ACTRESS:0:mieko_harada", "ACTRESS", 0, "mieko_harada")]
|
||||
[TestCase("A1:100:mieko1", "A1", 100, "mieko1")]
|
||||
[TestCase("A1:10000:mieko1", "A1", 10000, "mieko1")]
|
||||
public void ParseTagIndexName_ShouldParseInput_When_InputIsValid(string input, string expectedTag, int expectedIndex, string expectedName)
|
||||
{
|
||||
Tool.ParseTagIndexName(input, out var tag, out var index, out var name);
|
||||
|
||||
Assert.AreEqual(expectedTag, tag);
|
||||
Assert.AreEqual(expectedIndex, index);
|
||||
Assert.AreEqual(expectedName, name);
|
||||
}
|
||||
|
||||
[TestCase("")]
|
||||
[TestCase("A")]
|
||||
[TestCase("Aa")]
|
||||
[TestCase("aA")]
|
||||
[TestCase("1a")]
|
||||
[TestCase("1")]
|
||||
[TestCase(":name")]
|
||||
[TestCase("A:")]
|
||||
[TestCase("a:name")]
|
||||
[TestCase("Aa:name")]
|
||||
[TestCase("aA:name")]
|
||||
[TestCase("1A:name")]
|
||||
[TestCase("1:name")]
|
||||
[TestCase(":1:name")]
|
||||
[TestCase("A:1:")]
|
||||
[TestCase("A::name")]
|
||||
[TestCase("a:1:name")]
|
||||
[TestCase("Aa:1:name")]
|
||||
[TestCase("aA:1:name")]
|
||||
[TestCase("1A:1:name")]
|
||||
[TestCase("1:1:name")]
|
||||
[TestCase("A:1:N")]
|
||||
[TestCase("A:1:nN")]
|
||||
[TestCase("A:1:Nn")]
|
||||
[TestCase("A:1:1name")]
|
||||
[TestCase("A:1:1")]
|
||||
[TestCase("A:-0:name")]
|
||||
[TestCase("A:-1:name")]
|
||||
[TestCase("A:01:name")]
|
||||
[TestCase("A:00:name")]
|
||||
[TestCase("A:10001:a")]
|
||||
[TestCase("A:1:a:")]
|
||||
[TestCase(":A:1:a")]
|
||||
[TestCase("A:1:a:a")]
|
||||
[TestCase("A:1:a:A")]
|
||||
[TestCase("A:1:a:1")]
|
||||
public void ParseTagIndexName_ShouldThrow_When_InputIsInvalid(string input)
|
||||
{
|
||||
var tag = "UNTOUCHED";
|
||||
var index = -1;
|
||||
var name = "untouched";
|
||||
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentException>(() => { Tool.ParseTagIndexName(input, out tag, out index, out name); });
|
||||
Assert.AreEqual("UNTOUCHED", tag);
|
||||
Assert.AreEqual(-1, index);
|
||||
Assert.AreEqual("untouched", name);
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseTagIndexName_ShouldThrow_When_InputIncludesBadCharacters(
|
||||
[Values('!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '{', '}', '[', ']',
|
||||
'/', '=', '?', '+', '\\', '|', '-', ';', ':', '\'', '"', '<', '.', '>')] char ch,
|
||||
[Values("$0", "$0a", "a$0", "$0:a", "A$0:a", "$0A:a", "A:$0:a", "A:$01:a", "A:1$0:a", "A:1:a$0", "$0A:1:a")] string str
|
||||
)
|
||||
{
|
||||
ParseTagIndexName_ShouldThrow_When_InputIsInvalid(str.Replace("$0", $"{ch}"));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region .ParseTagIndex
|
||||
[TestCase("", "", 0)]
|
||||
[TestCase("VIDEO:0", "VIDEO", 0)]
|
||||
[TestCase("VIDEO:1", "VIDEO", 1)]
|
||||
[TestCase("AUDIO:2", "AUDIO", 2)]
|
||||
[TestCase(":0", "", 0)]
|
||||
[TestCase(":1", "", 1)]
|
||||
[TestCase(":100", "", 100)]
|
||||
[TestCase("VIDEO:10000", "VIDEO", 10000)]
|
||||
public void ParseTagIndex_ShouldParseInput_When_InputIsValid(string input, string expectedTag, int expectedIndex)
|
||||
{
|
||||
Tool.ParseTagIndex(input, out var tag, out var index);
|
||||
|
||||
Assert.AreEqual(expectedTag, tag);
|
||||
Assert.AreEqual(expectedIndex, index);
|
||||
}
|
||||
|
||||
[TestCase("a")]
|
||||
[TestCase("Aa")]
|
||||
[TestCase("aA")]
|
||||
[TestCase("1A")]
|
||||
[TestCase("1")]
|
||||
[TestCase(":")]
|
||||
[TestCase(":a")]
|
||||
[TestCase(":A")]
|
||||
[TestCase(":-0")]
|
||||
[TestCase(":-1")]
|
||||
[TestCase(":01")]
|
||||
[TestCase(":00")]
|
||||
[TestCase("A:")]
|
||||
[TestCase("A:a")]
|
||||
[TestCase("A:A")]
|
||||
[TestCase("A:-0")]
|
||||
[TestCase("A:-1")]
|
||||
[TestCase("A:01")]
|
||||
[TestCase("A:00")]
|
||||
[TestCase("A:10001")]
|
||||
[TestCase("A:1:")]
|
||||
[TestCase(":A:1")]
|
||||
[TestCase("A:1:2")]
|
||||
[TestCase("A:A:1")]
|
||||
public void ParseTagIndex_ShouldThrow_When_InputIsInvalid(string input)
|
||||
{
|
||||
var tag = "UNTOUCHED";
|
||||
var index = -1;
|
||||
|
||||
#pragma warning disable IDE0058
|
||||
Assert.Throws<ArgumentException>(() => { Tool.ParseTagIndex(input, out tag, out index); });
|
||||
Assert.AreEqual("UNTOUCHED", tag);
|
||||
Assert.AreEqual(-1, index);
|
||||
#pragma warning restore IDE0058
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseTagIndex_ShouldThrow_When_InputIncludesBadCharacters(
|
||||
[Values('!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '{', '}', '[', ']',
|
||||
'/', '=', '?', '+', '\\', '|', '-', ';', ':', '\'', '"', '<', '.', '>')] char ch,
|
||||
[Values("$0", "$0A", "A$0", "$0:1", "A$0:1", "$0A:1", "A:1$0", "A:$01")] string str
|
||||
)
|
||||
{
|
||||
ParseTagIndex_ShouldThrow_When_InputIsInvalid(str.Replace("$0", $"{ch}"));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17bfd5c3db2e476b6b04101190819090
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,743 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class ValidatedGraphConfigTest
|
||||
{
|
||||
private const string _PassThroughConfigText = @"
|
||||
node {
|
||||
calculator: ""PassThroughCalculator""
|
||||
input_stream: ""in""
|
||||
output_stream: ""out1""
|
||||
}
|
||||
node {
|
||||
calculator: ""PassThroughCalculator""
|
||||
input_stream: ""out1""
|
||||
output_stream: ""out""
|
||||
}
|
||||
input_stream: ""in""
|
||||
output_stream: ""out""
|
||||
";
|
||||
|
||||
private const string _FlowLimiterConfigText = @"
|
||||
input_stream: ""input_video""
|
||||
input_stream: ""output""
|
||||
|
||||
node {
|
||||
calculator: ""FlowLimiterCalculator""
|
||||
input_stream: ""input_video""
|
||||
input_stream: ""FINISHED:output""
|
||||
input_stream_info: {
|
||||
tag_index: ""FINISHED""
|
||||
back_edge: true
|
||||
}
|
||||
input_side_packet: ""MAX_IN_FLIGHT:max_in_flight""
|
||||
input_side_packet: ""OPTIONS:flow_limiter_calculator_options""
|
||||
output_stream: ""throttled_input_video""
|
||||
}
|
||||
";
|
||||
|
||||
private const string _ImageTransformationConfigText = @"
|
||||
input_stream: ""input_video""
|
||||
|
||||
node: {
|
||||
calculator: ""ImageTransformationCalculator""
|
||||
input_stream: ""IMAGE:input_video""
|
||||
input_side_packet: ""ROTATION_DEGREES:input_rotation""
|
||||
input_side_packet: ""FLIP_HORIZONTALLY:input_horizontally_flipped""
|
||||
input_side_packet: ""FLIP_VERTICALLY:input_vertically_flipped""
|
||||
output_stream: ""IMAGE:transformed_input_video""
|
||||
}
|
||||
";
|
||||
|
||||
private const string _ConstantSidePacketConfigText = @"
|
||||
node {
|
||||
calculator: ""ConstantSidePacketCalculator""
|
||||
output_side_packet: ""PACKET:0:int_packet""
|
||||
output_side_packet: ""PACKET:1:float_packet""
|
||||
output_side_packet: ""PACKET:2:bool_packet""
|
||||
output_side_packet: ""PACKET:3:string_packet""
|
||||
options: {
|
||||
[mediapipe.ConstantSidePacketCalculatorOptions.ext]: {
|
||||
packet { int_value: 256 }
|
||||
packet { float_value: 0.5f }
|
||||
packet { bool_value: false }
|
||||
packet { string_value: ""string"" }
|
||||
}
|
||||
}
|
||||
}
|
||||
";
|
||||
|
||||
private const string _FaceDetectionShortRangeConfigText = @"
|
||||
input_stream: ""image""
|
||||
input_stream: ""roi""
|
||||
|
||||
node {
|
||||
calculator: ""FaceDetectionShortRange""
|
||||
input_stream: ""IMAGE:image""
|
||||
input_stream: ""ROI:roi""
|
||||
output_stream: ""DETECTIONS:detections""
|
||||
}
|
||||
";
|
||||
|
||||
#region Constructor
|
||||
[Test]
|
||||
public void Ctor_ShouldInstantiateValidatedGraphConfig()
|
||||
{
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
var config = new ValidatedGraphConfig();
|
||||
config.Dispose();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
Assert.False(config.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var config = new ValidatedGraphConfig();
|
||||
config.Dispose();
|
||||
|
||||
Assert.True(config.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #Initialize
|
||||
[Test]
|
||||
public void Initialize_ShouldReturnOk_When_CalledWithConfig()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
using (var status = config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)))
|
||||
{
|
||||
Assert.True(status.Ok());
|
||||
}
|
||||
Assert.True(config.Initialized());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Initialize_ShouldReturnOk_When_CalledWithValidGraphType()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
using (var status = config.Initialize("SwitchContainer"))
|
||||
{
|
||||
Assert.True(status.Ok());
|
||||
}
|
||||
Assert.True(config.Initialized());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Initialize_ShouldReturnInternalError_When_CalledWithInvalidGraphType()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
using (var status = config.Initialize("InvalidSubgraph"))
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.NotFound, status.Code());
|
||||
}
|
||||
Assert.False(config.Initialized());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #ValidateRequiredSidePackets
|
||||
[Test]
|
||||
public void ValidateRequiredSidePackets_ShouldReturnOk_When_TheConfigDoesNotRequireSidePackets_And_SidePacketIsEmpty()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
using (var status = config.ValidateRequiredSidePackets(sidePacket))
|
||||
{
|
||||
Assert.True(status.Ok());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ValidateRequiredSidePackets_ShouldReturnOk_When_TheConfigDoesNotRequireSidePackets_And_SidePacketIsNotEmpty()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
sidePacket.Emplace("in", new IntPacket(0));
|
||||
using (var status = config.ValidateRequiredSidePackets(sidePacket))
|
||||
{
|
||||
Assert.True(status.Ok());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ValidateRequiredSidePackets_ShouldReturnOk_When_AllTheSidePacketsAreOptional_And_SidePacketIsEmpty()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_FlowLimiterConfigText)).AssertOk();
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
using (var status = config.ValidateRequiredSidePackets(sidePacket))
|
||||
{
|
||||
Assert.True(status.Ok());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ValidateRequiredSidePackets_ShouldReturnInvalidArgumentError_When_TheConfigRequiresSidePackets_And_SidePacketIsEmpty()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ImageTransformationConfigText)).AssertOk();
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
using (var status = config.ValidateRequiredSidePackets(sidePacket))
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.InvalidArgument, status.Code());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ValidateRequiredSidePackets_ShouldReturnInvalidArgumentError_When_AllTheRequiredSidePacketsAreNotGiven()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ImageTransformationConfigText)).AssertOk();
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
sidePacket.Emplace("input_horizontally_flipped", new BoolPacket(false));
|
||||
sidePacket.Emplace("input_vertically_flipped", new BoolPacket(true));
|
||||
using (var status = config.ValidateRequiredSidePackets(sidePacket))
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.InvalidArgument, status.Code());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ValidateRequiredSidePackets_ShouldReturnInvalidArgumentError_When_TheSidePacketValuesAreWrong()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ImageTransformationConfigText)).AssertOk();
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
sidePacket.Emplace("input_horizontally_flipped", new BoolPacket(false));
|
||||
sidePacket.Emplace("input_vertically_flipped", new BoolPacket(true));
|
||||
sidePacket.Emplace("input_rotation", new StringPacket("0"));
|
||||
using (var status = config.ValidateRequiredSidePackets(sidePacket))
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.InvalidArgument, status.Code());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ValidateRequiredSidePackets_ShouldReturnOk_When_AllTheRequiredSidePacketsAreGiven()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ImageTransformationConfigText)).AssertOk();
|
||||
using (var sidePacket = new SidePacket())
|
||||
{
|
||||
sidePacket.Emplace("input_horizontally_flipped", new BoolPacket(false));
|
||||
sidePacket.Emplace("input_vertically_flipped", new BoolPacket(true));
|
||||
sidePacket.Emplace("input_rotation", new IntPacket(0));
|
||||
using (var status = config.ValidateRequiredSidePackets(sidePacket))
|
||||
{
|
||||
Assert.True(status.Ok());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Config
|
||||
[Test]
|
||||
public void Config_ShouldReturnAnEmptyConfig_When_NotInitialized()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
var canonicalizedConfig = config.Config();
|
||||
Assert.AreEqual(canonicalizedConfig.CalculateSize(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Config_ShouldReturnTheCanonicalizedConfig_When_TheConfigIsPassThroughConfig()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
var originalConfig = CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText);
|
||||
config.Initialize(originalConfig).AssertOk();
|
||||
var canonicalizedConfig = config.Config();
|
||||
|
||||
Assert.AreEqual(originalConfig.Node, canonicalizedConfig.Node);
|
||||
Assert.AreEqual(originalConfig.InputStream, canonicalizedConfig.InputStream);
|
||||
Assert.AreEqual(originalConfig.OutputStream, canonicalizedConfig.OutputStream);
|
||||
Assert.IsEmpty(originalConfig.Executor);
|
||||
Assert.AreEqual(1, canonicalizedConfig.Executor.Count);
|
||||
Assert.AreEqual(0, canonicalizedConfig.Executor[0].CalculateSize());
|
||||
|
||||
Assert.AreEqual(80, originalConfig.CalculateSize());
|
||||
Assert.AreEqual(82, canonicalizedConfig.CalculateSize());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Config_ShouldReturnTheCanonicalizedConfig_When_TheConfigIsFaceDetectionShortRangeCommonConfig()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
var originalConfig = CalculatorGraphConfig.Parser.ParseFromTextFormat(_FaceDetectionShortRangeConfigText);
|
||||
config.Initialize(originalConfig).AssertOk();
|
||||
var canonicalizedConfig = config.Config();
|
||||
|
||||
Assert.AreEqual(84, originalConfig.CalculateSize());
|
||||
// 2167 on CPU, 2166 on GPU
|
||||
Assert.AreEqual(2166, canonicalizedConfig.CalculateSize(), 1);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region InputStreamInfos
|
||||
[Test]
|
||||
public void InputStreamInfos_ShouldReturnEmptyList_When_NotInitialized()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
Assert.IsEmpty(config.InputStreamInfos());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InputStreamInfos_ShouldReturnEmptyList_When_NoInputStreamExists()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ConstantSidePacketConfigText)).AssertOk();
|
||||
Assert.IsEmpty(config.InputStreamInfos());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InputStreamInfos_ShouldReturnEdgeInfoList_When_InputStreamsExist()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
var inputStreamInfos = config.InputStreamInfos();
|
||||
|
||||
Assert.AreEqual(inputStreamInfos.Count, 2);
|
||||
|
||||
var inStream = inputStreamInfos.First((edgeInfo) => edgeInfo.name == "in");
|
||||
Assert.AreEqual(0, inStream.upstream);
|
||||
Assert.AreEqual(NodeType.Calculator, inStream.parentNode.type);
|
||||
Assert.AreEqual(0, inStream.parentNode.index);
|
||||
Assert.False(inStream.backEdge);
|
||||
|
||||
var out1Stream = inputStreamInfos.First((edgeInfo) => edgeInfo.name == "out1");
|
||||
Assert.AreEqual(1, out1Stream.upstream);
|
||||
Assert.AreEqual(NodeType.Calculator, out1Stream.parentNode.type);
|
||||
Assert.AreEqual(1, out1Stream.parentNode.index);
|
||||
Assert.False(out1Stream.backEdge);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OutputStreamInfos
|
||||
[Test]
|
||||
public void OutputStreamInfos_ShouldReturnEmptyList_When_NotInitialized()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
Assert.IsEmpty(config.OutputStreamInfos());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OutputStreamInfos_ShouldReturnEdgeInfoList_When_OutputStreamsExist()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
var outputStreamInfos = config.OutputStreamInfos();
|
||||
|
||||
Assert.AreEqual(3, outputStreamInfos.Count);
|
||||
|
||||
var inStream = outputStreamInfos.First((edgeInfo) => edgeInfo.name == "in");
|
||||
Assert.AreEqual(-1, inStream.upstream);
|
||||
Assert.AreEqual(NodeType.GraphInputStream, inStream.parentNode.type);
|
||||
Assert.AreEqual(2, inStream.parentNode.index, 2);
|
||||
Assert.False(inStream.backEdge);
|
||||
|
||||
var out1Stream = outputStreamInfos.First((edgeInfo) => edgeInfo.name == "out1");
|
||||
Assert.AreEqual(-1, out1Stream.upstream);
|
||||
Assert.AreEqual(NodeType.Calculator, out1Stream.parentNode.type);
|
||||
Assert.AreEqual(0, out1Stream.parentNode.index);
|
||||
Assert.False(out1Stream.backEdge);
|
||||
|
||||
var outStream = outputStreamInfos.First((edgeInfo) => edgeInfo.name == "out");
|
||||
Assert.AreEqual(-1, outStream.upstream);
|
||||
Assert.AreEqual(NodeType.Calculator, outStream.parentNode.type);
|
||||
Assert.AreEqual(1, outStream.parentNode.index);
|
||||
Assert.False(outStream.backEdge);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region InputSidePacketInfos
|
||||
[Test]
|
||||
public void InputSidePacketInfos_ShouldReturnEmptyList_When_NotInitialized()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
Assert.IsEmpty(config.InputSidePacketInfos());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InputSidePacketInfos_ShouldReturnEmptyList_When_NoInputSidePacketExists()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
Assert.IsEmpty(config.InputSidePacketInfos());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InputSidePacketInfos_ShouldReturnEdgeInfoList_When_InputSidePacketsExist()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_FlowLimiterConfigText)).AssertOk();
|
||||
var inputSidePacketInfos = config.InputSidePacketInfos();
|
||||
|
||||
Assert.True(inputSidePacketInfos.Count >= 2);
|
||||
|
||||
var maxInFlightPacket = inputSidePacketInfos.First((edgeInfo) => edgeInfo.name == "max_in_flight");
|
||||
Assert.AreEqual(-1, maxInFlightPacket.upstream);
|
||||
Assert.AreEqual(NodeType.Calculator, maxInFlightPacket.parentNode.type);
|
||||
Assert.False(maxInFlightPacket.backEdge);
|
||||
|
||||
var flowLimiterCalculatorOptionsPacket = inputSidePacketInfos.First((edgeInfo) => edgeInfo.name == "flow_limiter_calculator_options");
|
||||
Assert.AreEqual(-1, flowLimiterCalculatorOptionsPacket.upstream);
|
||||
Assert.AreEqual(NodeType.Calculator, flowLimiterCalculatorOptionsPacket.parentNode.type);
|
||||
Assert.False(flowLimiterCalculatorOptionsPacket.backEdge);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OutputSidePacketInfos
|
||||
[Test]
|
||||
public void OutputSidePacketInfos_ShouldReturnEmptyList_When_NotInitialized()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
Assert.IsEmpty(config.OutputSidePacketInfos());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OutputSidePacketInfos_ShouldReturnEmptyList_When_NoOutputSidePacketExists()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
Assert.IsEmpty(config.OutputSidePacketInfos());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OutputSidePacketInfos_ShouldReturnEdgeInfoList_When_OutputSidePacketsExist()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ConstantSidePacketConfigText)).AssertOk();
|
||||
var outputSidePacketInfos = config.OutputSidePacketInfos();
|
||||
|
||||
Assert.AreEqual(4, outputSidePacketInfos.Count);
|
||||
|
||||
var intPacket = outputSidePacketInfos.First((edgeInfo) => edgeInfo.name == "int_packet");
|
||||
Assert.AreEqual(-1, intPacket.upstream);
|
||||
Assert.AreEqual(NodeType.Calculator, intPacket.parentNode.type);
|
||||
Assert.False(intPacket.backEdge);
|
||||
|
||||
var floatPacket = outputSidePacketInfos.First((edgeInfo) => edgeInfo.name == "float_packet");
|
||||
Assert.AreEqual(-1, floatPacket.upstream);
|
||||
Assert.AreEqual(NodeType.Calculator, floatPacket.parentNode.type);
|
||||
Assert.False(floatPacket.backEdge);
|
||||
|
||||
var boolPacket = outputSidePacketInfos.First((edgeInfo) => edgeInfo.name == "bool_packet");
|
||||
Assert.AreEqual(-1, boolPacket.upstream);
|
||||
Assert.AreEqual(NodeType.Calculator, boolPacket.parentNode.type);
|
||||
Assert.False(boolPacket.backEdge);
|
||||
|
||||
var stringPacket = outputSidePacketInfos.First((edgeInfo) => edgeInfo.name == "string_packet");
|
||||
Assert.AreEqual(-1, stringPacket.upstream);
|
||||
Assert.AreEqual(NodeType.Calculator, stringPacket.parentNode.type);
|
||||
Assert.False(stringPacket.backEdge);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OutputStreamIndex
|
||||
[Test]
|
||||
public void OutputStreamIndex_ShouldReturnNegativeValue_When_NotInitialized()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
Assert.AreEqual(-1, config.OutputStreamIndex(""));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OutputStreamIndex_ShouldReturnNegativeValue_When_TheNameIsInvalid()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
Assert.AreEqual(-1, config.OutputStreamIndex("unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OutputStreamIndex_ShouldReturnIndex_When_TheNameIsValid()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
Assert.AreEqual(2, config.OutputStreamIndex("out"));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OutputStreamIndex_ShouldReturnIndex_When_TheStreamIsNotPublic()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
Assert.AreEqual(1, config.OutputStreamIndex("out1"));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OutputSidePacketIndex
|
||||
[Test]
|
||||
public void OutputSidePacketIndex_ShouldReturnNegativeValue_When_NotInitialized()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
Assert.AreEqual(-1, config.OutputSidePacketIndex(""));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OutputSidePacketIndex_ShouldReturnNegativeValue_When_TheNameIsInvalid()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ConstantSidePacketConfigText)).AssertOk();
|
||||
Assert.AreEqual(-1, config.OutputSidePacketIndex("unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OutputSidePacketIndex_ShouldReturnIndex_When_TheNameIsValid()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ConstantSidePacketConfigText)).AssertOk();
|
||||
Assert.AreEqual(0, config.OutputSidePacketIndex("int_packet"));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region OutputStreamToNode
|
||||
[Test]
|
||||
public void OutputStreamToNode_ShouldReturnNegativeValue_When_NotInitialized()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
Assert.AreEqual(-1, config.OutputStreamToNode(""));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OutputStreamToNode_ShouldReturnNegativeValue_When_TheNameIsInvalid()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
Assert.AreEqual(-1, config.OutputStreamToNode("unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OutputStreamToNode_ShouldReturnIndex_When_TheNameIsValid()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
Assert.AreEqual(0, config.OutputStreamToNode("out1"));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region RegisteredSidePacketTypeName
|
||||
[Test]
|
||||
public void RegisteredSidePacketTypeName_ShouldReturnInvalidArgumentError_When_TheSidePacketDoesNotExist()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
using (var statusOrString = config.RegisteredSidePacketTypeName("max_in_flight"))
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.InvalidArgument, statusOrString.status.Code());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RegisteredSidePacketTypeName_ShouldReturnUnknownError_When_TheSidePacketTypeCannotBeDetermined()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_FlowLimiterConfigText)).AssertOk();
|
||||
using (var statusOrString = config.RegisteredSidePacketTypeName("max_in_flight"))
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.Unknown, statusOrString.status.Code());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region RegisteredStreamTypeName
|
||||
[Test]
|
||||
public void RegisteredStreamTypeName_ShouldReturnInvalidArgumentError_When_TheStreamDoesNotExist()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
using (var statusOrString = config.RegisteredStreamTypeName("in"))
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.InvalidArgument, statusOrString.status.Code());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RegisteredStreamTypeName_ShouldReturnUnknownError_When_TheStreamTypeCannotBeDetermined()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
using (var statusOrString = config.RegisteredStreamTypeName("in"))
|
||||
{
|
||||
Assert.AreEqual(Status.StatusCode.Unknown, statusOrString.status.Code());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Package
|
||||
[Test]
|
||||
public void Package_ShouldReturnNull_When_NotInitialized()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
Assert.IsNull(config.Package());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Package_ShouldReturnNull_When_TheNamespaceIsNotSet()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_PassThroughConfigText)).AssertOk();
|
||||
Assert.IsNull(config.Package());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IsReservedExecutorName
|
||||
[Test]
|
||||
public void IsReservedExecutorName_ShouldReturnFalse_When_TheNameIsNotReserved()
|
||||
{
|
||||
Assert.False(ValidatedGraphConfig.IsReservedExecutorName("unknown"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsReservedExecutorName_ShouldReturnFalse_When_TheNameIsReserved()
|
||||
{
|
||||
Assert.True(ValidatedGraphConfig.IsReservedExecutorName("default"));
|
||||
Assert.True(ValidatedGraphConfig.IsReservedExecutorName("gpu"));
|
||||
Assert.True(ValidatedGraphConfig.IsReservedExecutorName("__gpu"));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IsExternalSidePacket
|
||||
[Test]
|
||||
public void IsExternalSidePacket_ShouldReturnFalse_When_NotInitialized()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
Assert.False(config.IsExternalSidePacket("max_in_flight"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void IsExternalSidePacket_ShouldReturnFalse_When_TheSidePacketIsInternal()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ConstantSidePacketConfigText)).AssertOk();
|
||||
Assert.False(config.IsExternalSidePacket("int_packet"));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsExternalSidePacket_ShouldReturnTrue_When_TheSidePacketIsExternal()
|
||||
{
|
||||
using (var config = new ValidatedGraphConfig())
|
||||
{
|
||||
config.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_FlowLimiterConfigText)).AssertOk();
|
||||
Assert.True(config.IsExternalSidePacket("max_in_flight"));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 593d3340196fca643b5346fb3cd60f7e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34ad49218cadf094e8bc99057c757771
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,192 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class GlCalculatorHelperTest
|
||||
{
|
||||
#region Constructor
|
||||
[Test, GpuOnly]
|
||||
public void Ctor_ShouldInstantiateGlCalculatorHelper()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
Assert.AreNotEqual(IntPtr.Zero, glCalculatorHelper.mpPtr);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test, GpuOnly]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
Assert.False(glCalculatorHelper.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test, GpuOnly]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var glCalculatorHelper = new GlCalculatorHelper();
|
||||
glCalculatorHelper.Dispose();
|
||||
|
||||
Assert.True(glCalculatorHelper.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #InitializeForTest
|
||||
[Test, GpuOnly]
|
||||
public void InitializeForTest_ShouldInitialize()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
Assert.False(glCalculatorHelper.Initialized());
|
||||
glCalculatorHelper.InitializeForTest(GpuResources.Create().Value());
|
||||
Assert.True(glCalculatorHelper.Initialized());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #RunInGlContext
|
||||
[Test, GpuOnly]
|
||||
public void RunInGlContext_ShouldReturnOk_When_FunctionReturnsOk()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
glCalculatorHelper.InitializeForTest(GpuResources.Create().Value());
|
||||
|
||||
var status = glCalculatorHelper.RunInGlContext(() => { });
|
||||
Assert.True(status.Ok());
|
||||
}
|
||||
}
|
||||
|
||||
[Test, GpuOnly]
|
||||
public void RunInGlContext_ShouldReturnInternal_When_FunctionThrows()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
glCalculatorHelper.InitializeForTest(GpuResources.Create().Value());
|
||||
|
||||
var status = glCalculatorHelper.RunInGlContext((GlCalculatorHelper.GlFunction)(() => { throw new Exception("Function Throws"); }));
|
||||
Assert.AreEqual(Status.StatusCode.Internal, status.Code());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #CreateSourceTexture
|
||||
[Test, GpuOnly]
|
||||
public void CreateSourceTexture_ShouldReturnGlTexture_When_CalledWithImageFrame()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
glCalculatorHelper.InitializeForTest(GpuResources.Create().Value());
|
||||
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Srgba, 32, 24))
|
||||
{
|
||||
var status = glCalculatorHelper.RunInGlContext(() =>
|
||||
{
|
||||
var texture = glCalculatorHelper.CreateSourceTexture(imageFrame);
|
||||
|
||||
Assert.AreEqual(32, texture.width);
|
||||
Assert.AreEqual(24, texture.height);
|
||||
|
||||
texture.Dispose();
|
||||
});
|
||||
Assert.True(status.Ok());
|
||||
|
||||
status.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test, GpuOnly]
|
||||
[Ignore("Skip because a thread will hang")]
|
||||
public void CreateSourceTexture_ShouldFail_When_ImageFrameFormatIsInvalid()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
glCalculatorHelper.InitializeForTest(GpuResources.Create().Value());
|
||||
|
||||
using (var imageFrame = new ImageFrame(ImageFormat.Types.Format.Sbgra, 32, 24))
|
||||
{
|
||||
var status = glCalculatorHelper.RunInGlContext(() =>
|
||||
{
|
||||
using (var texture = glCalculatorHelper.CreateSourceTexture(imageFrame))
|
||||
{
|
||||
texture.Release();
|
||||
}
|
||||
});
|
||||
Assert.AreEqual(Status.StatusCode.FailedPrecondition, status.Code());
|
||||
|
||||
status.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #CreateDestinationTexture
|
||||
[Test, GpuOnly]
|
||||
public void CreateDestinationTexture_ShouldReturnGlTexture_When_GpuBufferFormatIsValid()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
glCalculatorHelper.InitializeForTest(GpuResources.Create().Value());
|
||||
|
||||
var status = glCalculatorHelper.RunInGlContext(() =>
|
||||
{
|
||||
var glTexture = glCalculatorHelper.CreateDestinationTexture(32, 24, GpuBufferFormat.kBGRA32);
|
||||
|
||||
Assert.AreEqual(32, glTexture.width);
|
||||
Assert.AreEqual(24, glTexture.height);
|
||||
});
|
||||
|
||||
Assert.True(status.Ok());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #framebuffer
|
||||
[Test, GpuOnly]
|
||||
public void Framebuffer_ShouldReturnGLName()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
glCalculatorHelper.InitializeForTest(GpuResources.Create().Value());
|
||||
|
||||
// default frame buffer
|
||||
Assert.AreEqual(0, glCalculatorHelper.framebuffer);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #GetGlContext
|
||||
[Test, GpuOnly]
|
||||
public void GetGlContext_ShouldReturnCurrentContext()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
glCalculatorHelper.InitializeForTest(GpuResources.Create().Value());
|
||||
|
||||
using (var glContext = glCalculatorHelper.GetGlContext())
|
||||
{
|
||||
#if UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX || UNITY_ANDROID
|
||||
Assert.AreNotEqual(IntPtr.Zero, glContext.eglContext);
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
Assert.AreNotEqual(IntPtr.Zero, glContext.nsglContext);
|
||||
#elif UNITY_IOS
|
||||
Assert.AreNotEqual(IntPtr.Zero, glContext.eaglContext);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f47dcca1b6cbd6538c87a9914863444
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,83 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class GlContextTest
|
||||
{
|
||||
#region .GetCurrent
|
||||
[Test, GpuOnly]
|
||||
public void GetCurrent_ShouldReturnNull_When_CalledOutOfGlContext()
|
||||
{
|
||||
var glContext = GlContext.GetCurrent();
|
||||
|
||||
Assert.Null(glContext);
|
||||
}
|
||||
|
||||
[Test, GpuOnly]
|
||||
public void GetCurrent_ShouldReturnCurrentContext_When_CalledInGlContext()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
glCalculatorHelper.InitializeForTest(GpuResources.Create().Value());
|
||||
|
||||
glCalculatorHelper.RunInGlContext(() =>
|
||||
{
|
||||
using (var glContext = GlContext.GetCurrent())
|
||||
{
|
||||
Assert.NotNull(glContext);
|
||||
Assert.True(glContext.IsCurrent());
|
||||
}
|
||||
}).AssertOk();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #IsCurrent
|
||||
public void IsCurrent_ShouldReturnFalse_When_CalledOutOfGlContext()
|
||||
{
|
||||
var glContext = GetGlContext();
|
||||
|
||||
Assert.False(glContext.IsCurrent());
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region properties
|
||||
[Test, GpuOnly]
|
||||
public void ShouldReturnProperties()
|
||||
{
|
||||
using (var glContext = GetGlContext())
|
||||
{
|
||||
#if UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX || UNITY_ANDROID
|
||||
Assert.AreNotEqual(IntPtr.Zero, glContext.eglDisplay);
|
||||
Assert.AreNotEqual(IntPtr.Zero, glContext.eglConfig);
|
||||
Assert.AreNotEqual(IntPtr.Zero, glContext.eglContext);
|
||||
Assert.AreEqual(3, glContext.glMajorVersion);
|
||||
Assert.AreEqual(2, glContext.glMinorVersion);
|
||||
Assert.AreEqual(0, glContext.glFinishCount);
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
Assert.AreNotEqual(IntPtr.Zero, glContext.nsglContext);
|
||||
#elif UNITY_IOS
|
||||
Assert.AreNotEqual(IntPtr.Zero, glContext.eaglContext);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private GlContext GetGlContext()
|
||||
{
|
||||
using (var glCalculatorHelper = new GlCalculatorHelper())
|
||||
{
|
||||
glCalculatorHelper.InitializeForTest(GpuResources.Create().Value());
|
||||
|
||||
return glCalculatorHelper.GetGlContext();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5e3ffbb666f2d185b043064194cbf12
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,56 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class GlTextureTest
|
||||
{
|
||||
#region Constructor
|
||||
[Test, GpuOnly]
|
||||
public void Ctor_ShouldInstantiateGlTexture_When_CalledWithNoArguments()
|
||||
{
|
||||
using (var glTexture = new GlTexture())
|
||||
{
|
||||
Assert.AreEqual(0, glTexture.width);
|
||||
Assert.AreEqual(0, glTexture.height);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test, GpuOnly]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var glTexture = new GlTexture())
|
||||
{
|
||||
Assert.False(glTexture.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test, GpuOnly]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var glTexture = new GlTexture();
|
||||
glTexture.Dispose();
|
||||
|
||||
Assert.True(glTexture.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region target
|
||||
[Test, GpuOnly]
|
||||
public void Target_ShouldReturnTarget()
|
||||
{
|
||||
using (var glTexture = new GlTexture())
|
||||
{
|
||||
Assert.AreEqual(Gl.GL_TEXTURE_2D, glTexture.target);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fbe1d82329bb2b09a88651d8ac9ad4fd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,44 +0,0 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mediapipe.Tests
|
||||
{
|
||||
public class GpuResourcesTest
|
||||
{
|
||||
#region Create
|
||||
[Test, GpuOnly]
|
||||
public void Create_ShouldReturnStatusOrGpuResources()
|
||||
{
|
||||
using (var statusOrGpuResources = GpuResources.Create())
|
||||
{
|
||||
Assert.True(statusOrGpuResources.Ok());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region #isDisposed
|
||||
[Test, GpuOnly]
|
||||
public void IsDisposed_ShouldReturnFalse_When_NotDisposedYet()
|
||||
{
|
||||
using (var gpuResources = GpuResources.Create().Value())
|
||||
{
|
||||
Assert.False(gpuResources.isDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test, GpuOnly]
|
||||
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
|
||||
{
|
||||
var gpuResources = GpuResources.Create().Value();
|
||||
gpuResources.Dispose();
|
||||
|
||||
Assert.True(gpuResources.isDisposed);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e987f90210347a37b48e4a9f9f93c53
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46cfb5995c4d2b93899f4920ae0b016a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user