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
..
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2025-03-27 17:45:25 +01:00
2024-02-06 14:13:00 +01:00
2023-09-24 18:13:03 +02:00
2023-09-24 18:13:03 +02:00
2024-02-06 14:13:00 +01:00
2024-09-03 18:19:25 +02:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2025-03-13 20:41:33 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2024-02-06 14:13:00 +01:00
2025-03-13 20:41:33 +01:00

This directory contains the test suite for Expat. The tests provide general unit testing and regression coverage. The tests are not expected to be useful examples of Expat usage; see the examples directory for that.

The Expat tests use a partial internal implementation of the Check unit testing framework for C.

Expat must be built and, on some platforms, installed, before the tests can be run.