From 3e0814cd9862b89c7a39672672937477bd87ddfb Mon Sep 17 00:00:00 2001 From: Andreas Rottmann Date: Thu, 27 May 2010 18:23:15 +0200 Subject: Imported Upstream version 0.9.3 --- tests/unictype/test-bidi_byname.c | 35 +++++++++------- tests/unictype/test-bidi_name.c | 16 +------ tests/unictype/test-bidi_of.c | 16 +------ tests/unictype/test-bidi_test.c | 16 +------ tests/unictype/test-block_list.c | 24 +++-------- tests/unictype/test-block_of.c | 36 ++++++---------- tests/unictype/test-block_test.c | 16 +------ tests/unictype/test-categ_and.c | 16 +------ tests/unictype/test-categ_and_not.c | 16 +------ tests/unictype/test-categ_byname.c | 67 +++++++++++++++++++++++------- tests/unictype/test-categ_name.c | 16 +------ tests/unictype/test-categ_none.c | 16 +------ tests/unictype/test-categ_of.c | 16 +------ tests/unictype/test-categ_or.c | 16 +------ tests/unictype/test-categ_test_withtable.c | 16 +------ tests/unictype/test-combining.c | 16 +------ tests/unictype/test-decdigit.c | 19 ++------- tests/unictype/test-digit.c | 19 ++------- tests/unictype/test-mirror.c | 16 +------ tests/unictype/test-numeric.c | 27 ++++-------- tests/unictype/test-pr_byname.c | 14 +------ tests/unictype/test-pr_test.c | 16 +------ tests/unictype/test-predicate-part1.h | 18 +------- tests/unictype/test-predicate-part2.h | 4 +- tests/unictype/test-scripts.c | 28 ++++--------- tests/unictype/test-sy_c_ident.c | 16 +------ tests/unictype/test-sy_java_ident.c | 16 +------ 27 files changed, 149 insertions(+), 398 deletions(-) (limited to 'tests/unictype') diff --git a/tests/unictype/test-bidi_byname.c b/tests/unictype/test-bidi_byname.c index 5b1cfec9..9139131b 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 -#include #include -#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 a444ec0c..1a4ef0ba 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 -#include #include -#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 720e9f97..91fda153 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 -#include #include -#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 3404e72f..c9e7b39f 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 -#include #include -#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 140b573f..d4755464 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 -#include #include -#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 9460cdeb..230fa87d 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 -#include #include -#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 b086cde6..8971a399 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 -#include #include -#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 5531ff40..70d28cc0 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 -#include #include -#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 90b40f8b..72afe83f 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 -#include #include -#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 3bb44e9c..0da16259 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 -#include +#include #include -#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 b5c3f752..bef66007 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 -#include #include -#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 f8002416..bc0a9a7b 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 -#include #include -#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 28ee6630..26d04634 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 -#include #include -#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 6b07de5f..7973eb00 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 -#include #include -#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 b7351328..8e52a370 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 -#include #include -#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 3e66a9b7..d890f1d4 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 -#include #include -#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 3d916908..f94605ef 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 -#include #include -#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 efecaaba..e87f3f75 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 -#include #include -#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 fb4402ff..457c502b 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 -#include #include -#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 5bca3638..d6023831 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 -#include #include -#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 770d4c8f..aa2676f0 100644 --- a/tests/unictype/test-pr_byname.c +++ b/tests/unictype/test-pr_byname.c @@ -18,21 +18,9 @@ #include "unictype.h" -#include -#include #include -#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 388ae004..6bacc078 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 -#include #include -#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 e81de471..1031856d 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 -#include #include -#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 60b7c246..eeeb934b 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 4b4b0f92..610b4733 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 -#include #include -#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 00688e13..026db181 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 -#include #include -#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 0a4eb0af..ed9ddeb9 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 -#include #include -#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 () -- cgit v1.2.3