/* See LICENSE file for copyright and license details. */ #include "common.h" #ifndef TEST extern inline char *libabort_stracat(char *dst, const char *src, size_t size); #else int main(void) { char buf[16]; char *p; INIT_TEST_ABORT(); buf[0] = '\0'; EXPECT_NO_ABORT(p = libabort_stracat(buf, "hello", sizeof(buf))); EXPECT(p == buf); EXPECT(!buf[5]); EXPECT(!strcmp(buf, "hello")); EXPECT_NO_ABORT(p = libabort_stracat(buf, " world", sizeof(buf))); EXPECT(p == buf); EXPECT(!buf[11]); EXPECT(!strcmp(buf, "hello world")); EXPECT_ABORT(libabort_stracat(buf, " 0123456789abcdef", sizeof(buf))); return 0; } #endif