}
}
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Get node instance and check exception")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetNormal M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetNormal_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");
+
+ /* Test Code */
+ var is_node = pipeline.GetNormal("is01");
+ Assert.IsNotNull(is_node, "Failed to create normal node instance");
+ Assert.IsInstanceOf<Pipeline.Node>(is_node, "Should return normal node instance");
+
+ 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 normal node instance with null name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetNormal M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetNormal_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");
+
+ /* Test Code */
+ var is_node = pipeline.GetNormal(null);
+
+ 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 normal node instance with invalid name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetNormal M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetNormal_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");
+
+ /* Test Code */
+ var is_node = pipeline.GetNormal("invalid_name");
+
+ 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 normal node instance with empty name")]
+ [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetNormal M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+ public void GetNormal_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");
+
+ /* Test Code */
+ var is_node = pipeline.GetNormal("");
+
+ 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);
+ }
+ }
+ }
}
}