From 55e28966226268a57edb07419ac419ef53ac437d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 28 Jun 2020 23:26:48 +0200 Subject: Make Reader always read from a ByteSource --- test/test_byte_source.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test/test_byte_source.c (limited to 'test/test_byte_source.c') diff --git a/test/test_byte_source.c b/test/test_byte_source.c new file mode 100644 index 00000000..14ef5819 --- /dev/null +++ b/test/test_byte_source.c @@ -0,0 +1,40 @@ +/* + Copyright 2021 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#undef NDEBUG + +#include "serd/serd.h" + +#include +#include +#include + +static void +test_bad_page_size(void) +{ + assert(!serd_byte_source_new_filename("file.ttl", 0)); + + assert(!serd_byte_source_new_function( + (SerdReadFunc)fread, (SerdStreamErrorFunc)ferror, NULL, NULL, NULL, 0)); +} + +int +main(void) +{ + test_bad_page_size(); + + return 0; +} -- cgit v1.2.1