Mercurial > libbuf
view test/test-finish.c @ 26:0cc98943f6e2
tests: switch to rexo
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 12 Oct 2021 09:24:18 +0200 |
parents | d87e84936795 |
children | dbdc17e11648 |
line wrap: on
line source
/* * test-finish.c -- test buf_finish * * Copyright (c) 2019-2021 David Demelier <markand@malikania.fr> * * 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. * * THE 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. */ #include <rexo.h> #include "buf.h" RX_TEST_CASE(finish, simple) { struct buf b = {0}; buf_puts(&b, "abc"); buf_finish(&b); RX_REQUIRE(!b.data); RX_UINT_REQUIRE_EQUAL(b.length, 0U); RX_UINT_REQUIRE_EQUAL(b.capacity, 0U); } int main(int argc, char **argv) { return rx_main(0, NULL, argc, (const char **)argv) == RX_SUCCESS ? 0 : 1; }