18 Commits

Author SHA1 Message Date
Sebastian Pipping
94cceb228c tests: Address clang-tidy warning bugprone-narrowing-conversions
The symptom was:
> [..]/expat/tests/alloc_tests.c:326:26: error: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>   326 |     g_allocation_count = i;
>       |                          ^
> [..]/expat/tests/alloc_tests.c:437:26: error: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>   437 |     g_allocation_count = i;
>       |                          ^

> [..]/expat/tests/basic_tests.c:415:47: error: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>   415 |   if (_XML_Parse_SINGLE_BYTES(g_parser, text, first_chunk_bytes, XML_FALSE)
>       |                                               ^
> [..]/expat/tests/basic_tests.c:421:34: error: narrowing conversion from 'unsigned long' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>   421 |                                  sizeof(text) - first_chunk_bytes - 1,
>       |                                  ^

> [..]/expat/tests/handlers.c:92:37: error: narrowing conversion from 'XML_Size' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    92 |   StructData_AddItem(storage, name, XML_GetCurrentColumnNumber(g_parser),
>       |                                     ^
> [..]/expat/tests/handlers.c:93:22: error: narrowing conversion from 'XML_Size' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    93 |                      XML_GetCurrentLineNumber(g_parser), STRUCT_START_TAG);
>       |                      ^
> [..]/expat/tests/handlers.c:99:37: error: narrowing conversion from 'XML_Size' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    99 |   StructData_AddItem(storage, name, XML_GetCurrentColumnNumber(g_parser),
>       |                                     ^
> [..]/expat/tests/handlers.c💯22: error: narrowing conversion from 'XML_Size' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>   100 |                      XML_GetCurrentLineNumber(g_parser), STRUCT_END_TAG);
>       |                      ^
> [..]/expat/tests/handlers.c:1279:26: error: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>  1279 |     g_allocation_count = i;
>       |                          ^

> [..]/expat/tests/misc_tests.c:73:26: error: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    73 |     g_allocation_count = i;
>       |                          ^
> [..]/expat/tests/misc_tests.c:93:26: error: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    93 |     g_allocation_count = i;
>       |                          ^

> [..]/expat/tests/nsalloc_tests.c:86:26: error: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    86 |     g_allocation_count = i;
>       |                          ^
> [..]/expat/tests/nsalloc_tests.c:526:28: error: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>   526 |     g_reallocation_count = i;
>       |                            ^
2025-03-30 18:52:09 +02:00
Sebastian Pipping
bbd413a808 Sync file headers 2025-03-13 14:01:31 +01:00
Berkay Eren Ürün
66b695f150 Increase coverage for parameter entity refs in doProlog 2025-03-13 14:01:31 +01:00
Sebastian Pipping
2a10e173ab Sync file headers 2024-02-06 14:13:00 +01:00
Sebastian Pipping
3e5f6d6601 tests: Migrate more tests to variable chunk size parsing 2023-11-09 20:27:20 +01:00
Sebastian Pipping
00089ed745 tests: Fix tests for XML_GE==0 + broaden for XML_GE==1 2023-11-06 20:43:09 +01:00
Snild Dolkow
7b0e27a698 tests: Replace invalid entity expansion in test_alloc_nested_entities
%pe2; would ultimately expand to a plain "ABCDEF...", which is not
valid in this context. This was not normally hit, since the test would
get its expected XML_ERROR_NO_MEMORY before expanding this far.

With g_chunkSize=0 and EXPAT_CONTEXT_BYTES=OFF, the number of allocs
required to reach that point becomes *just* low enough to reach the
final expansion, making the test fail with a very unexpected syntax
error.

Nesting %pe2; in another entity declaration avoids the problem.
2023-09-28 13:49:41 +02:00
Donghee Na
e52b6b8b8c Update legal name of Donghee Na (#754) 2023-09-24 18:13:03 +02:00
Rhodri James
8d2b621dcd Move final allocation test out of runtests.c and tidy up 2022-11-01 10:58:46 +00:00
Rhodri James
156eabde7d Move most remaining allocation tests out of runtests.c 2022-10-31 17:48:11 +00:00
Rhodri James
ef34e67014 Move more alloc tests out of runtests.c
Also eliminates the last (ab)used of intptr_t
2022-10-31 17:43:59 +00:00
Rhodri James
8000770127 Move a bunch more allocation tests out of runtests.c 2022-10-31 17:38:41 +00:00
Rhodri James
b81eca3052 Move test_alloc_external_entity out of runtests.c
Again modify slightly to avoid use of intptr_t
2022-10-31 17:32:38 +00:00
Rhodri James
639cb93f78 Move test_alloc_dtd_copy_default_atts outof runtests.c
Modify the test and handler slightly to avoid abusing UserData to
pass an integer to the handler instead of a pointer.  Mostly this
just avoids including stdint.h
2022-10-31 17:13:09 +00:00
Rhodri James
4c6d77c368 Move basic failing-allocator entity tests out of runtests.c 2022-10-31 17:03:07 +00:00
Rhodri James
932748bf1b Move remaining declaration, comment and PI tests out of runtests.c 2022-10-31 16:57:03 +00:00
Rhodri James
e827f83974 Move first allocation test out of runtests.c 2022-10-31 16:36:21 +00:00
Rhodri James
badcbe21f7 Move framework for allocation tests to new alloc_tests.c
Note that the alloc_setup and alloc_teardown functions are
not static for the moment, since they will be required in both
alloc_tests.c and runtests.c until the test case move is complete.
2022-10-31 16:32:54 +00:00