summaryrefslogtreecommitdiffstats
path: root/test/test_args.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_args.h')
-rw-r--r--test/test_args.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_args.h b/test/test_args.h
new file mode 100644
index 0000000..e212a94
--- /dev/null
+++ b/test/test_args.h
@@ -0,0 +1,18 @@
+// Copyright 2022 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
+
+#ifndef ZIX_TEST_ARGS_H
+#define ZIX_TEST_ARGS_H
+
+#include <stddef.h>
+#include <stdlib.h>
+
+static inline size_t
+zix_test_size_arg(const char* const string, const size_t min, const size_t max)
+{
+ const size_t size = strtoul(string, NULL, 10);
+
+ return size < min ? min : size > max ? max : size;
+}
+
+#endif // ZIX_TEST_ARGS_H