ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_rabook_xml_shim_test_internal.h File Reference

Test-only seams for post-validation XML reader faults. More...

#include <stddef.h>
#include <stdint.h>
#include "ra8_attributes.h"
#include "ra8_err.h"
#include "ra8_rabook_xml_shim.h"
#include "rabook_compile.h"
Include dependency graph for ra8_rabook_xml_shim_test_internal.h:

Go to the source code of this file.

Functions

ra8_err_t priv_ra8_rabook_xml_select_unvalidated_test (const uint8_t *source, size_t source_len, ra8_rabook_xml_workspace_t *workspace)
 Run the XML subtree-selection pass without public validation.
ra8_err_t priv_ra8_rabook_xml_emit_unvalidated_test (const uint8_t *source, size_t source_len, ra8_rabook_ctx_t *ctx, ra8_rabook_xml_workspace_t *workspace)
 Run XML subtree emission without public validation or rollback.

Detailed Description

Test-only seams for post-validation XML reader faults.

Declares the bounded selection and emission entry points used to force second-pass reader failures after the public first-pass validator would otherwise reject the source.

Since
Version 0.1.0

Definition in file ra8_rabook_xml_shim_test_internal.h.

Function Documentation

◆ priv_ra8_rabook_xml_emit_unvalidated_test()

ra8_err_t priv_ra8_rabook_xml_emit_unvalidated_test ( const uint8_t * source,
size_t source_len,
ra8_rabook_ctx_t * ctx,
ra8_rabook_xml_workspace_t * workspace )

Run XML subtree emission without public validation or rollback.

Drives emission from source offset zero at depth zero with a fresh pull reader. It deliberately omits the public validation and checkpoint restoration so a UNIT_TEST build can observe a failure that occurs after the selected root has begun emission.

Parameters
[in]sourceImmutable XML bytes, or nullptr for reader validation.
[in]source_lenExact readable extent of source in bytes.
[in,out]ctxActive bounded RABOOK builder receiving emitted nodes.
[in,out]workspaceExclusive XML reader and emission workspace.
Returns
Repository status from reader initialisation, traversal, or emission.
Return values
k_ra8_okThe selected root was consumed without a reader error.
k_ra8_err_null_ptrsource was nullptr.
k_ra8_err_invalid_sizesource_len was zero or exceeded UINT32_MAX.
k_ra8_err_no_memBounded builder capacity was exhausted.
k_ra8_err_validation_failedXML traversal failed.
Precondition
ctx and workspace are non-null, initialized, and exclusive.
A non-null source spans exactly source_len readable bytes.
Postcondition
source is unchanged on every result.
ctx may retain partial emission and workspace remains scratch; this narrow seam intentionally performs no public rollback.
Note
Test-only and not thread-safe for shared builder or workspace state.
MC/DC:
This seam bypasses the successful public validation prerequisite so tests can force the second-pass reader-error legs in internal_emit().
Since
Version 0.1.0

◆ priv_ra8_rabook_xml_select_unvalidated_test()

ra8_err_t priv_ra8_rabook_xml_select_unvalidated_test ( const uint8_t * source,
size_t source_len,
ra8_rabook_xml_workspace_t * workspace )

Run the XML subtree-selection pass without public validation.

Initialises a fresh pull reader over the supplied bytes and drives the post-validation selection logic. The selected coordinates are intentionally discarded; the seam exists only to verify defensive reader-failure propagation in a UNIT_TEST build.

Parameters
[in]sourceImmutable XML bytes, or nullptr for reader validation.
[in]source_lenExact readable extent of source in bytes.
[in,out]workspaceExclusive XML reader workspace.
Returns
Repository status from reader initialisation, traversal, or selection.
Return values
k_ra8_okSelection reached a clean end or selected a direct body.
k_ra8_err_null_ptrsource was nullptr.
k_ra8_err_invalid_sizesource_len was zero or exceeded UINT32_MAX.
k_ra8_err_validation_failedXML traversal or the bounded direct-child search failed.
Precondition
workspace is non-null and not shared with another live reader.
A non-null source spans exactly source_len readable bytes.
Postcondition
source is unchanged on every result.
workspace contains only scratch state from the completed or failed pass.
Note
Test-only and not thread-safe for a shared workspace.
MC/DC:
This seam bypasses the successful public validation prerequisite so tests can force the second-pass reader-error legs in internal_select().
Since
Version 0.1.0

References RA8_NODISCARD, and RA8_TEST_HELPER.