--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.IO;
+using Tizen;
+using Tizen.MachineLearning.Inference;
+
+namespace Tizen.MachineLearning.Inference.Tests {
+
+ [TestFixture]
+ [Description("Tizen.MachineLearning.Inference.SingleShot Tests")]
+ public class TSSingleShot
+ {
+ private readonly string TAG = "Tizen.MachineLearning.Inference TCT";
+ private readonly string _modelPath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "mobilenet_v1_1.0_224_quant.tflite";
+
+ private TensorsInfo _in_info;
+ private TensorsInfo _out_info;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
+
+ _in_info = new TensorsInfo();
+ _in_info.AddTensorInfo(TensorType.UInt8, new int[4] { 3, 224, 224, 1 });
+
+ _out_info = new TensorsInfo();
+ _out_info.AddTensorInfo(TensorType.UInt8, new int[4] { 1001, 1, 1, 1 });
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
+
+ _in_info.Dispose();
+ _out_info.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create SingleShot Instance")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.SingleShot.SingleShot C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SingleShot_INIT()
+ {
+ /* TEST CODE */
+ Assert.IsTrue(File.Exists(_modelPath), "Cannot find the mobilenet_v1_1.0_224_quant.tflite file");
+
+ try
+ {
+ var single = new SingleShot(_modelPath, _in_info, _out_info);
+ Assert.IsInstanceOf<SingleShot>(single, "Should return SingleShot instance");
+ Assert.IsNotNull(single, "Failed to create SingleShot instance");
+
+ single.Dispose();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check ArgumentException when creating SingleShot Instance")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.SingleShot.SingleShot C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SingleShot_CHECK_ArgumentException()
+ {
+ try
+ {
+ var single = new SingleShot("Unknown_Path", _in_info, _out_info);
+ }
+ catch (ArgumentException)
+ {
+ Assert.Pass("ArgumentException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invokes the model with the given input data and check exceptions")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.SingleShot.Invoke M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void Invoke_CHECK_NO_EXCEPTION()
+ {
+ Assert.IsTrue(File.Exists(_modelPath), "Cannot find the mobilenet_v1_1.0_224_quant.tflite file");
+
+ var in_buffer = new byte[3 * 224 * 224 * 1];
+ Assert.IsInstanceOf<byte[]>(in_buffer, "in_buffer payload is not of the of the type byte[]");
+ Assert.IsNotNull(in_buffer, "Fail to create the in_buffer the type byte[] ");
+
+ var out_buffer_origin = new byte[1001 * 1 * 1 * 1];
+ Assert.IsInstanceOf<byte[]>(out_buffer_origin, "out_buffer_origin payload is not of the of the type byte[]");
+ Assert.IsNotNull(out_buffer_origin, "Fail to create the out_buffer_origin the type byte[] ");
+
+ var single = new SingleShot(_modelPath, _in_info, _out_info);
+ Assert.IsInstanceOf<SingleShot>(single, "Should return SingleShot instance");
+ Assert.IsNotNull(single, "Failed to create SingleShot instance");
+
+ var in_data = _in_info.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(in_data, "Should return TensorsData instance");
+ Assert.IsNotNull(in_data, "Failed to create TensorsData instance");
+
+ in_data.SetTensorData(0, in_buffer);
+
+ /* TEST CODE */
+ try
+ {
+ var out_data = single.Invoke(in_data);
+ Assert.IsInstanceOf<TensorsData>(out_data, "Should return TensorsData instance");
+ Assert.IsNotNull(out_data, "Failed to create TensorsData instance");
+
+ var out_buffer = out_data.GetTensorData(0);
+ Assert.IsInstanceOf<byte[]>(out_buffer, "Should return byte[] instance");
+ Assert.IsNotNull(out_buffer, "Failed to create byte[] instance");
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+
+ single.Dispose();
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check IOException when calling Invoke() of Single class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.SingleShot.Invoke M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void Invoke_CHECK_IOException()
+ {
+ Assert.IsTrue(File.Exists(_modelPath), "Cannot find the mobilenet_v1_1.0_224_quant.tflite file");
+
+ var in_info = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(in_info, "Should return TensorsInfo instance");
+ Assert.IsNotNull(in_info, "Failed to create TensorsInfo instance");
+
+ var in_buffer = new byte[10 * 1 * 1 * 1];
+ Assert.IsInstanceOf<byte[]>(in_buffer, "in_buffer payload is not of the of the type byte[]");
+ Assert.IsNotNull(in_buffer, "Fail to create the in_buffer the type byte[] ");
+
+ in_info.AddTensorInfo(TensorType.UInt8, new int[4] { 10, 1, 1, 1 });
+
+ var in_data = _in_info.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(in_data, "Should return TensorsData instance");
+ Assert.IsNotNull(in_data, "Fail to create the TensorsData instance");
+
+ in_data.SetTensorData(0, in_buffer);
+
+ var single = new SingleShot(_modelPath, _in_info, _out_info);
+ Assert.IsInstanceOf<SingleShot>(single, "Should return SingleShot instance");
+ Assert.IsNotNull(single, "Failed to create SingleShot instance");
+
+ /* TEST CODE */
+ try
+ {
+ var out_data = single.Invoke(in_data);
+ }
+ catch (IOException)
+ {
+ Assert.Pass("IOException: passed!");
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen;
+using Tizen.MachineLearning.Inference;
+
+namespace Tizen.MachineLearning.Inference.Tests {
+ [TestFixture]
+ [Description("Tizen.MachineLearning.Inference.TensorsData Tests")]
+ public class TensorsDataTests
+ {
+ private readonly string TAG = "Tizen.MachineLearning.Inference TCT";
+ private TensorsInfo _tensorsInfo;
+ private int[] _in_dim;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
+
+ _tensorsInfo = new TensorsInfo();
+ _in_dim = new int[4] { 10, 1, 1, 1 };
+
+ _tensorsInfo.AddTensorInfo(TensorType.UInt8, _in_dim);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
+
+ _tensorsInfo.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Set the TensorsData and check the exception")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsData.SetTensorData M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SetTensorData_CHECK_NO_EXCEPTION()
+ {
+ var buffer_in = new byte[] { 17, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+ Assert.IsInstanceOf<byte[]>(buffer_in, "buffer_in payload is not of the of the type byte[].");
+ Assert.IsNotNull(buffer_in, "Fail to create the buffer_in.");
+
+ try
+ {
+ /* TEST CODE */
+ var tensorsData = _tensorsInfo.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData payload is not of the of the TensorsData.");
+ Assert.IsNotNull(tensorsData, "Fail to create the tensorsData.");
+
+ tensorsData.SetTensorData(0, buffer_in);
+ tensorsData.Dispose();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check ArgumentException when calling SetTensorData() of TensorsData class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsData.SetTensorData M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SetTensorData_CHECK_ArgumentException()
+ {
+ var buffer_in = new byte[] { 17, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+ Assert.IsInstanceOf<byte[]>(buffer_in, "buffer_in payload is not of the of the type byte[].");
+ Assert.IsNotNull(buffer_in, "Fail to create the buffer_in.");
+
+ try
+ {
+ var tensorsData = _tensorsInfo.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData payload is not of the of the TensorsData.");
+ Assert.IsNotNull(tensorsData, "Fail to create the tensorsData.");
+
+ tensorsData.SetTensorData(10, buffer_in);
+ }
+ catch (ArgumentException)
+ {
+ Assert.Pass("ArgumentException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Get the TensorsData and compare it with its origin")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsData.GetTensorData M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void GetTensorData_RETURN_VALUE()
+ {
+ var buffer_in = new byte[] { 17, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+ Assert.IsInstanceOf<byte[]>(buffer_in, "buffer_in is not the type of byte[].");
+ Assert.IsNotNull(buffer_in, "Fail to create buffer_in.");
+
+ var tensorsData = _tensorsInfo.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData is not the type of TensorsData.");
+ Assert.IsNotNull(tensorsData, "Fail to create tensorsData.");
+
+ tensorsData.SetTensorData(0, buffer_in);
+
+ /* TEST CODE */
+ var buffer_out = tensorsData.GetTensorData(0);
+ Assert.IsInstanceOf<byte[]>(buffer_out, "buffer_out is not the type of byte[].");
+ Assert.IsNotNull(buffer_out, "Fail to create buffer_out.");
+
+ Assert.IsTrue(buffer_in.Length == buffer_out.Length, "The length of buffer_out payload is different from buffer_in.");
+
+ for (int i = 0; i < buffer_out.Length; ++i)
+ {
+ Assert.IsTrue(buffer_in[i] == buffer_out[i], "The value of buffer_in is different from that of buffer_out");
+ }
+
+ tensorsData.Dispose();
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check ArgumentException when calling GetTensorData() of TensorsData class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsData.GetTensorData M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void GetTensorData_CHECK_ArgumentException()
+ {
+ var buffer_in = new byte[] { 17, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+ Assert.IsInstanceOf<byte[]>(buffer_in, "buffer_in is not the type of byte[].");
+ Assert.IsNotNull(buffer_in, "Fail to create buffer_in.");
+
+ var tensorsData = _tensorsInfo.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData is not the type of TensorsData.");
+ Assert.IsNotNull(tensorsData, "Fail to create tensorsData.");
+
+ tensorsData.SetTensorData(0, buffer_in);
+
+ try
+ {
+ /* TEST CODE */
+ var buffer_out = tensorsData.GetTensorData(100);
+ }
+ catch (ArgumentException)
+ {
+ Assert.Pass("ArgumentException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test property of TensorsData.")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsData.Count A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void Count_GET()
+ {
+ var buffer_in = new byte[] { 17, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+ Assert.IsInstanceOf<byte[]>(buffer_in, "buffer_in is not the type of byte[].");
+ Assert.IsNotNull(buffer_in, "Fail to create buffer_in.");
+
+ var tensorsData = _tensorsInfo.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData is not the type of TensorsData.");
+ Assert.IsNotNull(tensorsData, "Fail to create tensorsData.");
+
+ tensorsData.SetTensorData(0, buffer_in);
+
+ /* TEST CODE */
+ Assert.IsTrue(1 == tensorsData.Count, "The number of Tensor in TensorsData is different from the origin.");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen;
+using Tizen.MachineLearning.Inference;
+
+namespace Tizen.MachineLearning.Inference.Tests {
+
+ [TestFixture]
+ [Description("Tizen.MachineLearning.Inference.TensorsInfo Tests")]
+ public class TensorsInfoTests
+ {
+ private readonly string TAG = "Tizen.MachineLearning.Inference TCT";
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for Tizen.MachineLearning.Inference TEST");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Postconditions for Tizen.MachineLearning.Inference TEST");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create TensorsInfo Instance")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.TensorsInfo C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void TensorsInfo_INIT()
+ {
+ try
+ {
+ /* TEST CODE */
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create TensorsInfo instance");
+
+ tensorsInfo.Dispose();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Add TensorInfo into TensorsInfo with the input dimension information")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.AddTensorInfo M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ [Property("COVPARAM", "Tizen.MachineLearning.Inference.TensorType, int[]")]
+ public void AddTensorInfo_CHECK_NO_EXCEPTION()
+ {
+ var in_dim = new int[4] { 3, 224, 224, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ try
+ {
+ /* TEST CODE */
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+
+ Assert.IsTrue(tensorsInfo.GetTensorType(0) == TensorType.UInt8, "The TensorType is not TensorType.UInt8.");
+
+ var in_res = tensorsInfo.GetDimension(0);
+ Assert.IsInstanceOf<int[]>(in_res, "Should return int[] instance");
+ Assert.IsNotNull(in_res, "Failed to create in_res instance");
+
+ for (int i = 0; i < 4; ++i)
+ {
+ Assert.IsTrue(in_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Add TensorInfo into TensorsInfo with the name and the input dimension information")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.AddTensorInfo M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ [Property("COVPARAM", "string, Tizen.MachineLearning.Inference.TensorType, int[]")]
+ public void AddTensorInfo_CHECK_NO_EXCEPTION_WITH_NAME()
+ {
+ var in_dim = new int[4] { 3, 224, 224, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ string TensorName = "InputTensorName";
+
+ try
+ {
+ /* TEST CODE */
+ tensorsInfo.AddTensorInfo(TensorName, TensorType.UInt8, in_dim);
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+
+ /* Type checking */
+ Assert.IsTrue(tensorsInfo.GetTensorType(0) == TensorType.UInt8, "The TensorType is not TensorType.UInt8.");
+
+ /* Dimension checking */
+ var in_res = tensorsInfo.GetDimension(0);
+ Assert.IsInstanceOf<int[]>(in_res, "Should return int[] instance");
+ Assert.IsNotNull(in_res, "Failed to create in_res instance");
+
+ for (int i = 0; i < 4; ++i)
+ {
+ Assert.IsTrue(in_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ }
+
+ /* Name checking */
+ Assert.IsTrue(tensorsInfo.GetTensorName(0) == TensorName, "The name of Input Tensor is different from the origin.");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check IndexOutOfRangeException when calling AddTensorInfo() of TensorsInfo class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.AddTensorInfo M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ [Property("COVPARAM", "Tizen.MachineLearning.Inference.TensorType, int[]")]
+ public void AddTensorInfo_CHECK_IndexOutOfRangeException()
+ {
+ var in_dim = new int[4] { 3, 224, 224, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ try
+ {
+ /* TEST CODE */
+ for (int i = 0; i < 17; ++i) {
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+ }
+ Assert.True(false, "DO NOT COME HERE since the limit of tensor size is 16");
+ }
+ catch (IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check IndexOutOfRangeException when calling AddTensorInfo() of TensorsInfo class with name parameter")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.AddTensorInfo M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ [Property("COVPARAM", "string, Tizen.MachineLearning.Inference.TensorType, int[]")]
+ public void AddTensorInfo_CHECK_IndexOutOfRangeException_WITH_NAME()
+ {
+ var in_dim = new int[4] { 3, 224, 224, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ string TensorName = "InputTensorName";
+
+ try
+ {
+ /* TEST CODE */
+ for (int i = 0; i < 17; ++i)
+ {
+ tensorsInfo.AddTensorInfo(TensorName, TensorType.UInt8, in_dim);
+ }
+ Assert.True(false, "DO NOT COME HERE since the limit of tensor size is 16");
+ }
+ catch (IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Get the name of TensorInfo and compare it with its origin")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.GetTensorName M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void GetTensorName_RETURN_VALUE()
+ {
+ var in_dim = new int[4] { 3, 224, 224, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ string inTensorName = "InputTensorName";
+ tensorsInfo.AddTensorInfo(inTensorName, TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
+ string outTensorName = tensorsInfo.GetTensorName(0);
+ Assert.IsTrue(inTensorName == outTensorName, "The TensorInfo name is different from the origin.");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check IndexOutOfRangeException when calling GetTensorName() of TensorsInfo class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.GetTensorName M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void GetTensorName_CHECK_IndexOutOfRangeException()
+ {
+ var in_dim = new int[4] { 3, 224, 224, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ string inTensorName = "InputTensorName";
+ tensorsInfo.AddTensorInfo(inTensorName, TensorType.UInt8, in_dim);
+
+ try
+ {
+ string outTensorName = tensorsInfo.GetTensorName(100);
+ }
+ catch (IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Set the name of TensorInfo and check the result")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.SetTensorName M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SetTensorName_RETURN_VALUE()
+ {
+ var in_dim = new int[4] { 3, 224, 224, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ string inTensorName = "InputTensorName";
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
+ tensorsInfo.SetTensorName(0, inTensorName);
+
+ string outTensorName = tensorsInfo.GetTensorName(0);
+ Assert.IsTrue(inTensorName == outTensorName, "The TensorInfo name is different from the origin.");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check IndexOutOfRangeException when calling SetTensorName() of TensorsInfo class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.SetTensorName M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SetTensorName_CHECK_IndexOutOfRangeException()
+ {
+ var in_dim = new int[4] { 3, 224, 224, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ try
+ {
+ string inTensorName = "InputTensorName";
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
+ tensorsInfo.SetTensorName(100, inTensorName);
+ }
+ catch (IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check ArgumentException when calling SetTensorName() of TensorsInfo class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.SetTensorName M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SetTensorName_CHECK_ArgumentException()
+ {
+ var in_dim = new int[4] { 3, 224, 224, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ try
+ {
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
+ tensorsInfo.SetTensorName(0, null);
+ }
+ catch (ArgumentException)
+ {
+ Assert.Pass("ArgumentException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Set the type of TensorInfo and check the result")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.SetTensorType M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SetTensorType_RETURN_VALUE()
+ {
+ var in_dim = new int[4] { 10, 1, 1, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
+ tensorsInfo.SetTensorType(0, TensorType.Float32);
+ Assert.IsTrue(tensorsInfo.GetTensorType(0) == TensorType.Float32, "The TensorType is not TensorType.Float32.");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check IndexOutOfRangeException when calling SetTensorType() of TensorsInfo class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.SetTensorType M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SetTensorType_CHECK_IndexOutOfRangeException()
+ {
+ var in_dim = new int[4] { 10, 1, 1, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ try
+ {
+ tensorsInfo.SetTensorType(100, TensorType.Float32);
+ }
+ catch (IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Get the type of TensorInfo and check the result")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.GetTensorType M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void GetTensorType_RETURN_VALUE()
+ {
+ var in_dim = new int[4] { 10, 1, 1, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ foreach (TensorType type in Enum.GetValues(typeof(TensorType)))
+ {
+ tensorsInfo.AddTensorInfo(type, in_dim);
+ }
+
+ int i = 0;
+ foreach (TensorType type in Enum.GetValues(typeof(TensorType)))
+ {
+ /* TEST CODE */
+ Assert.IsTrue(tensorsInfo.GetTensorType(i++) == type, "The TensorType is different from the origin.");
+ }
+
+ /*
+ tensorsInfo.AddTensorInfo(TensorType.Int32, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.UInt32, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.Int16, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.UInt16, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.Int8, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.Float64, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.Float32, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.Int64, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.UInt64, in_dim);
+
+ Assert.IsTrue(tensorsInfo.GetTensorType(0) == TensorType.Int32, "The TensorType is not TensorType.UInt8.");
+ */
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check IndexOutOfRangeException when calling GetTensorType() of TensorsInfo class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.GetTensorType M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void GetTensorType_CHECK_IndexOutOfRangeException()
+ {
+ var in_dim = new int[4] { 10, 1, 1, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ try
+ {
+ TensorType type = tensorsInfo.GetTensorType(100);
+ }
+ catch (IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Set the dimension of TensorInfo and check the result")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.SetDimension M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SetDimension_RETURN_VALUE()
+ {
+ var in_dim = new int[4] { 10, 1, 1, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var in_new_dim = new int[4] { 3, 224, 224, 1 };
+ Assert.IsInstanceOf<int[]>(in_new_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_new_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
+ tensorsInfo.SetDimension(0, in_new_dim);
+ var in_res = tensorsInfo.GetDimension(0);
+ Assert.IsInstanceOf<int[]>(in_res, "Should return int[] instance");
+ Assert.IsNotNull(in_res, "Failed to create in_dim instance");
+
+ for (int i = 0; i < 4; ++i)
+ {
+ Assert.IsTrue(in_new_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check IndexOutOfRangeException when calling SetDimension() of TensorsInfo class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.SetDimension M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SetDimension_CHECK_IndexOutOfRangeException()
+ {
+ var in_dim = new int[4] { 10, 1, 1, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var in_new_dim = new int[4] { 3, 224, 224, 1 };
+ Assert.IsInstanceOf<int[]>(in_new_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_new_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ try
+ {
+ tensorsInfo.SetDimension(100, in_new_dim);
+ }
+ catch (IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check ArgumentException when calling SetDimension() of TensorsInfo class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.SetDimension M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void SetDimension_CHECK_ArgumentException()
+ {
+ var in_dim = new int[4] { 10, 1, 1, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ try
+ {
+ tensorsInfo.SetDimension(0, null);
+ }
+ catch (ArgumentException)
+ {
+ Assert.Pass("ArgumentException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Get the dimension of TensorInfo and check the result")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.GetDimension M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void GetDimension_RETURN_VALUE()
+ {
+ var in_dim = new int[4] { 10, 1, 1, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
+ int[] in_res = tensorsInfo.GetDimension(0);
+ for (int i = 0; i < 4; ++i)
+ {
+ Assert.IsTrue(in_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check IndexOutOfRangeException when calling GetDimension() of TensorsInfo class")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.GetDimension M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void GetDimension_CHECK_IndexOutOfRangeException()
+ {
+ var in_dim = new int[4] { 10, 1, 1, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ try
+ {
+ var in_res = tensorsInfo.GetDimension(100);
+ }
+ catch (IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create the TensorsData instance")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.GetTensorsData M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void GetTensorsData_CHECK_NO_EXCEPTION()
+ {
+ var in_dim = new int[4] { 10, 1, 1, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var buffer_in = new byte[] { 17, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+ Assert.IsInstanceOf<byte[]>(buffer_in, "Should return byte[] instance");
+ Assert.IsNotNull(buffer_in, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
+ var tensorsData = tensorsInfo.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(tensorsData, "Should return TensorsData instance");
+ Assert.IsNotNull(tensorsData, "Failed to create TensorsData instance");
+
+ tensorsData.SetTensorData(0, buffer_in);
+
+ var buffer_out = tensorsData.GetTensorData(0);
+ Assert.IsInstanceOf<byte[]>(buffer_out, "buffer_out is not the type of byte[].");
+ Assert.IsNotNull(buffer_out, "Fail to create buffer_out.");
+
+ Assert.IsTrue(buffer_in.Length == buffer_out.Length, "The length of buffer_out payload is different from buffer_in.");
+ for (int i = 0; i < buffer_out.Length; ++i)
+ {
+ Assert.IsTrue(buffer_in[i] == buffer_out[i], "The value of buffer_in is different from that of buffer_out");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the Count property.")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.TensorsInfo.Count A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
+ public void Count_Get()
+ {
+ var in_dim = new int[4] { 10, 1, 1, 1 };
+ Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
+ Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
+
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ Assert.IsTrue(1 == tensorsInfo.Count, "The count of TensorsInfo should be 1.");
+ }
+ }
+}