diff options
| author | Randy Palamar <randy@rnpnr.xyz> | 2025-02-28 08:20:22 -0700 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2025-02-28 08:20:22 -0700 |
| commit | 862c33fe0814ab7756aabcf55aa77fa9c3bd6ef2 (patch) | |
| tree | a10e21884c0ecb148d614ca4b3f925999f63900e /test | |
| parent | 05897c884af2ae3ed66f80b624f657dc898da2ae (diff) | |
| download | vis-862c33fe0814ab7756aabcf55aa77fa9c3bd6ef2.tar.gz vis-862c33fe0814ab7756aabcf55aa77fa9c3bd6ef2.tar.xz | |
buffer: remove more unused exposed functions
NOTE: buffer-test.c now directly includes buffer.c so that it can
continue to test functions which are defined as static/internal to
buffer.c
Diffstat (limited to 'test')
| -rw-r--r-- | test/core/Makefile | 2 | ||||
| -rw-r--r-- | test/core/buffer-test.c | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/test/core/Makefile b/test/core/Makefile index 19991de..b0284b8 100644 --- a/test/core/Makefile +++ b/test/core/Makefile @@ -20,7 +20,7 @@ text-test: config.h text-test.c ../../text.c ../../text-common.c ../../text-io.c buffer-test: config.h buffer-test.c ../../buffer.c @echo Compiling $@ binary - @${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${SRC} ${LDFLAGS} -o $@ + @${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} buffer-test.c ${SRC} ${LDFLAGS} -o $@ map-test: config.h map-test.c ../../map.c @echo Compiling $@ binary diff --git a/test/core/buffer-test.c b/test/core/buffer-test.c index f3b2dad..8034ac4 100644 --- a/test/core/buffer-test.c +++ b/test/core/buffer-test.c @@ -4,7 +4,7 @@ #include <stdlib.h> #include <string.h> #include "tap.h" -#include "buffer.h" +#include "buffer.c" static bool compare(Buffer *buf, const char *data, size_t len) { return buf->len == len && (len == 0 || memcmp(buf->data, data, buf->len) == 0); @@ -32,8 +32,7 @@ int main(int argc, char *argv[]) { ok(buffer_put0(&buf, "") && compare0(&buf, ""), "Put empty string"); ok(buffer_put0(&buf, "bar") && compare0(&buf, "bar"), "Put string"); - ok(buffer_prepend0(&buf, "foo") && compare0(&buf, "foobar"), "Prepend string"); - ok(buffer_append0(&buf, "baz") && compare0(&buf, "foobarbaz"), "Append string"); + ok(buffer_append0(&buf, "baz") && compare0(&buf, "barbaz"), "Append string"); buffer_release(&buf); ok(buf.data == NULL && buf.len == 0 && buf.size == 0, "Release"); @@ -50,10 +49,9 @@ int main(int argc, char *argv[]) { ok(buffer_put(&buf, "foo", 0) && compare(&buf, "", 0), "Put zero length data"); ok(buffer_put(&buf, "bar", 3) && compare(&buf, "bar", 3), "Put data"); - ok(buffer_prepend(&buf, "foo\0", 4) && compare(&buf, "foo\0bar", 7), "Prepend data"); - ok(buffer_append(&buf, "\0baz", 4) && compare(&buf, "foo\0bar\0baz", 11), "Append data"); + ok(buffer_append(&buf, "\0baz", 4) && compare(&buf, "bar\0baz", 7), "Append data"); - ok(buffer_grow(&buf, cap+1) && compare(&buf, "foo\0bar\0baz", 11) && buf.size >= cap+1, "Grow"); + ok(buffer_grow(&buf, cap+1) && compare(&buf, "bar\0baz", 7) && buf.size >= cap+1, "Grow"); buf.len = 0; skip_if(TIS_INTERPRETER, 1, "vsnprintf not supported") { |
