From d2469b29b9fe11a0b23cdb1663daabb02c77346d Mon Sep 17 00:00:00 2001 From: Gaetan Perrot Date: Fri, 2 Feb 2024 18:53:52 +0900 Subject: [PATCH] posix: Implement test for isastream Add tests for `isastream()` signed-off-by: Gaetan Perrot --- tests/posix/common/src/stropts.c | 9 +++++++++ tests/posix/headers/src/stropts_h.c | 1 + 2 files changed, 10 insertions(+) diff --git a/tests/posix/common/src/stropts.c b/tests/posix/common/src/stropts.c index a1c550062d67a2..9dcf899ca94ee0 100644 --- a/tests/posix/common/src/stropts.c +++ b/tests/posix/common/src/stropts.c @@ -59,4 +59,13 @@ ZTEST(stropts, test_getpmsg) zassert_equal(errno, ENOSYS, "Expected errno ENOSYS, got %d", errno); } +ZTEST(stropts, test_isastream) +{ + int fd = -1; + int ret = isastream(fd); + + zassert_equal(ret, -1, "Expected return value -1, got %d", ret); + zassert_equal(errno, ENOSYS, "Expected errno ENOSYS, got %d", errno); +} + ZTEST_SUITE(stropts, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/posix/headers/src/stropts_h.c b/tests/posix/headers/src/stropts_h.c index 2cc5c7a859ed79..fe928e04c2ce1f 100644 --- a/tests/posix/headers/src/stropts_h.c +++ b/tests/posix/headers/src/stropts_h.c @@ -23,6 +23,7 @@ ZTEST(posix_headers, test_stropts_h) zassert_not_null((void *)fattach, "fattach is null"); zassert_not_null((void *)getmsg, "getmsg is null"); zassert_not_null((void *)getpmsg, "getpmsg is null"); + zassert_not_null((void *)isastream, "isastream is null"); zassert_true(sizeof(((struct strbuf *)0)->maxlen) > 0, "maxlen size is 0"); zassert_true(sizeof(((struct strbuf *)0)->len) > 0, "len size is 0");