From 3f65e7bc3386d1a761fc33683c005181184fd8e4 Mon Sep 17 00:00:00 2001 From: Timo Dritschler Date: Mon, 9 Mar 2015 16:42:34 +0100 Subject: Added kiro-test-partial tool for kiro_sync_partial testing Changed KiroSbSyncCallbacks to pass generic void* userdata instead of KiroSb* --- test/test-partial.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 test/test-partial.c (limited to 'test/test-partial.c') diff --git a/test/test-partial.c b/test/test-partial.c new file mode 100644 index 0000000..62b91ad --- /dev/null +++ b/test/test-partial.c @@ -0,0 +1,48 @@ +#include +#include +#include +#include +#include "kiro-trb.h" +#include "kiro-sb.h" + + +int count = 0; + + +KiroContinueFlag +callback (KiroSb *sb) { + (void)sb; + g_message ("Got new element"); + count++; + return KIRO_CALLBACK_CONTINUE; +} + +int +main ( int argc, char *argv[] ) +{ + if (argc < 3) { + printf ("Not enough aruments. Usage: kiro-test-bandwidth
\n"); + return -1; + } + + + KiroSb *ksb = kiro_sb_new (); + kiro_sb_clone (ksb, argv[1], argv[2]); + unsigned long int callback_id = kiro_sb_add_sync_callback (ksb, (KiroSbSyncCallbackFunc)callback, ksb); + + while (count < 3) {} + kiro_sb_remove_sync_callback (ksb, callback_id); + + while (count < 6) { + kiro_sb_get_data_blocking (ksb); + g_message ("Got new element"); + count++; + } + + kiro_sb_free (ksb); + + return 0; +} + + + -- cgit v1.2.3