Home | History | Annotate | Download | only in iotest

Lines Matching refs:myFile

32 static void TestFileFromICU(UFILE *myFile) {
50 if (myFile == NULL) {
72 u_fprintf(myFile, "Signed decimal integer %%d: %d\n", *n);
73 u_fprintf(myFile, "Signed decimal integer %%i: %i\n", *n);
74 u_fprintf(myFile, "Unsigned octal integer %%o: %o\n", *n);
75 u_fprintf(myFile, "Unsigned decimal integer %%u: %u\n", *n);
76 u_fprintf(myFile, "Lowercase unsigned hexadecimal integer %%x: %x\n", *n);
77 u_fprintf(myFile, "Uppercase unsigned hexadecimal integer %%X: %X\n", *n);
78 u_fprintf(myFile, "Float %%f: %f\n", myFloat);
79 u_fprintf(myFile, "Lowercase float %%e: %e\n", myFloat);
80 u_fprintf(myFile, "Uppercase float %%E: %E\n", myFloat);
81 u_fprintf(myFile, "Lowercase float %%g: %g\n", myFloat);
82 u_fprintf(myFile, "Uppercase float %%G: %G\n", myFloat);
83 u_fprintf(myFile, "Pointer %%p: %p\n", origPtr);
84 u_fprintf(myFile, "Char %%c: %c\n", 'A');
85 u_fprintf(myFile, "UChar %%C: %C\n", (UChar)0x0041); /*'A'*/
86 u_fprintf(myFile, "String %%s: %s\n", "My-String");
87 u_fprintf(myFile, "NULL String %%s: %s\n", NULL);
88 u_fprintf(myFile, "Unicode String %%S: %S\n", myStringOrig);
89 u_fprintf(myFile, "NULL Unicode String %%S: %S\n", NULL);
90 u_fprintf(myFile, "Percent %%P (non-ANSI): %P\n", myFloat);
91 u_fprintf(myFile, "Spell Out %%V (non-ANSI): %V\n", myFloat);
93 if (u_feof(myFile)) {
98 u_fprintf(myFile, "\t\nPointer to integer (Count) %%n: n=%d %n n=%d\n", *n, n, *n);
99 u_fprintf(myFile, "Pointer to integer Value: %d\n", *n);
100 u_fprintf(myFile, "This is a long test123456789012345678901234567890123456789012345678901234567890\n");
102 u_fprintf(myFile, "\tNormal fprintf count: n=%d %n n=%d\n", (int)*n, (int*)n, (int)*n);
103 fprintf(u_fgetfile(myFile), "\tNormal fprintf count value: n=%d\n", (int)*n); /* Should be 27 as stated later on. */
105 u_fclose(myFile);
106 myFile = u_fopen(STANDARD_TEST_FILE, "r", STANDARD_TEST_LOCALE, NULL);
108 if (myFile == NULL) {
113 if (u_feof(myFile)) {
117 myUString[0] = u_fgetc(myFile);
121 u_fungetc(myUString[0], myFile);
122 myUString[0] = u_fgetc(myFile);
126 u_fungetc(myUString[0], myFile);
127 myUString[0] = u_fgetc(myFile);
131 u_fungetc(myUString[0], myFile);
132 myUString[0] = u_fgetc(myFile);
133 myUString[1] = (UChar)u_fgetcx(myFile); /* Mix getc and getcx and see what happens. */
134 myUString[2] = u_fgetc(myFile);
138 u_fungetc(myUString[2], myFile);
139 u_fungetc(myUString[1], myFile);
140 u_fungetc(myUString[0], myFile);
145 u_fscanf(myFile, "Signed decimal integer %%d: %d\n", newValuePtr);
150 u_fscanf(myFile, "Signed decimal integer %%i: %i\n", newValuePtr);
155 u_fscanf(myFile, "Unsigned octal integer %%o: %o\n", newValuePtr);
160 u_fscanf(myFile, "Unsigned decimal integer %%u: %u\n", newValuePtr);
165 u_fscanf(myFile, "Lowercase unsigned hexadecimal integer %%x: %x\n", newValuePtr);
170 u_fscanf(myFile, "Uppercase unsigned hexadecimal integer %%X: %X\n", newValuePtr);
175 u_fscanf(myFile, "Float %%f: %lf\n", newDoubleValuePtr);
180 u_fscanf(myFile, "Lowercase float %%e: %le\n", newDoubleValuePtr);
185 u_fscanf(myFile, "Uppercase float %%E: %lE\n", newDoubleValuePtr);
190 u_fscanf(myFile, "Lowercase float %%g: %lg\n", newDoubleValuePtr);
195 u_fscanf(myFile, "Uppercase float %%G: %lG\n", newDoubleValuePtr);
200 u_fscanf(myFile, "Pointer %%p: %p\n", &ptr);
204 u_fscanf(myFile, "Char %%c: %c\n", myString);
208 u_fscanf(myFile, "UChar %%C: %C\n", myUString);
212 u_fscanf(myFile, "String %%s: %s\n", myString);
216 u_fscanf(myFile, "NULL String %%s: %s\n", myString);
220 u_fscanf(myFile, "Unicode String %%S: %S\n", myUString);
225 u_fscanf(myFile, "NULL Unicode String %%S: %S\n", myUString);
231 u_fscanf(myFile, "Percent %%P (non-ANSI): %P\n", newDoubleValuePtr);
236 u_fscanf(myFile, "Spell Out %%V (non-ANSI): %V\n", newDoubleValuePtr);
241 u_fgets(myUString, 4, myFile);
249 if (u_fgets(myUString, UPRV_LENGTHOF(myUString), myFile) != myUString) {
257 if (u_fgets(myUString, UPRV_LENGTHOF(myUString), myFile) != myUString) {
265 if (u_fgets(myUString, UPRV_LENGTHOF(myUString), myFile) != myUString) {
273 if (u_fgets(myUString, 0, myFile) != NULL) {
277 if (u_fgets(myUString, 1, myFile) != myUString) {
285 if (u_fgets(myUString, 2, myFile) != myUString) {
293 u_austrncpy(myString, u_fgets(myUString, UPRV_LENGTHOF(myUString), myFile),
299 if (u_feof(myFile)) {
302 u_austrncpy(myString, u_fgets(myUString, UPRV_LENGTHOF(myUString), myFile),
307 if (!u_feof(myFile)) {
310 if (u_fscanf(myFile, "%S\n", myUString) != 0) {
314 u_fclose(myFile);
366 UFILE *myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, NULL);
367 if (myFile == NULL) {
371 if (u_fgetcodepage(myFile) == NULL
372 || strcmp(u_fgetcodepage(myFile), ucnv_getDefaultName()) != 0)
375 u_fgetcodepage(myFile), ucnv_getDefaultName());
378 if (u_fgetlocale(myFile) == NULL
379 || strcmp(u_fgetlocale(myFile), uloc_getDefault()) != 0)
382 u_fgetlocale(myFile), uloc_getDefault());
385 u_fclose(myFile);
387 myFile = u_fopen(STANDARD_TEST_FILE, "w", "es", NULL);
388 if (u_fgetcodepage(myFile) == NULL
389 || strcmp(u_fgetcodepage(myFile), ucnv_getDefaultName()) != 0)
392 u_fgetcodepage(myFile));
395 if (u_fgetlocale(myFile) == NULL
396 || strcmp(u_fgetlocale(myFile), "es") != 0)
399 u_fgetlocale(myFile), "es");
402 u_fclose(myFile);
404 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-16");
405 if (u_fgetcodepage(myFile) == NULL
406 || strcmp(u_fgetcodepage(myFile), "UTF-16") != 0)
409 u_fgetcodepage(myFile));
412 if (u_fgetlocale(myFile) == NULL
413 || strcmp(u_fgetlocale(myFile), uloc_getDefault()) != 0)
416 u_fgetlocale(myFile), uloc_getDefault());
419 u_fclose(myFile);
421 myFile = u_fopen(STANDARD_TEST_FILE, "w", "zh", "UTF-16");
422 if (u_fgetcodepage(myFile) == NULL
423 || strcmp(u_fgetcodepage(myFile), "UTF-16") != 0)
426 u_fgetcodepage(myFile));
429 if (u_fgetlocale(myFile) == NULL
430 || strcmp(u_fgetlocale(myFile), "zh") != 0)
433 u_fgetlocale(myFile), "zh");
436 u_fclose(myFile);
444 UFILE *myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-16");
449 if (myFile == NULL) {
454 u_fputc(0x3BC, myFile);
455 if (u_fputc(0x110000, myFile) != U_EOF) {
458 if (u_fputc((UChar32)0xFFFFFFFFu, myFile) != U_EOF) {
461 u_fputc(0xFF41, myFile);
466 u_file_write(buffer, expectedSize, myFile);
469 u_fclose(myFile);
472 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "UTF-16");
473 if (u_fgetc(myFile) != 0x3BC) {
476 if (u_fgetc(myFile) != 0xFF41) {
479 if (u_fgets(buffer, UPRV_LENGTHOF(buffer), myFile) != buffer) {
493 if (strcmp(u_fgetcodepage(myFile), "UTF-16") != 0) {
494 log_err("Got %s instead of UTF-16\n", u_fgetcodepage(myFile));
496 u_fclose(myFile);
500 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-8");
502 u_fputc(0x3BC, myFile);
503 u_fputc(0xFF41, myFile);
508 u_file_write(buffer, expectedSize, myFile);
511 u_fclose(myFile);
514 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "UTF-8");
515 if (strcmp(u_fgetcodepage(myFile), "UTF-8") != 0) {
516 log_err("Got %s instead of UTF-8\n", u_fgetcodepage(myFile));
518 if (u_fgetc(myFile) != 0x3BC) {
521 if (u_fgetc(myFile) != 0xFF41) {
524 if (u_fgets(buffer, UPRV_LENGTHOF(buffer), myFile) != buffer) {
538 u_fclose(myFile);
543 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-8");
545 u_fputc(0xFF41, myFile);
550 u_file_write(buffer, expectedSize, myFile);
553 u_fclose(myFile);
556 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "UTF-8");
557 if (u_fgets(buffer, 2, myFile) != buffer) {
571 u_fclose(myFile);
577 UFILE *myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-16");
583 u_file_write(buffer, UPRV_LENGTHOF(buffer), myFile);
586 u_fclose(myFile);
588 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "UTF-16");
589 how_many = u_file_read(buffer, 1024, myFile);
593 u_fclose(myFile);
601 UFILE *myFile = NULL;
621 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, NULL);
630 returnedUCharBuffer = u_fgets(buffer, UPRV_LENGTHOF(buffer), myFile);
653 u_fclose(myFile);
690 UFILE *myFile = NULL;
693 myFile = u_fopen(STANDARD_TEST_FILE, "wb", NULL, "UTF-8");
694 if (myFile == NULL) {
699 u_file_write(testUStr[lineIdx], u_strlen(testUStr[lineIdx]), myFile);
701 u_fclose(myFile);
703 myFile = u_fopen(STANDARD_TEST_FILE, "rb", NULL, "UTF-8");
709 returnedUCharBuffer = u_fgets(buffer, UPRV_LENGTHOF(buffer), myFile);
725 if (u_fgets(buffer, UPRV_LENGTHOF(buffer), myFile) != NULL) {
728 u_fclose(myFile);
737 UFILE *myFile = NULL;
751 myFile = u_fopen(STANDARD_TEST_FILE, "rb", NULL, NULL);
752 if (myFile == NULL) {
759 returnedUCharBuffer = u_fgets(buffer, UPRV_LENGTHOF(buffer), myFile);
768 returnedUCharBuffer = u_fgets(buffer, UPRV_LENGTHOF(buffer), myFile);
784 u_fclose(myFile);
801 UFILE *myFile = NULL;
816 myFile = u_fopen(STANDARD_TEST_FILE, "rb", NULL, NULL);
817 if (myFile == NULL) {
823 returnedUCharBuffer = u_fgets(buffer, UPRV_LENGTHOF(buffer)-1, myFile);
833 u_fclose(myFile);
838 UFILE *myFile = NULL;
846 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "absurd converter that can't be opened");
848 if (myFile) {
850 u_fclose(myFile);
853 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "ISO-8859-1");
854 if (myFile == NULL) {
858 if (strcmp("ISO-8859-1", u_fgetcodepage(myFile)) != 0) {
861 u_file_write(strABAccentA, u_strlen(strABAccentA), myFile);
862 u_fclose(myFile);
865 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, NULL);
866 if (u_fsetcodepage("ISO-8859-1", myFile) != 0) {
869 retVal = u_file_read(testBuf, u_strlen(strABAccentA), myFile);
876 u_fclose(myFile);
879 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "ISO-8859-1");
880 if (strcmp(ucnv_getName(u_fgetConverter(myFile), &status), "ISO-8859-1") != 0) {
881 log_err("u_fgetConverter returned %s\n", ucnv_getName(u_fgetConverter(myFile), &status));
883 if (u_fsetcodepage("UTF-8", myFile) != 0) {
886 if (strcmp(ucnv_getName(u_fgetConverter(myFile), &status), "UTF-8") != 0) {
887 log_err("u_fgetConverter returned %s\n", ucnv_getName(u_fgetConverter(myFile), &status));
889 retVal = u_file_read(testBuf, u_strlen(strBadConversion), myFile);
893 u_fclose(myFile);
896 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "ISO-8859-1");
897 strcpy(convName, u_fgetcodepage(myFile));
898 u_file_read(testBuf, 1, myFile);
899 if (u_fsetcodepage("UTF-8", myFile) == 0) {
902 retVal = u_file_read(testBuf + 1, u_strlen(strABAccentA) - 1, myFile);
909 u_frewind(myFile);
910 retVal = u_file_read(testBuf, u_strlen(strABAccentA), myFile);
917 u_fclose(myFile);
929 UFILE *myFile = u_fopen(STANDARD_TEST_FILE, "wb", STANDARD_TEST_LOCALE, enc);
934 if (myFile == NULL) {
939 u_fprintf(myFile, "%S", utf16String);
940 u_fclose(myFile);
986 UFILE *myFile = u_fopen(STANDARD_TEST_FILE, "wb", STANDARD_TEST_LOCALE, NULL);
995 if (myFile == NULL) {
1000 if (strcmp(u_fgetlocale(myFile), STANDARD_TEST_LOCALE) != 0) {
1001 log_err("Got %s instead of en_US_POSIX for locale\n", u_fgetlocale(myFile));
1007 u_fprintf(myFile, "%x ", num);
1008 u_fprintf(myFile, "%X ", num);
1009 u_fprintf(myFile, "%o ", num);
1010 u_fprintf(myFile, "%d ", num);
1011 u_fprintf(myFile, "%i ", num);
1012 u_fprintf(myFile, "%f ", (double)num);
1013 /* u_fprintf(myFile, "%e ", (double)num);
1014 u_fprintf(myFile, "%E ", (double)num);*/
1015 u_fprintf(myFile, "%g ", (double)num);
1016 u_fprintf(myFile, "%G", (double)num);
1017 u_fputs(emptyStr, myFile);
1020 u_fprintf_u(myFile, NEW_LINE);
1023 u_fprintf(myFile, "%c", num);
1026 u_fclose(myFile);
1124 myFile = u_fopen(STANDARD_TEST_FILE, "w", STANDARD_TEST_LOCALE, NULL);\
1125 if (myFile == NULL) {\
1133 uNumPrinted = u_fprintf(myFile, uFormat, uValue);\
1134 u_fclose(myFile);\
1135 myFile = u_fopen(STANDARD_TEST_FILE, "r", STANDARD_TEST_LOCALE, NULL);\
1136 u_fgets(uBuffer, UPRV_LENGTHOF(uBuffer), myFile);\
1137 u_fclose(myFile);\
1159 UFILE *myFile;
1266 myFile = u_fopen(STANDARD_TEST_FILE, "w", STANDARD_TEST_LOCALE, NULL);
1271 uNumPrinted = u_fprintf(myFile, "%d % d %d", -1234, 1234, 1234);
1272 u_fclose(myFile);
1273 myFile = u_fopen(STANDARD_TEST_FILE, "r", STANDARD_TEST_LOCALE, NULL);
1274 u_fgets(uBuffer, UPRV_LENGTHOF(uBuffer), myFile);
1275 u_fclose(myFile);
1294 UFILE *myFile;
1301 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, NULL);
1302 if (myFile == NULL) {
1312 u_fprintf(myFile, "%S", uValue);
1313 u_fclose(myFile);
1314 myFile = u_fopen(STANDARD_TEST_FILE, "r", STANDARD_TEST_LOCALE, NULL);
1315 uNumScanned = u_fscanf(myFile, format, uBuffer);
1316 u_fclose(myFile);
1384 UFILE *myFile;
1388 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, NULL);
1389 if (myFile == NULL) {
1397 u_fprintf(myFile, "%S", uValue);
1398 u_fclose(myFile);
1399 myFile = u_fopen(STANDARD_TEST_FILE, "r", STANDARD_TEST_LOCALE, NULL);
1400 uNumScanned = u_fscanf(myFile, format, uBuffer);
1401 u_fclose(myFile);
1421 UFILE *myFile;
1423 myFile = u_fopen(STANDARD_TEST_FILE, "w", STANDARD_TEST_LOCALE, "UTF-8");
1424 if (!myFile) {
1430 count = u_vfprintf(myFile, format, ap);
1434 u_fclose(myFile);
1437 myFile = u_fopen(STANDARD_TEST_FILE, "r", STANDARD_TEST_LOCALE, "UTF-8");
1438 if (!myFile) {
1442 u_fgets(uBuffer, UPRV_LENGTHOF(uBuffer), myFile);
1447 u_fclose(myFile);
1450 myFile = u_fopen(STANDARD_TEST_FILE, "w", STANDARD_TEST_LOCALE, NULL);
1451 if (!myFile) {
1458 count = u_vfprintf_u(myFile, uBuffer, ap);
1461 u_fclose(myFile);
1464 myFile = u_fopen(STANDARD_TEST_FILE, "r", STANDARD_TEST_LOCALE, NULL);
1465 if (!myFile) {
1469 u_fgets(uBuffer, UPRV_LENGTHOF(uBuffer), myFile);
1474 u_fclose(myFile);
1487 UFILE *myFile;
1493 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-8");
1494 if (!myFile) {
1498 u_fprintf_u(myFile, PERCENT_S, TEST_STR);
1499 u_fclose(myFile);
1501 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "UTF-8");
1502 if (!myFile) {
1506 u_fscanf_u(myFile, PERCENT_S, myUString);
1507 u_fclose(myFile);
1516 UFILE * myFile;
1532 myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, a_pszEncoding);
1533 if (!myFile) {
1539 count = u_file_write(buffer, expected, myFile);
1540 u_fclose(myFile);
1551 myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, a_pszEncoding);
1552 if (!myFile) {
1557 UChar gotChar = u_fgetc(myFile);
1560 u_fclose(myFile);
1564 if (u_fgetc(myFile) != U_EOF) {
1566 u_fclose(myFile);
1569 u_fclose(myFile);