From: gichan-jang Date: Tue, 1 Sep 2020 05:53:36 +0000 (+0900) Subject: [Tizen.MachineLearning.Inference][TCSACR-365] Add TCs for getter and setter - int64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5f080a555c8a9b3fb5fbe696de178ffccc59a1a;p=test%2Ftct%2Fcsharp%2Fapi.git [Tizen.MachineLearning.Inference][TCSACR-365] Add TCs for getter and setter - int64 Add TCs for GetValue and SetValue methods - int64 Change-Id: Id23a00b2ef11cd8a29d8972218d1b3243c66c24b Signed-off-by: gichan-jang --- diff --git a/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.NodeInfo.cs b/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.NodeInfo.cs index 4d5cc78ef..170381142 100644 --- a/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.NodeInfo.cs +++ b/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.NodeInfo.cs @@ -1559,5 +1559,448 @@ namespace Tizen.MachineLearning.Inference.Tests { } } } + + [Test] + [Category("P1")] + [Description("Get long type value from appsrc node and check exception")] + [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "string, int64")] + [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")] + public void GetValue_long_NO_Exception() + { + try + { + var pipeline = new Pipeline(_appsrcPipeline); + Assert.IsNotNull(pipeline, "Failed to create pipeline instance"); + Assert.IsInstanceOf(pipeline, "Should return pipeline instance"); + + var src_handle = pipeline.GetSource("srcx"); + Assert.IsNotNull(src_handle, "Failed to create source node instance"); + Assert.IsInstanceOf(src_handle, "Should return source node instance"); + + /* Test Code */ + long retMaxLatency; + src_handle.GetValue("max-latency", out retMaxLatency); + /* default value of max latency is -1 */ + Assert.IsTrue(retMaxLatency == -1, "Failed to get the value of normal node"); + + pipeline.Dispose(); + } + catch (Exception e) + { + if (e is NotSupportedException) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs"); + Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException"); + } + else + { + Assert.IsTrue(false, e.Message); + } + } + } + + [Test] + [Category("P2")] + [Description("Check ArgumentException when getting long type value of appsrc node with null name")] + [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("COVPARAM", "string, int64")] + [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")] + public void GetValue_long_ArgumentException_null_name() + { + try + { + var pipeline = new Pipeline(_appsrcPipeline); + Assert.IsNotNull(pipeline, "Failed to create pipeline instance"); + Assert.IsInstanceOf(pipeline, "Should return pipeline instance"); + + var src_handle = pipeline.GetSource("srcx"); + Assert.IsNotNull(src_handle, "Failed to create source node instance"); + Assert.IsInstanceOf(src_handle, "Should return source node instance"); + + /* Test Code */ + long retMaxLatency; + src_handle.GetValue(null, out retMaxLatency); + + Assert.True(false, "DO NOT COME HERE!"); + } + catch (Exception e) + { + if (e is NotSupportedException) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs"); + Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException"); + } + else if (e is ArgumentException) + { + Assert.Pass("ArgumentException: passed!"); + } + else + { + Assert.Fail(e.Message); + } + } + } + + [Test] + [Category("P2")] + [Description("Check ArgumentException when getting long type value of appsrc node with invalid name")] + [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("COVPARAM", "string, int64")] + [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")] + public void GetValue_long_ArgumentException_invalid_name() + { + try + { + var pipeline = new Pipeline(_appsrcPipeline); + Assert.IsNotNull(pipeline, "Failed to create pipeline instance"); + Assert.IsInstanceOf(pipeline, "Should return pipeline instance"); + + var src_handle = pipeline.GetSource("srcx"); + Assert.IsNotNull(src_handle, "Failed to create source node instance"); + Assert.IsInstanceOf(src_handle, "Should return source node instance"); + + /* Test Code */ + long retMaxLatency; + src_handle.GetValue("invalid_prop", out retMaxLatency); + + Assert.True(false, "DO NOT COME HERE!"); + } + catch (Exception e) + { + if (e is NotSupportedException) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs"); + Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException"); + } + else if (e is ArgumentException) + { + Assert.Pass("ArgumentException: passed!"); + } + else + { + Assert.Fail(e.Message); + } + } + } + + [Test] + [Category("P2")] + [Description("Check ArgumentException when getting long type value of appsrc node with empty name")] + [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("COVPARAM", "string, int64")] + [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")] + public void GetValue_long_ArgumentException_empty_name() + { + try + { + var pipeline = new Pipeline(_appsrcPipeline); + Assert.IsNotNull(pipeline, "Failed to create pipeline instance"); + Assert.IsInstanceOf(pipeline, "Should return pipeline instance"); + + var src_handle = pipeline.GetSource("srcx"); + Assert.IsNotNull(src_handle, "Failed to create source node instance"); + Assert.IsInstanceOf(src_handle, "Should return source node instance"); + + /* Test Code */ + long retMaxLatency; + src_handle.GetValue("", out retMaxLatency); + + Assert.True(false, "DO NOT COME HERE!"); + } + catch (Exception e) + { + if (e is NotSupportedException) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs"); + Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException"); + } + else if (e is ArgumentException) + { + Assert.Pass("ArgumentException: passed!"); + } + else + { + Assert.Fail(e.Message); + } + } + } + + [Test] + [Category("P2")] + [Description("Check ArgumentException when getting int type value of normal node with invalid retrun value")] + [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("COVPARAM", "string, int64")] + [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")] + public void GetValue_long_ArgumentException_invalid_type() + { + try + { + string desc = "videotestsrc name=vsrc is-live=true ! videoconvert ! videoscale name=vscale ! " + + "video/x-raw,format=RGBx,width=224,height=224,framerate=60/1 ! tensor_converter ! " + + "valve name=valvex ! input-selector name=is01 ! tensor_sink name=sinkx"; + + var pipeline = new Pipeline(desc); + Assert.IsNotNull(pipeline, "Failed to create pipeline instance"); + Assert.IsInstanceOf(pipeline, "Should return pipeline instance"); + + var vsrc_node = pipeline.GetNormal("vsrc"); + Assert.IsNotNull(vsrc_node, "Failed to create normal node instance"); + Assert.IsInstanceOf(vsrc_node, "Should return normal node instance"); + + /* Test Code */ + long retKx; + /* The type of kx is a int, but it failed because it got property value by a long. */ + vsrc_node.GetValue("kx", out retKx); + + Assert.True(false, "DO NOT COME HERE!"); + } + catch (Exception e) + { + if (e is NotSupportedException) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs"); + Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException"); + } + else if (e is ArgumentException) + { + Assert.Pass("ArgumentException: passed!"); + } + else + { + Assert.Fail(e.Message); + } + } + } + + [Test] + [Category("P1")] + [Description("Set long type value for appsrc node and check exception")] + [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "string, int64")] + [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")] + public void SetValue_long_NO_Exception() + { + try + { + var pipeline = new Pipeline(_appsrcPipeline); + Assert.IsNotNull(pipeline, "Failed to create pipeline instance"); + Assert.IsInstanceOf(pipeline, "Should return pipeline instance"); + + var src_handle = pipeline.GetSource("srcx"); + Assert.IsNotNull(src_handle, "Failed to create source node instance"); + Assert.IsInstanceOf(src_handle, "Should return source node instance"); + + /* Test Code */ + long retMaxLatency; + src_handle.SetValue("max-latency", 1234567891234L); + src_handle.GetValue("max-latency", out retMaxLatency); + + Assert.IsTrue(retMaxLatency == 1234567891234L, "Failed to get the value of normal node"); + + pipeline.Dispose(); + } + catch (Exception e) + { + if (e is NotSupportedException) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs"); + Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException"); + } + else + { + Assert.IsTrue(false, e.Message); + } + } + } + + [Test] + [Category("P2")] + [Description("Check ArgumentException when setting long type value for appsrc node with null name")] + [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("COVPARAM", "string, int64")] + [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")] + public void SetValue_long_ArgumentException_null_name() + { + try + { + var pipeline = new Pipeline(_appsrcPipeline); + Assert.IsNotNull(pipeline, "Failed to create pipeline instance"); + Assert.IsInstanceOf(pipeline, "Should return pipeline instance"); + + var src_handle = pipeline.GetSource("srcx"); + Assert.IsNotNull(src_handle, "Failed to create source node instance"); + Assert.IsInstanceOf(src_handle, "Should return source node instance"); + + /* Test Code */ + src_handle.SetValue(null, 1234567891234L); + + Assert.True(false, "DO NOT COME HERE!"); + } + catch (Exception e) + { + if (e is NotSupportedException) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs"); + Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException"); + } + else if (e is ArgumentException) + { + Assert.Pass("ArgumentException: passed!"); + } + else + { + Assert.Fail(e.Message); + } + } + } + + [Test] + [Category("P2")] + [Description("Check ArgumentException when setting long type value for appsrc node with invalid name")] + [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("COVPARAM", "string, int64")] + [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")] + public void SetValue_long_ArgumentException_invalid_name() + { + try + { + var pipeline = new Pipeline(_appsrcPipeline); + Assert.IsNotNull(pipeline, "Failed to create pipeline instance"); + Assert.IsInstanceOf(pipeline, "Should return pipeline instance"); + + var src_handle = pipeline.GetSource("srcx"); + Assert.IsNotNull(src_handle, "Failed to create source node instance"); + Assert.IsInstanceOf(src_handle, "Should return source node instance"); + + /* Test Code */ + src_handle.SetValue("invalid_prop", 1234567891234L); + + Assert.True(false, "DO NOT COME HERE!"); + } + catch (Exception e) + { + if (e is NotSupportedException) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs"); + Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException"); + } + else if (e is ArgumentException) + { + Assert.Pass("ArgumentException: passed!"); + } + else + { + Assert.Fail(e.Message); + } + } + } + + [Test] + [Category("P2")] + [Description("Check ArgumentException when setting long type value for appsrc node with empty name")] + [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("COVPARAM", "string, int64")] + [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")] + public void SetValue_long_ArgumentException_empty_name() + { + try + { + var pipeline = new Pipeline(_appsrcPipeline); + Assert.IsNotNull(pipeline, "Failed to create pipeline instance"); + Assert.IsInstanceOf(pipeline, "Should return pipeline instance"); + + var src_handle = pipeline.GetSource("srcx"); + Assert.IsNotNull(src_handle, "Failed to create source node instance"); + Assert.IsInstanceOf(src_handle, "Should return source node instance"); + + /* Test Code */ + src_handle.SetValue("", 1234567891234L); + + Assert.True(false, "DO NOT COME HERE!"); + } + catch (Exception e) + { + if (e is NotSupportedException) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs"); + Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException"); + } + else if (e is ArgumentException) + { + Assert.Pass("ArgumentException: passed!"); + } + else + { + Assert.Fail(e.Message); + } + } + } + + [Test] + [Category("P2")] + [Description("Check ArgumentException when setting int type value for normal node with invalid name")] + [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("COVPARAM", "string, int64")] + [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")] + public void SetValue_long_ArgumentException_invalid_type() + { + try + { + string desc = "videotestsrc name=vsrc is-live=true ! videoconvert ! videoscale name=vscale ! " + + "video/x-raw,format=RGBx,width=224,height=224,framerate=60/1 ! tensor_converter ! " + + "valve name=valvex ! input-selector name=is01 ! tensor_sink name=sinkx"; + + var pipeline = new Pipeline(desc); + Assert.IsNotNull(pipeline, "Failed to create pipeline instance"); + Assert.IsInstanceOf(pipeline, "Should return pipeline instance"); + + var vsrc_node = pipeline.GetNormal("vsrc"); + Assert.IsNotNull(vsrc_node, "Failed to create normal node instance"); + Assert.IsInstanceOf(vsrc_node, "Should return normal node instance"); + + /* Test Code */ + /* The type of kx is a int, but it failed because it was set as a long. */ + vsrc_node.SetValue("kx", 1234567891234L); + + Assert.True(false, "DO NOT COME HERE!"); + } + catch (Exception e) + { + if (e is NotSupportedException) + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs"); + Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException"); + } + else if (e is ArgumentException) + { + Assert.Pass("ArgumentException: passed!"); + } + else + { + Assert.Fail(e.Message); + } + } + } } }