}
}
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Get string type value from normal node and check exception")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_string_NO_Exception()
+ {
+ try
+ {
+ string desc = "videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! " +
+ "tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink";
+
+ var pipeline = new Pipeline(desc);
+ Assert.IsNotNull(pipeline, "Failed to create pipeline instance");
+ Assert.IsInstanceOf<Pipeline>(pipeline, "Should return pipeline instance");
+
+ var demux_node = pipeline.GetNormal("demux");
+ Assert.IsNotNull(demux_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(demux_node, "Should return normal node instance");
+
+ /* Test Code */
+ string retTensorpick;
+ demux_node.GetValue("tensorpick", out retTensorpick);
+ /* default value of tensorpick is "" */
+ Assert.IsTrue(retTensorpick == "", "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 sring type value of normal node with null name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_string_ArgumentException_null_name()
+ {
+ try
+ {
+ string desc = "videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! " +
+ "tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink";
+
+ var pipeline = new Pipeline(desc);
+ Assert.IsNotNull(pipeline, "Failed to create pipeline instance");
+ Assert.IsInstanceOf<Pipeline>(pipeline, "Should return pipeline instance");
+
+ var demux_node = pipeline.GetNormal("demux");
+ Assert.IsNotNull(demux_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(demux_node, "Should return normal node instance");
+
+ /* Test Code */
+ string retTensorpick;
+ demux_node.GetValue(null, out retTensorpick);
+
+ 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 string type value of normal node with invalid name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_string_ArgumentException_invalid_name()
+ {
+ try
+ {
+ string desc = "videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! " +
+ "tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink";
+
+ var pipeline = new Pipeline(desc);
+ Assert.IsNotNull(pipeline, "Failed to create pipeline instance");
+ Assert.IsInstanceOf<Pipeline>(pipeline, "Should return pipeline instance");
+
+ var demux_node = pipeline.GetNormal("demux");
+ Assert.IsNotNull(demux_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(demux_node, "Should return normal node instance");
+
+ /* Test Code */
+ string retTensorpick;
+ demux_node.GetValue("invalid_prop", out retTensorpick);
+
+ 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 string type value of normal node with empty name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_string_ArgumentException_empty_name()
+ {
+ try
+ {
+ string desc = "videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! " +
+ "tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink";
+
+ var pipeline = new Pipeline(desc);
+ Assert.IsNotNull(pipeline, "Failed to create pipeline instance");
+ Assert.IsInstanceOf<Pipeline>(pipeline, "Should return pipeline instance");
+
+ var demux_node = pipeline.GetNormal("demux");
+ Assert.IsNotNull(demux_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(demux_node, "Should return normal node instance");
+
+ /* Test Code */
+ string retTensorpick;
+ demux_node.GetValue("", out retTensorpick);
+
+ 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 unsigned long type value of tensor sink node with invalid retrun value")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_string_ArgumentException_invalid_type()
+ {
+ try
+ {
+ var pipeline = new Pipeline(_generalPipeline);
+ Assert.IsNotNull(pipeline, "Failed to create pipeline instance");
+ Assert.IsInstanceOf<Pipeline>(pipeline, "Should return pipeline instance");
+
+ var sink_handle = pipeline.GetSink("sinkx");
+ Assert.IsNotNull(sink_handle, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle, "Should return normal node instance");
+
+ /* Test Code */
+ string retMaxBitrate;
+ /* The type of max-bitrate is a ulong, but it failed because it got property value by a string. */
+ sink_handle.GetValue("max-bitrate", out retMaxBitrate);
+
+ 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 string type value for normal node and check exception")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_string_NO_Exception()
+ {
+ try
+ {
+ string desc = "videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! " +
+ "tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink";
+
+ var pipeline = new Pipeline(desc);
+ Assert.IsNotNull(pipeline, "Failed to create pipeline instance");
+ Assert.IsInstanceOf<Pipeline>(pipeline, "Should return pipeline instance");
+
+ var demux_node = pipeline.GetNormal("demux");
+ Assert.IsNotNull(demux_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(demux_node, "Should return normal node instance");
+
+ /* Test Code */
+ string retTensorpick;
+ demux_node.SetValue("tensorpick", "1,2");
+ demux_node.GetValue("tensorpick", out retTensorpick);
+ Assert.IsTrue(retTensorpick == "1,2", "Failed to set 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 string type value for normal node with null name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_string_ArgumentException_null_name()
+ {
+ try
+ {
+ string desc = "videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! " +
+ "tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink";
+
+ var pipeline = new Pipeline(desc);
+ Assert.IsNotNull(pipeline, "Failed to create pipeline instance");
+ Assert.IsInstanceOf<Pipeline>(pipeline, "Should return pipeline instance");
+
+ var demux_node = pipeline.GetNormal("demux");
+ Assert.IsNotNull(demux_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(demux_node, "Should return normal node instance");
+
+ /* Test Code */
+ demux_node.SetValue(null, "1,2");
+
+ 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 string 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, string")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_string_ArgumentException_invalid_name()
+ {
+ try
+ {
+ string desc = "videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! " +
+ "tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink";
+
+ var pipeline = new Pipeline(desc);
+ Assert.IsNotNull(pipeline, "Failed to create pipeline instance");
+ Assert.IsInstanceOf<Pipeline>(pipeline, "Should return pipeline instance");
+
+ var demux_node = pipeline.GetNormal("demux");
+ Assert.IsNotNull(demux_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(demux_node, "Should return normal node instance");
+
+ /* Test Code */
+ demux_node.SetValue("invalid_name", "1,2");
+
+ 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 string type value for normal node with empty name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_string_ArgumentException_empty_name()
+ {
+ try
+ {
+ string desc = "videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! " +
+ "tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink";
+
+ var pipeline = new Pipeline(desc);
+ Assert.IsNotNull(pipeline, "Failed to create pipeline instance");
+ Assert.IsInstanceOf<Pipeline>(pipeline, "Should return pipeline instance");
+
+ var demux_node = pipeline.GetNormal("demux");
+ Assert.IsNotNull(demux_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(demux_node, "Should return normal node instance");
+
+ /* Test Code */
+ demux_node.SetValue("", "1,2");
+
+ 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 boolean type value for valve node with invalid name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, string")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_string_ArgumentException_invalid_type()
+ {
+ try
+ {
+ var pipeline = new Pipeline(_valvePipeline);
+ Assert.IsNotNull(pipeline, "Failed to create pipeline instance");
+ Assert.IsInstanceOf<Pipeline>(pipeline, "Should return pipeline instance");
+
+ var valve_handle = pipeline.GetValve("valvex");
+ Assert.IsNotNull(valve_handle, "Failed to create valve node instance");
+ Assert.IsInstanceOf<Pipeline.ValveNode>(valve_handle, "Should return valve node instance");
+
+ /* Test Code */
+ /* The type of drop is a bool, but it failed because it is set as a string. */
+ valve_handle.SetValue("drop", "false");
+
+ 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);
+ }
+ }
+ }
}
}