summaryrefslogtreecommitdiff
path: root/tests/unictype
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unictype')
-rw-r--r--tests/unictype/test-bidi_byname.c35
-rw-r--r--tests/unictype/test-bidi_name.c16
-rw-r--r--tests/unictype/test-bidi_of.c16
-rw-r--r--tests/unictype/test-bidi_test.c16
-rw-r--r--tests/unictype/test-block_list.c24
-rw-r--r--tests/unictype/test-block_of.c36
-rw-r--r--tests/unictype/test-block_test.c16
-rw-r--r--tests/unictype/test-categ_and.c16
-rw-r--r--tests/unictype/test-categ_and_not.c16
-rw-r--r--tests/unictype/test-categ_byname.c67
-rw-r--r--tests/unictype/test-categ_name.c16
-rw-r--r--tests/unictype/test-categ_none.c16
-rw-r--r--tests/unictype/test-categ_of.c16
-rw-r--r--tests/unictype/test-categ_or.c16
-rw-r--r--tests/unictype/test-categ_test_withtable.c16
-rw-r--r--tests/unictype/test-combining.c16
-rw-r--r--tests/unictype/test-decdigit.c19
-rw-r--r--tests/unictype/test-digit.c19
-rw-r--r--tests/unictype/test-mirror.c16
-rw-r--r--tests/unictype/test-numeric.c27
-rw-r--r--tests/unictype/test-pr_byname.c14
-rw-r--r--tests/unictype/test-pr_test.c16
-rw-r--r--tests/unictype/test-predicate-part1.h18
-rw-r--r--tests/unictype/test-predicate-part2.h4
-rw-r--r--tests/unictype/test-scripts.c28
-rw-r--r--tests/unictype/test-sy_c_ident.c16
-rw-r--r--tests/unictype/test-sy_java_ident.c16
27 files changed, 149 insertions, 398 deletions
diff --git a/tests/unictype/test-bidi_byname.c b/tests/unictype/test-bidi_byname.c
index 5b1cfec..9139131 100644
--- a/tests/unictype/test-bidi_byname.c
+++ b/tests/unictype/test-bidi_byname.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2010 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
@@ -18,27 +18,34 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
{
+ ASSERT (uc_bidi_category_byname ("L") == UC_BIDI_L);
+ ASSERT (uc_bidi_category_byname ("LRE") == UC_BIDI_LRE);
+ ASSERT (uc_bidi_category_byname ("LRO") == UC_BIDI_LRO);
+ ASSERT (uc_bidi_category_byname ("R") == UC_BIDI_R);
+ ASSERT (uc_bidi_category_byname ("AL") == UC_BIDI_AL);
+ ASSERT (uc_bidi_category_byname ("RLE") == UC_BIDI_RLE);
+ ASSERT (uc_bidi_category_byname ("RLO") == UC_BIDI_RLO);
+ ASSERT (uc_bidi_category_byname ("PDF") == UC_BIDI_PDF);
+ ASSERT (uc_bidi_category_byname ("EN") == UC_BIDI_EN);
+ ASSERT (uc_bidi_category_byname ("ES") == UC_BIDI_ES);
+ ASSERT (uc_bidi_category_byname ("ET") == UC_BIDI_ET);
+ ASSERT (uc_bidi_category_byname ("AN") == UC_BIDI_AN);
+ ASSERT (uc_bidi_category_byname ("CS") == UC_BIDI_CS);
ASSERT (uc_bidi_category_byname ("NSM") == UC_BIDI_NSM);
+ ASSERT (uc_bidi_category_byname ("BN") == UC_BIDI_BN);
+ ASSERT (uc_bidi_category_byname ("B") == UC_BIDI_B);
+ ASSERT (uc_bidi_category_byname ("S") == UC_BIDI_S);
+ ASSERT (uc_bidi_category_byname ("WS") == UC_BIDI_WS);
+ ASSERT (uc_bidi_category_byname ("ON") == UC_BIDI_ON);
ASSERT (uc_bidi_category_byname ("X") < 0);
+ ASSERT (uc_bidi_category_byname ("") < 0);
return 0;
}
diff --git a/tests/unictype/test-bidi_name.c b/tests/unictype/test-bidi_name.c
index a444ec0..1a4ef0b 100644
--- a/tests/unictype/test-bidi_name.c
+++ b/tests/unictype/test-bidi_name.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-bidi_of.c b/tests/unictype/test-bidi_of.c
index 720e9f9..91fda15 100644
--- a/tests/unictype/test-bidi_of.c
+++ b/tests/unictype/test-bidi_of.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-bidi_test.c b/tests/unictype/test-bidi_test.c
index 3404e72..c9e7b39 100644
--- a/tests/unictype/test-bidi_test.c
+++ b/tests/unictype/test-bidi_test.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-block_list.c b/tests/unictype/test-block_list.c
index 140b573..d475546 100644
--- a/tests/unictype/test-block_list.c
+++ b/tests/unictype/test-block_list.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
@@ -49,10 +37,10 @@ main ()
for (i = 0; i < nblocks; i++)
{
- if (strcmp (blocks[i].name, "Latin") == 0)
- latin_block = &blocks[i];
- if (strcmp (blocks[i].name, "Hebrew") == 0)
- hebrew_block = &blocks[i];
+ if (strcmp (blocks[i].name, "Latin") == 0)
+ latin_block = &blocks[i];
+ if (strcmp (blocks[i].name, "Hebrew") == 0)
+ hebrew_block = &blocks[i];
}
ASSERT (latin_block == NULL);
ASSERT (hebrew_block != NULL);
diff --git a/tests/unictype/test-block_of.c b/tests/unictype/test-block_of.c
index 9460cde..230fa87 100644
--- a/tests/unictype/test-block_of.c
+++ b/tests/unictype/test-block_of.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
@@ -45,8 +33,8 @@ main ()
for (c = 0; c < 0x110000; c++)
{
- const uc_block_t *block = uc_block (c);
- ASSERT (block == NULL || uc_is_block (c, block));
+ const uc_block_t *block = uc_block (c);
+ ASSERT (block == NULL || uc_is_block (c, block));
}
}
@@ -59,19 +47,19 @@ main ()
for (i = 0; i < nblocks; i++)
{
- if (strcmp (blocks[i].name, "Hebrew") == 0)
- {
- ASSERT (uc_block (0x05DE) == &blocks[i]);
- ASSERT (uc_is_block (0x05DE, &blocks[i]));
- }
+ if (strcmp (blocks[i].name, "Hebrew") == 0)
+ {
+ ASSERT (uc_block (0x05DE) == &blocks[i]);
+ ASSERT (uc_is_block (0x05DE, &blocks[i]));
+ }
}
for (i = 0; i < nblocks; i++)
{
- unsigned int c;
+ unsigned int c;
- for (c = blocks[i].start; c <= blocks[i].end; c++)
- ASSERT (uc_block (c) == &blocks[i]);
+ for (c = blocks[i].start; c <= blocks[i].end; c++)
+ ASSERT (uc_block (c) == &blocks[i]);
}
}
diff --git a/tests/unictype/test-block_test.c b/tests/unictype/test-block_test.c
index b086cde..8971a39 100644
--- a/tests/unictype/test-block_test.c
+++ b/tests/unictype/test-block_test.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-categ_and.c b/tests/unictype/test-categ_and.c
index 5531ff4..70d28cc 100644
--- a/tests/unictype/test-categ_and.c
+++ b/tests/unictype/test-categ_and.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-categ_and_not.c b/tests/unictype/test-categ_and_not.c
index 90b40f8..72afe83 100644
--- a/tests/unictype/test-categ_and_not.c
+++ b/tests/unictype/test-categ_and_not.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-categ_byname.c b/tests/unictype/test-categ_byname.c
index 3bb44e9..0da1625 100644
--- a/tests/unictype/test-categ_byname.c
+++ b/tests/unictype/test-categ_byname.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2010 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
@@ -18,26 +18,63 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
+#include <stdbool.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
+
+static bool
+category_equals (uc_general_category_t category1,
+ uc_general_category_t category2)
+{
+ return (category1.bitmask == category2.bitmask
+ && category1.generic == category2.generic
+ && (category1.generic
+ ? category1.lookup.lookup_fn == category2.lookup.lookup_fn
+ : category1.lookup.table == category2.lookup.table));
+}
int
main ()
{
- uc_general_category_byname ("L");
+ ASSERT (category_equals (uc_general_category_byname ("L"), UC_CATEGORY_L));
+ ASSERT (category_equals (uc_general_category_byname ("Lu"), UC_CATEGORY_Lu));
+ ASSERT (category_equals (uc_general_category_byname ("Ll"), UC_CATEGORY_Ll));
+ ASSERT (category_equals (uc_general_category_byname ("Lt"), UC_CATEGORY_Lt));
+ ASSERT (category_equals (uc_general_category_byname ("Lm"), UC_CATEGORY_Lm));
+ ASSERT (category_equals (uc_general_category_byname ("Lo"), UC_CATEGORY_Lo));
+ ASSERT (category_equals (uc_general_category_byname ("M"), UC_CATEGORY_M));
+ ASSERT (category_equals (uc_general_category_byname ("Mn"), UC_CATEGORY_Mn));
+ ASSERT (category_equals (uc_general_category_byname ("Mc"), UC_CATEGORY_Mc));
+ ASSERT (category_equals (uc_general_category_byname ("Me"), UC_CATEGORY_Me));
+ ASSERT (category_equals (uc_general_category_byname ("N"), UC_CATEGORY_N));
+ ASSERT (category_equals (uc_general_category_byname ("Nd"), UC_CATEGORY_Nd));
+ ASSERT (category_equals (uc_general_category_byname ("Nl"), UC_CATEGORY_Nl));
+ ASSERT (category_equals (uc_general_category_byname ("No"), UC_CATEGORY_No));
+ ASSERT (category_equals (uc_general_category_byname ("P"), UC_CATEGORY_P));
+ ASSERT (category_equals (uc_general_category_byname ("Pc"), UC_CATEGORY_Pc));
+ ASSERT (category_equals (uc_general_category_byname ("Pd"), UC_CATEGORY_Pd));
+ ASSERT (category_equals (uc_general_category_byname ("Ps"), UC_CATEGORY_Ps));
+ ASSERT (category_equals (uc_general_category_byname ("Pe"), UC_CATEGORY_Pe));
+ ASSERT (category_equals (uc_general_category_byname ("Pi"), UC_CATEGORY_Pi));
+ ASSERT (category_equals (uc_general_category_byname ("Pf"), UC_CATEGORY_Pf));
+ ASSERT (category_equals (uc_general_category_byname ("Po"), UC_CATEGORY_Po));
+ ASSERT (category_equals (uc_general_category_byname ("S"), UC_CATEGORY_S));
+ ASSERT (category_equals (uc_general_category_byname ("Sm"), UC_CATEGORY_Sm));
+ ASSERT (category_equals (uc_general_category_byname ("Sc"), UC_CATEGORY_Sc));
+ ASSERT (category_equals (uc_general_category_byname ("Sk"), UC_CATEGORY_Sk));
+ ASSERT (category_equals (uc_general_category_byname ("So"), UC_CATEGORY_So));
+ ASSERT (category_equals (uc_general_category_byname ("Z"), UC_CATEGORY_Z));
+ ASSERT (category_equals (uc_general_category_byname ("Zs"), UC_CATEGORY_Zs));
+ ASSERT (category_equals (uc_general_category_byname ("Zl"), UC_CATEGORY_Zl));
+ ASSERT (category_equals (uc_general_category_byname ("Zp"), UC_CATEGORY_Zp));
+ ASSERT (category_equals (uc_general_category_byname ("C"), UC_CATEGORY_C));
+ ASSERT (category_equals (uc_general_category_byname ("Cc"), UC_CATEGORY_Cc));
+ ASSERT (category_equals (uc_general_category_byname ("Cf"), UC_CATEGORY_Cf));
+ ASSERT (category_equals (uc_general_category_byname ("Cs"), UC_CATEGORY_Cs));
+ ASSERT (category_equals (uc_general_category_byname ("Co"), UC_CATEGORY_Co));
+ ASSERT (category_equals (uc_general_category_byname ("Cn"), UC_CATEGORY_Cn));
+
uc_general_category_byname ("Nl");
{
diff --git a/tests/unictype/test-categ_name.c b/tests/unictype/test-categ_name.c
index b5c3f75..bef6600 100644
--- a/tests/unictype/test-categ_name.c
+++ b/tests/unictype/test-categ_name.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-categ_none.c b/tests/unictype/test-categ_none.c
index f800241..bc0a9a7 100644
--- a/tests/unictype/test-categ_none.c
+++ b/tests/unictype/test-categ_none.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-categ_of.c b/tests/unictype/test-categ_of.c
index 28ee663..26d0463 100644
--- a/tests/unictype/test-categ_of.c
+++ b/tests/unictype/test-categ_of.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-categ_or.c b/tests/unictype/test-categ_or.c
index 6b07de5..7973eb0 100644
--- a/tests/unictype/test-categ_or.c
+++ b/tests/unictype/test-categ_or.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-categ_test_withtable.c b/tests/unictype/test-categ_test_withtable.c
index b735132..8e52a37 100644
--- a/tests/unictype/test-categ_test_withtable.c
+++ b/tests/unictype/test-categ_test_withtable.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-combining.c b/tests/unictype/test-combining.c
index 3e66a9b..d890f1d 100644
--- a/tests/unictype/test-combining.c
+++ b/tests/unictype/test-combining.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-decdigit.c b/tests/unictype/test-decdigit.c
index 3d91690..f94605e 100644
--- a/tests/unictype/test-decdigit.c
+++ b/tests/unictype/test-decdigit.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,22 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
+#include "macros.h"
static const struct { unsigned int ch; int value; } mapping[] =
{
@@ -50,7 +37,7 @@ main ()
for (i = 0; i < SIZEOF (mapping); i++)
{
for (; c < mapping[i].ch; c++)
- ASSERT (uc_decimal_value (c) == -1);
+ ASSERT (uc_decimal_value (c) == -1);
/* Here c = mapping[i].ch. */
ASSERT (uc_decimal_value (c) == mapping[i].value);
c++;
diff --git a/tests/unictype/test-digit.c b/tests/unictype/test-digit.c
index efecaab..e87f3f7 100644
--- a/tests/unictype/test-digit.c
+++ b/tests/unictype/test-digit.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,22 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
+#include "macros.h"
static const struct { unsigned int ch; int value; } mapping[] =
{
@@ -50,7 +37,7 @@ main ()
for (i = 0; i < SIZEOF (mapping); i++)
{
for (; c < mapping[i].ch; c++)
- ASSERT (uc_digit_value (c) == -1);
+ ASSERT (uc_digit_value (c) == -1);
/* Here c = mapping[i].ch. */
ASSERT (uc_digit_value (c) == mapping[i].value);
c++;
diff --git a/tests/unictype/test-mirror.c b/tests/unictype/test-mirror.c
index fb4402f..457c502 100644
--- a/tests/unictype/test-mirror.c
+++ b/tests/unictype/test-mirror.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-numeric.c b/tests/unictype/test-numeric.c
index 5bca363..d602383 100644
--- a/tests/unictype/test-numeric.c
+++ b/tests/unictype/test-numeric.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,22 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
+#include "macros.h"
static const struct { unsigned int ch; int numerator; int denominator; }
mapping[] =
@@ -52,14 +39,14 @@ main ()
for (i = 0; i < SIZEOF (mapping); i++)
{
for (; c < mapping[i].ch; c++)
- {
- value = uc_numeric_value (c);
- ASSERT (value.numerator == 0 && value.denominator == 0);
- }
+ {
+ value = uc_numeric_value (c);
+ ASSERT (value.numerator == 0 && value.denominator == 0);
+ }
/* Here c = mapping[i].ch. */
value = uc_numeric_value (c);
ASSERT (value.numerator == mapping[i].numerator
- && value.denominator == mapping[i].denominator);
+ && value.denominator == mapping[i].denominator);
c++;
}
for (; c < 0x110000; c++)
diff --git a/tests/unictype/test-pr_byname.c b/tests/unictype/test-pr_byname.c
index 770d4c8..aa2676f 100644
--- a/tests/unictype/test-pr_byname.c
+++ b/tests/unictype/test-pr_byname.c
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-pr_test.c b/tests/unictype/test-pr_test.c
index 388ae00..6bacc07 100644
--- a/tests/unictype/test-pr_test.c
+++ b/tests/unictype/test-pr_test.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-predicate-part1.h b/tests/unictype/test-predicate-part1.h
index e81de47..1031856 100644
--- a/tests/unictype/test-predicate-part1.h
+++ b/tests/unictype/test-predicate-part1.h
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,23 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed for c = 0x%04X\n", \
- __FILE__, __LINE__, c); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
+#include "macros.h"
/* Interval of Unicode characters. */
typedef struct { ucs4_t start; ucs4_t end; } interval_t;
diff --git a/tests/unictype/test-predicate-part2.h b/tests/unictype/test-predicate-part2.h
index 60b7c24..eeeb934 100644
--- a/tests/unictype/test-predicate-part2.h
+++ b/tests/unictype/test-predicate-part2.h
@@ -26,9 +26,9 @@ main ()
for (i = 0; i < SIZEOF (set); i++)
{
for (; c < set[i].start; c++)
- ASSERT (!PREDICATE (c));
+ ASSERT (!PREDICATE (c));
for (; c <= set[i].end; c++)
- ASSERT (PREDICATE (c));
+ ASSERT (PREDICATE (c));
}
for (; c < 0x110000; c++)
ASSERT (!PREDICATE (c));
diff --git a/tests/unictype/test-scripts.c b/tests/unictype/test-scripts.c
index 4b4b0f9..610b473 100644
--- a/tests/unictype/test-scripts.c
+++ b/tests/unictype/test-scripts.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
@@ -57,9 +45,9 @@ main ()
for (c = 0; c < 0x110000; c++)
{
- const uc_script_t *script = uc_script (c);
- if (script != NULL)
- ASSERT (uc_is_script (c, script));
+ const uc_script_t *script = uc_script (c);
+ if (script != NULL)
+ ASSERT (uc_is_script (c, script));
}
}
@@ -75,9 +63,9 @@ main ()
found = false;
for (i = 0; i < nscripts; i++)
{
- ASSERT (scripts[i].name != NULL);
- if (strcmp (scripts[i].name, "Hebrew") == 0)
- found = true;
+ ASSERT (scripts[i].name != NULL);
+ if (strcmp (scripts[i].name, "Hebrew") == 0)
+ found = true;
}
ASSERT (found);
}
diff --git a/tests/unictype/test-sy_c_ident.c b/tests/unictype/test-sy_c_ident.c
index 00688e1..026db18 100644
--- a/tests/unictype/test-sy_c_ident.c
+++ b/tests/unictype/test-sy_c_ident.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
diff --git a/tests/unictype/test-sy_java_ident.c b/tests/unictype/test-sy_java_ident.c
index 0a4eb0a..ed9ddeb 100644
--- a/tests/unictype/test-sy_java_ident.c
+++ b/tests/unictype/test-sy_java_ident.c
@@ -1,5 +1,5 @@
/* Test the Unicode character type functions.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -18,21 +18,9 @@
#include "unictype.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()