summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e240ab4)
* modules/unistr/u16-chr-tests: Depend on u32-to-u16.
* modules/unistr/u8-chr-tests: Depend on u32-to-u8.
* tests/unistr/test-chr.h: Build initial version as UCS-4 then convert.
* tests/unistr/test-u16-chr.c, tests/unistr/test-u32-chr.c,
tests/unistr/test-u8-chr.c: Define U32_TO_U.
extensions
getpagesize
unistr/u16-set
extensions
getpagesize
unistr/u16-set
configure.ac:
gl_FUNC_MMAP_ANON
configure.ac:
gl_FUNC_MMAP_ANON
extensions
getpagesize
unistr/u8-set
extensions
getpagesize
unistr/u8-set
configure.ac:
gl_FUNC_MMAP_ANON
configure.ac:
gl_FUNC_MMAP_ANON
main (void)
{
size_t n = 0x100000;
main (void)
{
size_t n = 0x100000;
- UNIT *input = (UNIT *) malloc (n * sizeof (UNIT));
+ size_t length;
+ UNIT *input;
+ uint32_t *input32 = (uint32_t *) malloc (n * sizeof (uint32_t));
+ ASSERT (input32);
+
+ input32[0] = 'a';
+ input32[1] = 'b';
+ u32_set (input32 + 2, 'c', 1024);
+ u32_set (input32 + 1026, 'd', n - 1028);
+ input32[n - 2] = 'e';
+ input32[n - 1] = 'a';
+
+ input = U32_TO_U (input32, n, NULL, &length);
- input[0] = 'a';
- input[1] = 'b';
- U_SET (input + 2, 'c', 1024);
- U_SET (input + 1026, 'd', n - 1028);
- input[n - 2] = 'e';
- input[n - 1] = 'a';
-
/* Basic behavior tests. */
ASSERT (U_CHR (input, n, 'a') == input);
/* Basic behavior tests. */
ASSERT (U_CHR (input, n, 'a') == input);
#include "macros.h"
#define UNIT uint16_t
#include "macros.h"
#define UNIT uint16_t
+#define U32_TO_U u32_to_u16
#define U_CHR u16_chr
#define U_SET u16_set
#include "test-chr.h"
#define U_CHR u16_chr
#define U_SET u16_set
#include "test-chr.h"
#include "macros.h"
#define UNIT uint32_t
#include "macros.h"
#define UNIT uint32_t
+#define U32_TO_U(s, n, result, length) (*(length) = (n), (s))
#define U_CHR u32_chr
#define U_SET u32_set
#include "test-chr.h"
#define U_CHR u32_chr
#define U_SET u32_set
#include "test-chr.h"
#include "macros.h"
#define UNIT uint8_t
#include "macros.h"
#define UNIT uint8_t
+#define U32_TO_U u32_to_u8
#define U_CHR u8_chr
#define U_SET u8_set
#include "test-chr.h"
#define U_CHR u8_chr
#define U_SET u8_set
#include "test-chr.h"