Displaying 2 results from an estimated 2 matches for "test_string_vector".
2020 Apr 15
0
[PATCH nbdkit 1/9] common: Add a generic implementation of vectors.
...YPE(string_vector, char *);
+
+static void
+test_int64_vector (void)
+{
+ int64_vector v = empty_vector;
+ size_t i;
+
+ for (i = 0; i < 10; ++i)
+ assert (int64_vector_append (&v, i) == 0);
+ for (i = 0; i < 10; ++i)
+ assert (v.ptr[i] == i);
+ free (v.ptr);
+}
+
+static void
+test_string_vector (void)
+{
+ string_vector v = empty_vector;
+ size_t i;
+
+ for (i = 0; i < 10; ++i) {
+ char *s;
+
+ assert (asprintf (&s, "number %zu", i) >= 0);
+ assert (string_vector_append (&v, s) == 0);
+ }
+ /* NULL-terminate the strings. */
+ assert (string_vector_ap...
2020 Apr 15
18
[PATCH nbdkit 0/9] Generic vector, and pass $nbdkit_stdio_safe to shell scripts.
This was a rather longer trip around the houses than I anticipated!
The basic purpose of the patch series is to set $nbdkit_stdio_safe to
"0" or "1" in sh and eval plugin scripts.
To do that, I ended up adding a nicer way to manipulate environ lists,
and to do that, I ended up adding a whole generic vector
implementation which is applicable in a lot of different places.