| OLD | NEW |
| 1 #include <string.h> | 1 #include <string.h> |
| 2 #include <libxml/parser.h> | 2 #include <libxml/parser.h> |
| 3 #include <libxml/dict.h> | 3 #include <libxml/dict.h> |
| 4 | 4 |
| 5 /* #define WITH_PRINT */ | 5 /* #define WITH_PRINT */ |
| 6 | 6 |
| 7 static const char *seeds1[] = { | 7 static const char *seeds1[] = { |
| 8 "a", "b", "c", | 8 "a", "b", "c", |
| 9 "d", "e", "f", | 9 "d", "e", "f", |
| 10 "g", "h", "i", | 10 "g", "h", "i", |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 /* | 270 /* |
| 271 * check the QName lookups | 271 * check the QName lookups |
| 272 */ | 272 */ |
| 273 for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { | 273 for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { |
| 274 cur = strings2[i]; | 274 cur = strings2[i]; |
| 275 pref = &prefix[0]; | 275 pref = &prefix[0]; |
| 276 while (*cur != ':') *pref++ = *cur++; | 276 while (*cur != ':') *pref++ = *cur++; |
| 277 cur++; | 277 cur++; |
| 278 *pref = 0; | 278 *pref = 0; |
| 279 tmp = xmlDictQLookup(dict, &prefix[0], cur); | 279 tmp = xmlDictQLookup(dict, &prefix[0], cur); |
| 280 » if (xmlDictQLookup(dict, &prefix[0], cur) != test2[i]) { | 280 » if (tmp != test2[i]) { |
| 281 fprintf(stderr, "Failed lookup check for '%s':'%s'\n", | 281 fprintf(stderr, "Failed lookup check for '%s':'%s'\n", |
| 282 &prefix[0], cur); | 282 &prefix[0], cur); |
| 283 ret = 1; | 283 ret = 1; |
| 284 nbErrors++; | 284 nbErrors++; |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 /* | 287 /* |
| 288 * check the QName lookups for strings from the parent | 288 * check the QName lookups for strings from the parent |
| 289 */ | 289 */ |
| 290 for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { | 290 for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 /* | 401 /* |
| 402 * More complex, check the QName lookups | 402 * More complex, check the QName lookups |
| 403 */ | 403 */ |
| 404 for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { | 404 for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { |
| 405 cur = strings1[i]; | 405 cur = strings1[i]; |
| 406 pref = &prefix[0]; | 406 pref = &prefix[0]; |
| 407 while (*cur != ':') *pref++ = *cur++; | 407 while (*cur != ':') *pref++ = *cur++; |
| 408 cur++; | 408 cur++; |
| 409 *pref = 0; | 409 *pref = 0; |
| 410 tmp = xmlDictQLookup(dict, &prefix[0], cur); | 410 tmp = xmlDictQLookup(dict, &prefix[0], cur); |
| 411 » if (xmlDictQLookup(dict, &prefix[0], cur) != test1[i]) { | 411 » if (tmp != test1[i]) { |
| 412 fprintf(stderr, "Failed lookup check for '%s':'%s'\n", | 412 fprintf(stderr, "Failed lookup check for '%s':'%s'\n", |
| 413 &prefix[0], cur); | 413 &prefix[0], cur); |
| 414 ret = 1; | 414 ret = 1; |
| 415 nbErrors++; | 415 nbErrors++; |
| 416 } | 416 } |
| 417 } | 417 } |
| 418 | 418 |
| 419 run_test2(dict); | 419 run_test2(dict); |
| 420 | 420 |
| 421 xmlDictFree(dict); | 421 xmlDictFree(dict); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 435 if (ret == 0) { | 435 if (ret == 0) { |
| 436 printf("dictionary tests succeeded %d strings\n", 2 * NB_STRINGS_MAX); | 436 printf("dictionary tests succeeded %d strings\n", 2 * NB_STRINGS_MAX); |
| 437 } else { | 437 } else { |
| 438 printf("dictionary tests failed with %d errors\n", nbErrors); | 438 printf("dictionary tests failed with %d errors\n", nbErrors); |
| 439 } | 439 } |
| 440 clean_strings(); | 440 clean_strings(); |
| 441 xmlCleanupParser(); | 441 xmlCleanupParser(); |
| 442 xmlMemoryDump(); | 442 xmlMemoryDump(); |
| 443 return(ret); | 443 return(ret); |
| 444 } | 444 } |
| OLD | NEW |