/* * re_tests_utf8.c * * A programmers editor * * Tests (ensure correct functionality of modules) * * Author: Dario Rodriguez antartica@whereismybit.com * This program is licensed under the terms of GNU GPL v2.1+ */ #include #include #include #include #include #include #include #include "re_data.h" #define TEST_OK "OK" typedef struct test_ui_t { char *name; char *(*fn)(char *,int , int, int, int); } test_ui_t; char *test_utf8len(char *teststring, int expectednchars, int dummy1, int dummy2,int dummy3); char *test_utf8col(char *teststring, int dummy0, int col, int expectedoffset,int dummy3); char *test_utf8charlen(char *teststring, int dummy0, int dummy1, int offset,int charsizeatoffset); int main(int argc, char *argv[]) { struct { char string[1024]; int nchars; int col; int offsetcol; int charsizeatoffsetcol; } teststrings[]={ {{"This is a latin1 string"},51-28,1,1,1}, {{"lowercase acute vowels:\xc3\xa1\xc3\xa9\xc3\xad\xc3\xb3\xc3\xba"},23+5,23+1,23+2,2}, }; test_ui_t tests[]={ {"utf8len",test_utf8len}, {"utf8col",test_utf8col}, {"utf8charlen",test_utf8charlen}, }; int flag_exit=0,flag_all=0; int i,s; int nerrors,total; char *res; for(i=1;i