Next: , Previous: , Up: conditions assertion   [Contents][Index]


8.6.3 Expected ASCIIZ assertions

The expected ASCIIZ assertion exceptional–condition object–type is used by CCTests to signal failure in an asserting that an ASCIIZ string was expected as result of an expression. We can only derive new types from it, not instantiate it. To catch this exceptional condition we can do:

cce_location_t        L[1];

if (cce_location(L)) {
  if (cctests_condition_is_assertion_expected_asciiz(cce_condition(L))) {
    CCTESTS_PC(cctests_condition_assertion_expected_asciiz_t, C, cce_condition(L));
    do_something_with(C);
  }
  cce_run_catch_handlers_final(L);
} else {
  do_something(L);
  cce_run_body_handlers(L);
}
Struct Typedef: cctests_descriptor_assertion_expected_asciiz_t

Type of data structure representing the exceptional–condition descriptor. It has the following public fields:

cce_descriptor_t descriptor

The condition descriptor’s base values.

The parent of this type descriptor is the one referenced by cctests_descriptor_assertion_expected_value_ptr, Expected value assertions.

Struct Typedef: cctests_condition_assertion_expected_asciiz_t

Type of data structure representing the exceptional–condition object. It has the following public fields:

cctests_condition_assertion_expected_value_t assertion_expected_value

The base value.

char * expected

A copy of the expected value, an ASCIIZ string. This object is responsible for the memory allocation.

char * result

A copy of the resulting value, an ASCIIZ string. This object is responsible for the memory allocation.

Function: void cce_descriptor_set_parent_to(cctests_condition_assertion_expected_asciiz_t) (cce_descriptor_t * const D)

Set the parent of the descriptor referenced by D to the descriptor of the exceptional–condition object–type cctests_condition_assertion_expected_asciiz_t.

Function: void cctests_condition_init_assertion_expected_asciiz (cce_destination_t L, cctests_condition_assertion_expected_asciiz_t * C, char const * expected, char const * result, char const * expr, char const * filename, char const * funcname, int linenum, char const * message)

Initialisation function for the condition object. This function is meant to be called from the initialisation function of sub–types of cctests_condition_assertion_expected_asciiz_t. If an error occurs building the instance: raise an exception by performing a non–local exit to L.

The strings referenced by expr, filename, funcname are not duplicated. The strings referenced by expected and result are duplicated. The argument message is either NULL or a pointer to an ASCIIZ message string allocated using the standard allocator; the ownership of this string is transferred to the exceptional–condition object.

Function: void cctests_condition_new_assertion_expected_asciiz (cce_destination_t L, cctests_condition_assertion_expected_asciiz_t * C, char const * expected, char const * result, char const * expr, char const * filename, char const * funcname, int linenum, char const * message)

Build and return a new exceptional condition object. If an error occurs building the instance: raise an exception by performing a non–local exit to L.

The strings referenced by expr, filename, funcname are not duplicated. The strings referenced by expected and result are duplicated. The argument message is either NULL or a pointer to an ASCIIZ message string allocated using the standard allocator; the ownership of this string is transferred to the exceptional–condition object.

Function: bool cctests_condition_is_assertion_expected_asciiz (cce_condition_t const * C)

Return true if C if of type cctests_condition_assertion_expected_asciiz_t; otherwise return false.


Next: , Previous: , Up: conditions assertion   [Contents][Index]

This document describes version 0.4.1-devel.1 of CCTests.