[vlc-devel] commit: Rudimentary (incomplete) tests for block_Alloc/block_Realloc ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Aug 30 13:03:30 CEST 2009
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Aug 30 14:02:55 2009 +0300| [31d2760ad0c0a40116faf7063f380daddef79090] | committer: Rémi Denis-Courmont
Rudimentary (incomplete) tests for block_Alloc/block_Realloc
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=31d2760ad0c0a40116faf7063f380daddef79090
---
src/test/test_block.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/test/test_block.c b/src/test/test_block.c
index f594d06..970d10e 100644
--- a/src/test/test_block.c
+++ b/src/test/test_block.c
@@ -58,6 +58,27 @@ static void test_block_File (void)
remove ("testfile.txt");
}
+static void test_block (void)
+{
+ block_t *block = block_Alloc (sizeof (text));
+ assert (block != NULL);
+
+ strcpy (block->p_buffer, text);
+ block = block_Realloc (block, -10, sizeof (text));
+ assert (block != NULL);
+ assert (!strcmp (block->p_buffer, text + 10));
+ assert (block->i_buffer == sizeof (text));
+
+ block = block_Realloc (block, 10, sizeof (text));
+ assert (block != NULL);
+ assert (!strcmp (block->p_buffer + 10, text + 10));
+ assert (block->i_buffer == sizeof (text));
+ block_Release (block);
+
+ block = block_Alloc (SIZE_MAX);
+ assert (block == NULL);
+}
+
int main (void)
{
test_block_File ();
More information about the vlc-devel
mailing list