mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2026-10-24 00:48:56 +03:00
* lib/string.in.h (strnul): Use _GL_BEGIN_NAMESPACE, _GL_END_NAMESPACE. * tests/test-strnul-c++2.cc: New file, based on tests/test-strnul.c. * modules/strnul-c++-tests (Files): Add it. (Makefile.am): Arrange to compile and run test-strnul-c++2.
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
/* Test of strnul() function in C++ mode.
|
|
Copyright (C) 2026 Free Software Foundation, Inc.
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
|
|
|
#define GNULIB_NAMESPACE gnulib
|
|
#include <config.h>
|
|
|
|
/* Specification. */
|
|
#include <string.h>
|
|
|
|
#include "macros.h"
|
|
|
|
int
|
|
main ()
|
|
{
|
|
const char ro[] = "foo";
|
|
char rw[] = "foo";
|
|
|
|
const char *ro_nul = GNULIB_NAMESPACE::strnul (ro);
|
|
char *rw_nul = GNULIB_NAMESPACE::strnul (rw);
|
|
|
|
ASSERT (ro_nul - ro == 3);
|
|
ASSERT (rw_nul - rw == 3);
|
|
|
|
return test_exit_status;
|
|
}
|