|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Go to the source code of this file.
Data Structures | |
| struct | tl_state |
| The state of the library; all of it between two guard words. More... | |
| struct | tl_run |
| struct | tl_run_text |
Macros | |
| #define | TL_LINE 512 /* the longest entry */ |
| #define | TL_PENDING 1024 /* entries kept while they cannot be written */ |
| #define | TL_GUARD_LO 0x544C7374UL /* "TLst" */ |
| #define | TL_GUARD_HI 0x7473544CUL /* "tsTL" */ |
| #define | TL_RUN_TEXT 1024 /* the bytes of the output printed holds */ |
Enumerations | |
| enum | { TL_NONE = 0 , TL_INIT = BASICTEST_BLOCK_INIT + 1 , TL_CASE = BASICTEST_BLOCK_CASE + 1 , TL_FINAL = BASICTEST_BLOCK_FINAL + 1 } |
| The open block (enum basictest_block + 1; TL_NONE: none). More... | |
Functions | |
| void | tl_os_write (const uint8_t *data, size_t length) |
| int | tl_os_can_write (void) |
| int | tl_os_fltnear (uint32_t expected, uint32_t actual, uint32_t delta) |
| void | tl_begin (struct tl_state *st) |
| Clears the state and writes begin. | |
| int | tl_block (struct tl_state *st, int block, const uint8_t *name, size_t length) |
| Opens a block (block: enum basictest_block; name and length: the case name, ignored for the batch init and end). | |
| void | tl_blockend (struct tl_state *st) |
| Closes the open block. | |
| void | tl_check (struct tl_state *st, uint32_t k, uint32_t expected, uint32_t actual) |
| A check of two longs: ok if they are equal. | |
| void | tl_checkq (struct tl_state *st, uint32_t k, uint32_t expected, uint32_t actual) |
| A check of two quicks (their 32 bits): ok if they are equal. | |
| void | tl_checkflt (struct tl_state *st, uint32_t k, uint32_t expected, uint32_t actual, uint32_t delta) |
| A check of two FFP floats: ok if |actual-expected| <= delta. | |
| void | tl_checkstr (struct tl_state *st, uint32_t k, const uint8_t *expected, size_t expected_length, const uint8_t *actual, size_t actual_length) |
| A check of two strings (bytes): ok if they are equal. | |
| int | tl_require (struct tl_state *st, uint32_t k, uint32_t condition) |
| A precondition. | |
| void | tl_expect_error (struct tl_state *st, uint32_t k) |
| The announcement of an expected runtime error. | |
| void | tl_finit (struct tl_state *st) |
| The end of the run: kept entries, incomplete if a block is open, end. | |
| int | tl_run_start (struct tl_state *st, uint32_t k, struct tl_run *r, struct tl_run_text *t) |
| A program is to start (TLRunProgram): the result r and its text t cleared (rc 0, unknown, nothing printed: printed the empty string), and run K written if it may start. | |
| void | tl_run_end (struct tl_state *st, uint32_t k, struct tl_run *r, struct tl_run_text *t, int known, int32_t rc, size_t n, uint32_t size) |
| The program ended (after tl_run_start gave 1): its output's first n bytes are in t->chars (n <= TL_RUN_TEXT), size the whole output; the result filled (printed of n bytes and a 0 behind, cut if size > n) and runend K written with rc if known, else -. | |
| #define TL_GUARD_HI 0x7473544CUL /* "tsTL" */ |
| #define TL_GUARD_LO 0x544C7374UL /* "TLst" */ |
| #define TL_LINE 512 /* the longest entry */ |
| #define TL_PENDING 1024 /* entries kept while they cannot be written */ |
| anonymous enum |
| void tl_begin | ( | struct tl_state * | st | ) |
Clears the state and writes begin.
| int tl_block | ( | struct tl_state * | st, |
| int | block, | ||
| const uint8_t * | name, | ||
| size_t | length ) |
Opens a block (block: enum basictest_block; name and length: the case name, ignored for the batch init and end).
| void tl_blockend | ( | struct tl_state * | st | ) |
Closes the open block.
| void tl_check | ( | struct tl_state * | st, |
| uint32_t | k, | ||
| uint32_t | expected, | ||
| uint32_t | actual ) |
A check of two longs: ok if they are equal.
| void tl_checkflt | ( | struct tl_state * | st, |
| uint32_t | k, | ||
| uint32_t | expected, | ||
| uint32_t | actual, | ||
| uint32_t | delta ) |
A check of two FFP floats: ok if |actual-expected| <= delta.
| void tl_checkq | ( | struct tl_state * | st, |
| uint32_t | k, | ||
| uint32_t | expected, | ||
| uint32_t | actual ) |
A check of two quicks (their 32 bits): ok if they are equal.
| void tl_checkstr | ( | struct tl_state * | st, |
| uint32_t | k, | ||
| const uint8_t * | expected, | ||
| size_t | expected_length, | ||
| const uint8_t * | actual, | ||
| size_t | actual_length ) |
A check of two strings (bytes): ok if they are equal.
| void tl_expect_error | ( | struct tl_state * | st, |
| uint32_t | k ) |
The announcement of an expected runtime error.
| void tl_finit | ( | struct tl_state * | st | ) |
The end of the run: kept entries, incomplete if a block is open, end.
| int tl_os_can_write | ( | void | ) |
| int tl_os_fltnear | ( | uint32_t | expected, |
| uint32_t | actual, | ||
| uint32_t | delta ) |
| void tl_os_write | ( | const uint8_t * | data, |
| size_t | length ) |
| int tl_require | ( | struct tl_state * | st, |
| uint32_t | k, | ||
| uint32_t | condition ) |
A precondition.
| void tl_run_end | ( | struct tl_state * | st, |
| uint32_t | k, | ||
| struct tl_run * | r, | ||
| struct tl_run_text * | t, | ||
| int | known, | ||
| int32_t | rc, | ||
| size_t | n, | ||
| uint32_t | size ) |
The program ended (after tl_run_start gave 1): its output's first n bytes are in t->chars (n <= TL_RUN_TEXT), size the whole output; the result filled (printed of n bytes and a 0 behind, cut if size > n) and runend K written with rc if known, else -.
| int tl_run_start | ( | struct tl_state * | st, |
| uint32_t | k, | ||
| struct tl_run * | r, | ||
| struct tl_run_text * | t ) |
A program is to start (TLRunProgram): the result r and its text t cleared (rc 0, unknown, nothing printed: printed the empty string), and run K written if it may start.