OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
3 * Copyright (c) 1997-2014, International Business Machines Corporation and | 3 * Copyright (c) 1997-2015, International Business Machines Corporation and |
4 * others. All Rights Reserved. | 4 * others. All Rights Reserved. |
5 ********************************************************************/ | 5 ********************************************************************/ |
6 /***************************************************************************** | 6 /***************************************************************************** |
7 * | 7 * |
8 * File CCONVTST.C | 8 * File ncnvtst.c |
9 * | 9 * |
10 * Modification History: | 10 * Modification History: |
11 * Name Description | 11 * Name Description |
12 * Madhu Katragadda 7/7/2000 Converter Tests for extended c
ode coverage | 12 * Madhu Katragadda 7/7/2000 Converter Tests for extended c
ode coverage |
13 ****************************************************************************** | 13 ****************************************************************************** |
14 */ | 14 */ |
15 #include <stdio.h> | 15 #include <stdio.h> |
16 #include <stdlib.h> | 16 #include <stdlib.h> |
17 #include <string.h> | 17 #include <string.h> |
18 #include "unicode/uloc.h" | 18 #include "unicode/uloc.h" |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 if (U_FAILURE(err) || (int32_t)(pivBeg - pivotBuffer) != 2 || u_strncmp(
pivotBuffer, expected, 2) != 0) { | 748 if (U_FAILURE(err) || (int32_t)(pivBeg - pivotBuffer) != 2 || u_strncmp(
pivotBuffer, expected, 2) != 0) { |
749 log_err("Did not get expected results for UTF-8.\n"); | 749 log_err("Did not get expected results for UTF-8.\n"); |
750 } | 750 } |
751 ucnv_close(conv8); | 751 ucnv_close(conv8); |
752 } | 752 } |
753 } | 753 } |
754 | 754 |
755 #define MAX_UTF32_LEN 1 | 755 #define MAX_UTF32_LEN 1 |
756 | 756 |
757 static void TestRegressionUTF32(){ | 757 static void TestRegressionUTF32(){ |
| 758 #if !UCONFIG_ONLY_HTML_CONVERSION |
758 UChar32 currCh = 0; | 759 UChar32 currCh = 0; |
759 int32_t offset32; | 760 int32_t offset32; |
760 int32_t offset16; | 761 int32_t offset16; |
761 UChar *standardForm = (UChar*)malloc(MAX_LENGTH*sizeof(UChar)); | 762 UChar *standardForm = (UChar*)malloc(MAX_LENGTH*sizeof(UChar)); |
762 UChar32 *utf32 = (UChar32*)malloc(MAX_LENGTH*sizeof(UChar32)); | 763 UChar32 *utf32 = (UChar32*)malloc(MAX_LENGTH*sizeof(UChar32)); |
763 | 764 |
764 while (currCh <= UNICODE_LIMIT) { | 765 while (currCh <= UNICODE_LIMIT) { |
765 offset16 = 0; | 766 offset16 = 0; |
766 offset32 = 0; | 767 offset32 = 0; |
767 while(currCh <= UNICODE_LIMIT | 768 while(currCh <= UNICODE_LIMIT |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 ucnv_toUnicode(convLE, &pivBeg, pivEnd, &srcBeg, srcEnd, 0, TRUE, &err); | 880 ucnv_toUnicode(convLE, &pivBeg, pivEnd, &srcBeg, srcEnd, 0, TRUE, &err); |
880 if (srcBeg != srcEnd) { | 881 if (srcBeg != srcEnd) { |
881 log_err("Did not consume whole buffer on second call.\n"); | 882 log_err("Did not consume whole buffer on second call.\n"); |
882 } | 883 } |
883 | 884 |
884 if (U_FAILURE(err) || (int32_t)(pivBeg - pivotBuffer) != 2 || u_strncmp(
pivotBuffer, expected, 2) != 0) { | 885 if (U_FAILURE(err) || (int32_t)(pivBeg - pivotBuffer) != 2 || u_strncmp(
pivotBuffer, expected, 2) != 0) { |
885 log_err("Did not get expected results for UTF-32LE.\n"); | 886 log_err("Did not get expected results for UTF-32LE.\n"); |
886 } | 887 } |
887 ucnv_close(convLE); | 888 ucnv_close(convLE); |
888 } | 889 } |
| 890 #endif |
889 } | 891 } |
890 | 892 |
891 /*Walk through the available converters*/ | 893 /*Walk through the available converters*/ |
892 static void TestAvailableConverters(){ | 894 static void TestAvailableConverters(){ |
893 UErrorCode status=U_ZERO_ERROR; | 895 UErrorCode status=U_ZERO_ERROR; |
894 UConverter *conv=NULL; | 896 UConverter *conv=NULL; |
895 int32_t i=0; | 897 int32_t i=0; |
896 for(i=0; i < ucnv_countAvailable(); i++){ | 898 for(i=0; i < ucnv_countAvailable(); i++){ |
897 status=U_ZERO_ERROR; | 899 status=U_ZERO_ERROR; |
898 conv=ucnv_open(ucnv_getAvailableName(i), &status); | 900 conv=ucnv_open(ucnv_getAvailableName(i), &status); |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 } | 2049 } |
2048 errorCode = U_PARSE_ERROR; | 2050 errorCode = U_PARSE_ERROR; |
2049 /* Make sure that it does nothing if an error is passed in. Difficult to pro
per test for. */ | 2051 /* Make sure that it does nothing if an error is passed in. Difficult to pro
per test for. */ |
2050 ucnv_getUnicodeSet(NULL, NULL, UCNV_ROUNDTRIP_SET, &errorCode); | 2052 ucnv_getUnicodeSet(NULL, NULL, UCNV_ROUNDTRIP_SET, &errorCode); |
2051 if (errorCode != U_PARSE_ERROR) { | 2053 if (errorCode != U_PARSE_ERROR) { |
2052 log_err("error: ucnv_getUnicodeSet(NULL) returned wrong status code %s\n
", u_errorName(errorCode)); | 2054 log_err("error: ucnv_getUnicodeSet(NULL) returned wrong status code %s\n
", u_errorName(errorCode)); |
2053 } | 2055 } |
2054 | 2056 |
2055 uset_close(set); | 2057 uset_close(set); |
2056 } | 2058 } |
OLD | NEW |