}
}
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Get unsigned long type value from tensor sink node and check exception")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, uint64")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_ulong_NO_Exception()
+ {
+ 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 node instance");
+
+ /* Test Code */
+ ulong retMaxBitrate;
+ sink_handle.GetValue("max-bitrate", out retMaxBitrate);
+ /* default value of max bitrate is 0 */
+ Assert.IsTrue(retMaxBitrate == 0, "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 unsigned long type value of tensor sink node with null name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, uint64")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_ulong_ArgumentException_null_name()
+ {
+ 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 */
+ ulong retMaxBitrate;
+ sink_handle.GetValue(null, 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("P2")]
+ [Description("Check ArgumentException when getting unsigned long type value of tensor sink node with invalid name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, uint64")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_ulong_ArgumentException_invalid_name()
+ {
+ 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 */
+ ulong retMaxBitrate;
+ sink_handle.GetValue("invalid_prop", 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("P2")]
+ [Description("Check ArgumentException when getting unsigned long type value of tensor sink node with empty name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, uint64")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_ulong_ArgumentException_empty_name()
+ {
+ 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 */
+ ulong retMaxBitrate;
+ sink_handle.GetValue("", 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("P2")]
+ [Description("Check ArgumentException when getting unsigned int type value of switch node with invalid retrun value")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, uint64")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_ulong_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>(pipeline, "Should return pipeline instance");
+
+ var switch_handle = pipeline.GetSwitch("is01");
+ Assert.IsNotNull(switch_handle, "Failed to create switch node instance");
+ Assert.IsInstanceOf<Pipeline.SwitchNode>(switch_handle, "Should return normal switch instance");
+
+ /* Test Code */
+ ulong retNumPad;
+ /* The type of n-pads is a uint, but it failed because it got property value by a ulong. */
+ switch_handle.GetValue("n-pads", out retNumPad);
+
+ 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 unsigned long type value for tensor sink node and check exception")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, uint64")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_ulong_NO_Exception()
+ {
+ 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 */
+ ulong retMaxBitrate;
+ sink_handle.SetValue("max-bitrate", 123456789123456789UL);
+ sink_handle.GetValue("max-bitrate", out retMaxBitrate);
+
+ Assert.IsTrue(retMaxBitrate == 123456789123456789UL, "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 unsigned long type value for tensor sink node with null name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, uint64")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_ulong_ArgumentException_null_name()
+ {
+ 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 */
+ sink_handle.SetValue(null, 123456789123456789UL);
+
+ 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 unsigned long type value for tensor sink node with invalid name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, uint64")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_ulong_ArgumentException_invalid_name()
+ {
+ 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 */
+ sink_handle.SetValue("invalid_prop", 123456789123456789UL);
+
+ 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 unsigned long type value for tensor sink node with empty name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.SetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, uint64")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_ulong_ArgumentException_empty_name()
+ {
+ 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 */
+ sink_handle.SetValue("", 123456789123456789UL);
+
+ 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 unsigned 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, uint64")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_ulong_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>(pipeline, "Should return pipeline instance");
+
+ var vsrc_node = pipeline.GetNormal("vsrc");
+ Assert.IsNotNull(vsrc_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(vsrc_node, "Should return normal node instance");
+
+ /* Test Code */
+ /* The type of foreground-color is a uint, but it failed because it was set as a ulong. */
+ vsrc_node.SetValue("foreground-color", 123456789UL);
+
+ 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);
+ }
+ }
+ }
}
}