Move testsuite/caps2 code to testsuite/caps
authorDavid Schleef <ds@schleef.org>
Mon, 22 Dec 2003 02:11:52 +0000 (02:11 +0000)
committerDavid Schleef <ds@schleef.org>
Mon, 22 Dec 2003 02:11:52 +0000 (02:11 +0000)
Original commit message from CVS:
Move testsuite/caps2 code to testsuite/caps

tests/old/testsuite/caps/Makefile.am
tests/old/testsuite/caps/caps.c [new file with mode: 0644]
tests/old/testsuite/caps/value_compare.c [new file with mode: 0644]
tests/old/testsuite/caps/value_intersect.c [new file with mode: 0644]
testsuite/caps/Makefile.am
testsuite/caps/caps.c [new file with mode: 0644]
testsuite/caps/value_compare.c [new file with mode: 0644]
testsuite/caps/value_intersect.c [new file with mode: 0644]

index 02f82a3e4ee085bb67cced4fe4c3627a3a43e16c..aad5b07d9ca4911bf8d3ae01ccc677e1003d77ea 100644 (file)
@@ -8,7 +8,10 @@ tests_pass = \
        union \
        string-conversions \
        fixed \
-       intersect2
+       intersect2 \
+       caps \
+       value_compare \
+       value_intersect
 
 tests_fail =
 
@@ -28,3 +31,5 @@ fixed_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS)
 intersect2_LDADD = $(GST_LIBS) 
 intersect2_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS)
 
+
+
diff --git a/tests/old/testsuite/caps/caps.c b/tests/old/testsuite/caps/caps.c
new file mode 100644 (file)
index 0000000..333e95d
--- /dev/null
@@ -0,0 +1,139 @@
+
+#include <gst/gst.h>
+
+
+void test1(void)
+{
+  GstCaps2 *caps;
+  GstCaps2 *caps2;
+
+  g_print("type is %d\n", (int)gst_caps2_get_type());
+
+  caps = gst_caps2_new_empty();
+  g_assert(caps != NULL);
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_any();
+  g_assert(caps != NULL);
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw",
+      "_int", G_TYPE_INT, 100, NULL);
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==FALSE);
+  g_assert(gst_caps2_is_fixed(caps)==TRUE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw",
+      "_double", G_TYPE_DOUBLE, 100.0, NULL);
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==FALSE);
+  g_assert(gst_caps2_is_fixed(caps)==TRUE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw",
+      "_fourcc", GST_TYPE_FOURCC, GST_MAKE_FOURCC('a','b','c','d'), NULL);
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==FALSE);
+  g_assert(gst_caps2_is_fixed(caps)==TRUE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw",
+      "_boolean", G_TYPE_BOOLEAN, TRUE, NULL);
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==FALSE);
+  g_assert(gst_caps2_is_fixed(caps)==TRUE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_full(
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 100, NULL),
+      gst_structure_new("audio/raw2", "_int", G_TYPE_INT, 100, NULL),
+      NULL);
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==TRUE);
+  g_assert(gst_caps2_is_fixed(caps)==FALSE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw", "_int", G_TYPE_INT, 100, NULL);
+  g_assert(caps != NULL);
+  caps2 = gst_caps2_copy(caps);
+  g_assert(caps2 != NULL);
+  g_assert(gst_caps2_is_empty(caps2)==FALSE);
+  g_assert(gst_caps2_is_any(caps2)==FALSE);
+  g_assert(gst_caps2_is_chained(caps2)==FALSE);
+  g_assert(gst_caps2_is_fixed(caps2)==TRUE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  g_print("%s\n", gst_caps2_to_string(caps2));
+  gst_caps2_free(caps);
+  gst_caps2_free(caps2);
+
+  caps = gst_caps2_new_simple("audio/raw", "_int", G_TYPE_INT, 100, NULL);
+  gst_caps2_append (caps, 
+      gst_caps2_new_simple("audio/raw", "_int", G_TYPE_INT, 200, NULL));
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==TRUE);
+  g_assert(gst_caps2_is_fixed(caps)==FALSE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw", "_int", G_TYPE_INT, 100, NULL);
+  g_assert(caps != NULL);
+  gst_caps2_append_cap (caps, 
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 200, NULL));
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==TRUE);
+  g_assert(gst_caps2_is_fixed(caps)==FALSE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+}
+
+void test2(void)
+{
+  GstCaps2 *caps1;
+  GstCaps2 *caps2;
+  GstCaps2 *caps;
+
+  caps1 = gst_caps2_new_full(
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 100, NULL),
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 200, NULL),
+      NULL);
+  caps2 = gst_caps2_new_full(
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 100, NULL),
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 300, NULL),
+      NULL);
+  caps = gst_caps2_intersect(caps1, caps2);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+  gst_caps2_free(caps1);
+  gst_caps2_free(caps2);
+
+}
+
+int main(int argc, char *argv[])
+{
+  gst_init(&argc, &argv);
+
+  test1();
+  test2();
+
+  return 0;
+}
+
diff --git a/tests/old/testsuite/caps/value_compare.c b/tests/old/testsuite/caps/value_compare.c
new file mode 100644 (file)
index 0000000..852de51
--- /dev/null
@@ -0,0 +1,64 @@
+
+#include <gst/gst.h>
+#include <glib.h>
+
+void test1(void)
+{
+  GValue value1 = { 0 };
+  GValue value2 = { 0 };
+  //GValue value3 = { 0 };
+  //gboolean ret;
+
+  g_value_init(&value1, G_TYPE_INT);
+  g_value_set_int(&value1, 10);
+  g_value_init(&value2, G_TYPE_INT);
+  g_value_set_int(&value2, 20);
+  g_assert(gst_value_compare(&value1, &value2) == GST_VALUE_LESS_THAN);
+  g_assert(gst_value_compare(&value2, &value1) == GST_VALUE_GREATER_THAN);
+  g_assert(gst_value_compare(&value1, &value1) == GST_VALUE_EQUAL);
+  g_value_unset(&value1);
+  g_value_unset(&value2);
+
+  g_value_init(&value1, G_TYPE_DOUBLE);
+  g_value_set_double(&value1, 10);
+  g_value_init(&value2, G_TYPE_DOUBLE);
+  g_value_set_double(&value2, 20);
+  g_assert(gst_value_compare(&value1, &value2) == GST_VALUE_LESS_THAN);
+  g_assert(gst_value_compare(&value2, &value1) == GST_VALUE_GREATER_THAN);
+  g_assert(gst_value_compare(&value1, &value1) == GST_VALUE_EQUAL);
+  g_value_unset(&value1);
+  g_value_unset(&value2);
+
+  g_value_init(&value1, G_TYPE_STRING);
+  g_value_set_string(&value1, "a");
+  g_value_init(&value2, G_TYPE_STRING);
+  g_value_set_string(&value2, "b");
+  g_assert(gst_value_compare(&value1, &value2) == GST_VALUE_LESS_THAN);
+  g_assert(gst_value_compare(&value2, &value1) == GST_VALUE_GREATER_THAN);
+  g_assert(gst_value_compare(&value1, &value1) == GST_VALUE_EQUAL);
+  g_value_unset(&value1);
+  g_value_unset(&value2);
+
+  g_value_init(&value1, GST_TYPE_FOURCC);
+  gst_value_set_fourcc(&value1, GST_MAKE_FOURCC('a','b','c','d'));
+  g_value_init(&value2, GST_TYPE_FOURCC);
+  gst_value_set_fourcc(&value2, GST_MAKE_FOURCC('1','2','3','4'));
+  g_assert(gst_value_compare(&value1, &value2) == GST_VALUE_UNORDERED);
+  g_assert(gst_value_compare(&value1, &value1) == GST_VALUE_EQUAL);
+  g_value_unset(&value1);
+  g_value_unset(&value2);
+
+}
+
+int main(int argc, char *argv[])
+{
+
+  gst_init(&argc, &argv);
+
+  test1();
+
+  return 0;
+
+}
+
+
diff --git a/tests/old/testsuite/caps/value_intersect.c b/tests/old/testsuite/caps/value_intersect.c
new file mode 100644 (file)
index 0000000..352fbcc
--- /dev/null
@@ -0,0 +1,31 @@
+
+#include <gst/gst.h>
+
+void test1(void)
+{
+  GValue dest = { 0 };
+  GValue src1 = { 0 };
+  GValue src2 = { 0 };
+  gboolean ret;
+
+  g_value_init(&src1, G_TYPE_INT);
+  g_value_set_int(&src1, 10);
+  g_value_init(&src2, G_TYPE_INT);
+  g_value_set_int(&src1, 20);
+  ret = gst_value_intersect(&dest, &src1, &src2);
+  g_print("ret = %d\n",ret);
+
+}
+
+int main(int argc, char *argv[])
+{
+
+  gst_init(&argc, &argv);
+
+  test1();
+
+  return 0;
+
+}
+
+
index 02f82a3e4ee085bb67cced4fe4c3627a3a43e16c..aad5b07d9ca4911bf8d3ae01ccc677e1003d77ea 100644 (file)
@@ -8,7 +8,10 @@ tests_pass = \
        union \
        string-conversions \
        fixed \
-       intersect2
+       intersect2 \
+       caps \
+       value_compare \
+       value_intersect
 
 tests_fail =
 
@@ -28,3 +31,5 @@ fixed_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS)
 intersect2_LDADD = $(GST_LIBS) 
 intersect2_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS)
 
+
+
diff --git a/testsuite/caps/caps.c b/testsuite/caps/caps.c
new file mode 100644 (file)
index 0000000..333e95d
--- /dev/null
@@ -0,0 +1,139 @@
+
+#include <gst/gst.h>
+
+
+void test1(void)
+{
+  GstCaps2 *caps;
+  GstCaps2 *caps2;
+
+  g_print("type is %d\n", (int)gst_caps2_get_type());
+
+  caps = gst_caps2_new_empty();
+  g_assert(caps != NULL);
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_any();
+  g_assert(caps != NULL);
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw",
+      "_int", G_TYPE_INT, 100, NULL);
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==FALSE);
+  g_assert(gst_caps2_is_fixed(caps)==TRUE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw",
+      "_double", G_TYPE_DOUBLE, 100.0, NULL);
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==FALSE);
+  g_assert(gst_caps2_is_fixed(caps)==TRUE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw",
+      "_fourcc", GST_TYPE_FOURCC, GST_MAKE_FOURCC('a','b','c','d'), NULL);
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==FALSE);
+  g_assert(gst_caps2_is_fixed(caps)==TRUE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw",
+      "_boolean", G_TYPE_BOOLEAN, TRUE, NULL);
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==FALSE);
+  g_assert(gst_caps2_is_fixed(caps)==TRUE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_full(
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 100, NULL),
+      gst_structure_new("audio/raw2", "_int", G_TYPE_INT, 100, NULL),
+      NULL);
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==TRUE);
+  g_assert(gst_caps2_is_fixed(caps)==FALSE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw", "_int", G_TYPE_INT, 100, NULL);
+  g_assert(caps != NULL);
+  caps2 = gst_caps2_copy(caps);
+  g_assert(caps2 != NULL);
+  g_assert(gst_caps2_is_empty(caps2)==FALSE);
+  g_assert(gst_caps2_is_any(caps2)==FALSE);
+  g_assert(gst_caps2_is_chained(caps2)==FALSE);
+  g_assert(gst_caps2_is_fixed(caps2)==TRUE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  g_print("%s\n", gst_caps2_to_string(caps2));
+  gst_caps2_free(caps);
+  gst_caps2_free(caps2);
+
+  caps = gst_caps2_new_simple("audio/raw", "_int", G_TYPE_INT, 100, NULL);
+  gst_caps2_append (caps, 
+      gst_caps2_new_simple("audio/raw", "_int", G_TYPE_INT, 200, NULL));
+  g_assert(caps != NULL);
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==TRUE);
+  g_assert(gst_caps2_is_fixed(caps)==FALSE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+
+  caps = gst_caps2_new_simple("audio/raw", "_int", G_TYPE_INT, 100, NULL);
+  g_assert(caps != NULL);
+  gst_caps2_append_cap (caps, 
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 200, NULL));
+  g_assert(gst_caps2_is_empty(caps)==FALSE);
+  g_assert(gst_caps2_is_any(caps)==FALSE);
+  g_assert(gst_caps2_is_chained(caps)==TRUE);
+  g_assert(gst_caps2_is_fixed(caps)==FALSE);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+}
+
+void test2(void)
+{
+  GstCaps2 *caps1;
+  GstCaps2 *caps2;
+  GstCaps2 *caps;
+
+  caps1 = gst_caps2_new_full(
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 100, NULL),
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 200, NULL),
+      NULL);
+  caps2 = gst_caps2_new_full(
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 100, NULL),
+      gst_structure_new("audio/raw", "_int", G_TYPE_INT, 300, NULL),
+      NULL);
+  caps = gst_caps2_intersect(caps1, caps2);
+  g_print("%s\n", gst_caps2_to_string(caps));
+  gst_caps2_free(caps);
+  gst_caps2_free(caps1);
+  gst_caps2_free(caps2);
+
+}
+
+int main(int argc, char *argv[])
+{
+  gst_init(&argc, &argv);
+
+  test1();
+  test2();
+
+  return 0;
+}
+
diff --git a/testsuite/caps/value_compare.c b/testsuite/caps/value_compare.c
new file mode 100644 (file)
index 0000000..852de51
--- /dev/null
@@ -0,0 +1,64 @@
+
+#include <gst/gst.h>
+#include <glib.h>
+
+void test1(void)
+{
+  GValue value1 = { 0 };
+  GValue value2 = { 0 };
+  //GValue value3 = { 0 };
+  //gboolean ret;
+
+  g_value_init(&value1, G_TYPE_INT);
+  g_value_set_int(&value1, 10);
+  g_value_init(&value2, G_TYPE_INT);
+  g_value_set_int(&value2, 20);
+  g_assert(gst_value_compare(&value1, &value2) == GST_VALUE_LESS_THAN);
+  g_assert(gst_value_compare(&value2, &value1) == GST_VALUE_GREATER_THAN);
+  g_assert(gst_value_compare(&value1, &value1) == GST_VALUE_EQUAL);
+  g_value_unset(&value1);
+  g_value_unset(&value2);
+
+  g_value_init(&value1, G_TYPE_DOUBLE);
+  g_value_set_double(&value1, 10);
+  g_value_init(&value2, G_TYPE_DOUBLE);
+  g_value_set_double(&value2, 20);
+  g_assert(gst_value_compare(&value1, &value2) == GST_VALUE_LESS_THAN);
+  g_assert(gst_value_compare(&value2, &value1) == GST_VALUE_GREATER_THAN);
+  g_assert(gst_value_compare(&value1, &value1) == GST_VALUE_EQUAL);
+  g_value_unset(&value1);
+  g_value_unset(&value2);
+
+  g_value_init(&value1, G_TYPE_STRING);
+  g_value_set_string(&value1, "a");
+  g_value_init(&value2, G_TYPE_STRING);
+  g_value_set_string(&value2, "b");
+  g_assert(gst_value_compare(&value1, &value2) == GST_VALUE_LESS_THAN);
+  g_assert(gst_value_compare(&value2, &value1) == GST_VALUE_GREATER_THAN);
+  g_assert(gst_value_compare(&value1, &value1) == GST_VALUE_EQUAL);
+  g_value_unset(&value1);
+  g_value_unset(&value2);
+
+  g_value_init(&value1, GST_TYPE_FOURCC);
+  gst_value_set_fourcc(&value1, GST_MAKE_FOURCC('a','b','c','d'));
+  g_value_init(&value2, GST_TYPE_FOURCC);
+  gst_value_set_fourcc(&value2, GST_MAKE_FOURCC('1','2','3','4'));
+  g_assert(gst_value_compare(&value1, &value2) == GST_VALUE_UNORDERED);
+  g_assert(gst_value_compare(&value1, &value1) == GST_VALUE_EQUAL);
+  g_value_unset(&value1);
+  g_value_unset(&value2);
+
+}
+
+int main(int argc, char *argv[])
+{
+
+  gst_init(&argc, &argv);
+
+  test1();
+
+  return 0;
+
+}
+
+
diff --git a/testsuite/caps/value_intersect.c b/testsuite/caps/value_intersect.c
new file mode 100644 (file)
index 0000000..352fbcc
--- /dev/null
@@ -0,0 +1,31 @@
+
+#include <gst/gst.h>
+
+void test1(void)
+{
+  GValue dest = { 0 };
+  GValue src1 = { 0 };
+  GValue src2 = { 0 };
+  gboolean ret;
+
+  g_value_init(&src1, G_TYPE_INT);
+  g_value_set_int(&src1, 10);
+  g_value_init(&src2, G_TYPE_INT);
+  g_value_set_int(&src1, 20);
+  ret = gst_value_intersect(&dest, &src1, &src2);
+  g_print("ret = %d\n",ret);
+
+}
+
+int main(int argc, char *argv[])
+{
+
+  gst_init(&argc, &argv);
+
+  test1();
+
+  return 0;
+
+}
+
+