aboutsummaryrefslogtreecommitdiff
path: root/src/proone-test_iobuf.c
diff options
context:
space:
mode:
authorDavid Timber <mieabby@gmail.com>2021-07-25 18:40:16 +1000
committerDavid Timber <mieabby@gmail.com>2021-07-25 18:40:16 +1000
commita72b876cf8f7c01ab2d3808a168ef16620498298 (patch)
tree43b259cf3a20636f52aebd2d777f89cf95d66673 /src/proone-test_iobuf.c
parentd875ed3b36f2a3fb5d6ceb3c37f6749603e4d0d3 (diff)
Impl htbt M2M binary update and bug fixes ...
* Change signature of tmpfile() cb * Add PRNE_DATA_KEY_VER_MAT * Add prne_try_alloc_iobuf() * Fix htbt: don't run cncp when both resolv and cnc_txtrec are not passed * Impl upbin cb on proone-bne * Fix proone-htbtclient: content of status frame was discarded * htbt is now responsible for setting FD_CLOEXEC on temp files * Changes in mttools for valgrind run * Add proone-test_iobuf * Fix event leak in resolv * src/test-resolv.sh: run proone-resolv on valgrind * Add prne_cmp_uuid_asc() and prne_cmp_uuid_desc() for version matrix *
Diffstat (limited to 'src/proone-test_iobuf.c')
-rw-r--r--src/proone-test_iobuf.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/proone-test_iobuf.c b/src/proone-test_iobuf.c
new file mode 100644
index 0000000..6091fce
--- /dev/null
+++ b/src/proone-test_iobuf.c
@@ -0,0 +1,23 @@
+#include "iobuf.h"
+
+#include <assert.h>
+
+
+int main (void) {
+ static const size_t FAIL_ARR0[] = { 0 };
+ static const size_t FAIL_ARR1[] = { SIZE_MAX, 0 };
+ static const size_t FAIL_ARR2[] = { SIZE_MAX, SIZE_MAX, SIZE_MAX, 0 };
+ static const size_t OK_ARR0[] = { 4096, 0 };
+ static const size_t OK_ARR1[] = { SIZE_MAX, 4096, 0 };
+ prne_iobuf_t ib;
+
+ prne_init_iobuf(&ib);
+ assert(!prne_try_alloc_iobuf(&ib, FAIL_ARR0));
+ assert(!prne_try_alloc_iobuf(&ib, FAIL_ARR1));
+ assert(!prne_try_alloc_iobuf(&ib, FAIL_ARR2));
+ assert(prne_try_alloc_iobuf(&ib, OK_ARR0));
+ assert(prne_try_alloc_iobuf(&ib, OK_ARR1));
+ prne_free_iobuf(&ib);
+
+ return 0;
+}