[0.11] gst-plugins-base: tests: fix more unit tests
Wim Taymans
wtay at kemper.freedesktop.org
Wed Mar 30 12:41:05 PDT 2011
Module: gst-plugins-base
Branch: 0.11
Commit: 6cb590ba1659c1d0b527790ba69794601bcad5f3
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=6cb590ba1659c1d0b527790ba69794601bcad5f3
Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date: Mon Mar 28 17:46:52 2011 +0200
tests: fix more unit tests
---
tests/check/elements/gdppay.c | 1 +
tests/check/elements/subparse.c | 38 ++++++++++++++++++++++----------------
2 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/tests/check/elements/gdppay.c b/tests/check/elements/gdppay.c
index c6e437b..05391f1 100644
--- a/tests/check/elements/gdppay.c
+++ b/tests/check/elements/gdppay.c
@@ -505,6 +505,7 @@ GST_START_TEST (test_crc)
/* verify the header checksum */
/* CRC's start at 58 in the header */
+ outbuffer = gst_buffer_make_writable (outbuffer);
data = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READWRITE);
crc_calculated = gst_dp_crc (data, 58);
crc_read = GST_READ_UINT16_BE (data + 58);
diff --git a/tests/check/elements/subparse.c b/tests/check/elements/subparse.c
index 0071533..8f1c4ed 100644
--- a/tests/check/elements/subparse.c
+++ b/tests/check/elements/subparse.c
@@ -223,14 +223,17 @@ test_srt_do_test (SubParseInputChunk * input, guint start_idx, guint num)
input[n].to_ts - input[n].from_ts);
out = gst_buffer_map (buf, &out_size, NULL, GST_MAP_READ);
- /* shouldn't have trailing newline characters */
- fail_if (out_size > 0 && out[out_size - 1] == '\n');
- /* shouldn't include NUL-terminator in data size */
- fail_if (out_size > 0 && out[out_size - 1] == '\0');
- /* but should still have a NUL-terminator behind the declared data */
- fail_unless_equals_int (out[out_size], '\0');
- /* make sure out string matches expected string */
- fail_unless_equals_string (out, input[n].out);
+ /* can be NULL */
+ if (out != NULL) {
+ /* shouldn't have trailing newline characters */
+ fail_if (out_size > 0 && out[out_size - 1] == '\n');
+ /* shouldn't include NUL-terminator in data size */
+ fail_if (out_size > 0 && out[out_size - 1] == '\0');
+ /* but should still have a NUL-terminator behind the declared data */
+ fail_unless_equals_int (out[out_size], '\0');
+ /* make sure out string matches expected string */
+ fail_unless_equals_string (out, input[n].out);
+ }
gst_buffer_unmap (buf, out, out_size);
/* check caps */
fail_unless (GST_BUFFER_CAPS (buf) != NULL);
@@ -310,14 +313,17 @@ do_test (SubParseInputChunk * input, guint num, const gchar * media_type)
}
out = gst_buffer_map (buf, &out_size, NULL, GST_MAP_READ);
- /* shouldn't have trailing newline characters */
- fail_if (out_size > 0 && out[out_size - 1] == '\n');
- /* shouldn't include NUL-terminator in data size */
- fail_if (out_size > 0 && out[out_size - 1] == '\0');
- /* but should still have a NUL-terminator behind the declared data */
- fail_unless_equals_int (out[out_size], '\0');
- /* make sure out string matches expected string */
- fail_unless_equals_string (out, input[n].out);
+ /* can be NULL */
+ if (out != NULL) {
+ /* shouldn't have trailing newline characters */
+ fail_if (out_size > 0 && out[out_size - 1] == '\n');
+ /* shouldn't include NUL-terminator in data size */
+ fail_if (out_size > 0 && out[out_size - 1] == '\0');
+ /* but should still have a NUL-terminator behind the declared data */
+ fail_unless_equals_int (out[out_size], '\0');
+ /* make sure out string matches expected string */
+ fail_unless_equals_string (out, input[n].out);
+ }
gst_buffer_unmap (buf, out, out_size);
/* check caps */
fail_unless (GST_BUFFER_CAPS (buf) != NULL);
More information about the gstreamer-commits
mailing list