blob: 57ff705657480a09a68aed632fd1bf55d4515780 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/*
* Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibTest/TestCase.h>
#include <errno.h>
#include <string.h>
TEST_CASE(strerror_r_basic)
{
EXPECT_EQ(strerror_r(1000, nullptr, 0), EINVAL);
EXPECT_EQ(strerror_r(EFAULT, nullptr, 0), ERANGE);
char buf[64];
EXPECT_EQ(strerror_r(EFAULT, buf, sizeof(buf)), 0);
EXPECT_EQ(strcmp(buf, "Bad address"), 0);
}
|