}
}
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Get double 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, double")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_double_NO_Exception()
+ {
+ 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 vscale_node = pipeline.GetNormal("vscale");
+ Assert.IsNotNull(vscale_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(vscale_node, "Should return normal node instance");
+
+ /* Test Code */
+ double retSharpness;
+ vscale_node.GetValue("sharpness", out retSharpness);
+ /* default value of sharpness is 1 */
+ Assert.IsTrue(retSharpness == 1.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 double 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, double")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_double_ArgumentException_null_name()
+ {
+ 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 vscale_node = pipeline.GetNormal("vscale");
+ Assert.IsNotNull(vscale_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(vscale_node, "Should return normal node instance");
+
+ /* Test Code */
+ double retSharpness;
+ vscale_node.GetValue(null, out retSharpness);
+
+ 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 double 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, double")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_double_ArgumentException_invalid_name()
+ {
+ 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 vscale_node = pipeline.GetNormal("vscale");
+ Assert.IsNotNull(vscale_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(vscale_node, "Should return normal node instance");
+
+ /* Test Code */
+ double retSharpness;
+ vscale_node.GetValue("invalid_prop", out retSharpness);
+
+ 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 double 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, double")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_double_ArgumentException_empty_name()
+ {
+ 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 vscale_node = pipeline.GetNormal("vscale");
+ Assert.IsNotNull(vscale_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(vscale_node, "Should return normal node instance");
+
+ /* Test Code */
+ double retSharpness;
+ vscale_node.GetValue("", out retSharpness);
+
+ 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 boolean type value of valve node with invalid retrun value")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.GetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, double")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetValue_double_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 */
+ double retDrop;
+ /* The type of drop is a bool, but it failed because it got property value by a double. */
+ valve_handle.GetValue("drop", out retDrop);
+
+ 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 double 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, double")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_double_NO_Exception()
+ {
+ 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 vscale_node = pipeline.GetNormal("vscale");
+ Assert.IsNotNull(vscale_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(vscale_node, "Should return normal node instance");
+
+ /* Test Code */
+ double retSharpness;
+ vscale_node.SetValue("sharpness", 0.72);
+ vscale_node.GetValue("sharpness", out retSharpness);
+
+ Assert.IsTrue(retSharpness == 0.72, "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 double 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, double")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_double_ArgumentException_null_name()
+ {
+ 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 vscale_node = pipeline.GetNormal("vscale");
+ Assert.IsNotNull(vscale_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(vscale_node, "Should return normal node instance");
+
+ /* Test Code */
+ vscale_node.SetValue(null, 0.72);
+
+ 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 double 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, double")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_double_ArgumentException_invalid_name()
+ {
+ 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 vscale_node = pipeline.GetNormal("vscale");
+ Assert.IsNotNull(vscale_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(vscale_node, "Should return normal node instance");
+
+ /* Test Code */
+ vscale_node.SetValue("invalid_prop", 0.72);
+
+ 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 double 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, double")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_double_ArgumentException_empty_name()
+ {
+ 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 vscale_node = pipeline.GetNormal("vscale");
+ Assert.IsNotNull(vscale_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(vscale_node, "Should return normal node instance");
+
+ /* Test Code */
+ vscale_node.SetValue("", 0.72);
+
+ 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, double")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void SetValue_double_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 */
+ /* The type of max-bitrate is a ulong, but it failed because it was set as a double. */
+ sink_handle.SetValue("max-bitrate", 1.0);
+
+ 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);
+ }
+ }
+ }
}
}