From: Erik Walthinsen Date: Sun, 21 Jan 2001 01:03:13 +0000 (+0000) Subject: initial thoughts on framework X-Git-Tag: BRANCH-AUTOPLUG2-ROOT~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1d52b2aa6153e4aee4a415a327ec513f144ca1c;p=platform%2Fupstream%2Fgstreamer.git initial thoughts on framework Original commit message from CVS: initial thoughts on framework --- diff --git a/docs/random/omega/testing/framework b/docs/random/omega/testing/framework new file mode 100644 index 0000000..beb2dcb --- /dev/null +++ b/docs/random/omega/testing/framework @@ -0,0 +1,100 @@ +Construction +Validation +Testing + +Construction will generate some state +Validation will ensure that everything is kosher +Tests use combinations of the above to check things + +##### Example: +parent = gst_object_get_parent(object); + +setup: + create: new object + action: object = gst_object_new(); + validation: object != NULL, object->parent == NULL, etc + [cleanup: gst_object_destroy(object);] + create: new parent + action: parent = gst_object_new(); + validation: parent != NULL, parent->parent == NULL, etc + [cleanup: gst_object_destroy(parent);] + create: set object's parent + precondition: object->parent == NULL + action: gst_object_set_parent(object,parent); + validation: object->parent = parent +preconditions: + nothing +action: + curparent = gst_element_get_parent(object); +validaton: + curparent == object->parent + curparent == parent +cleanup: + nothing + + +##### Resulting code: + +///// setup +// new object +object = gst_object_new(); +ASSERT(object != NULL); +ASSERT(object->parent == NULL); +// new object +parent = gst_object_new(); +ASSERT(parent != NULL); +ASSERT(parent->parent == NULL); +// set object parent +ASSERT(object->parent == NULL); +gst_object_set_parent(object,parent); +ASSERT(object->parent != NULL); + +///// preconditions + +///// action +curparent = gst_element_get_parent(object); + +///// validation +ASSERT(object->parent == parent); + +///// cleanup +gst_object_destroy(parent); +gst_object_destroy(object); + + + +##### XML descriptions + + + + GstObject *object; + + + object = gst_object_new(); + + + + object != NULL + + + GST_IS_OBJECT(object) + + object->parent == NULL + + + + + + object != NULL + + + GST_IS_OBJECT(object) + + + + gst_object_destroy(object); + + + + +. . .