mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
initial thoughts on framework
Original commit message from CVS: initial thoughts on framework
This commit is contained in:
parent
8c54486378
commit
a1d52b2aa6
1 changed files with 100 additions and 0 deletions
100
docs/random/omega/testing/framework
Normal file
100
docs/random/omega/testing/framework
Normal file
|
@ -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
|
||||
|
||||
<setup name="new object">
|
||||
<variable>
|
||||
GstObject *object;
|
||||
</variabls>
|
||||
<action>
|
||||
object = gst_object_new();
|
||||
</action>
|
||||
<validation>
|
||||
<assert>
|
||||
object != NULL
|
||||
</assert>
|
||||
<assert>
|
||||
GST_IS_OBJECT(object)
|
||||
<assert>
|
||||
object->parent == NULL
|
||||
</assert>
|
||||
</validation>
|
||||
<cleanup>
|
||||
<validation>
|
||||
<assert>
|
||||
object != NULL
|
||||
</assert>
|
||||
<assert>
|
||||
GST_IS_OBJECT(object)
|
||||
</assert>
|
||||
</validation>
|
||||
<action>
|
||||
gst_object_destroy(object);
|
||||
</action>
|
||||
</cleanup>
|
||||
</setup>
|
||||
|
||||
. . .
|
Loading…
Reference in a new issue