|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | basictest_str |
| A string value: bytes, any value, not 0-terminated. More... | |
| struct | basictest_entry |
| One entry. Only the members of its kind count: begin version block block, name (BASICTEST_BLOCK_CASE) check k, ok, expected, actual checkq k, ok, expected, actual (the quicks' bits) checkflt k, ok, expected, actual, delta (the floats' FFP bits) checkstr k, ok, expected_str, expected_length, expected_crc, actual_str, actual_length, actual_crc, cut require k (always broken) expect-error k broken reason run k runend k, ok (1: the return code is known), actual (it). More... | |
| struct | basictest_error |
| The reader's error: line, reason, field (1 = the entry name) and the entry name as it stands in the line (valid while the line is). More... | |
Macros | |
| #define | BASICTEST_VERSION 1 |
| The format version the codec writes and reads (begin). | |
Enumerations | |
| enum | basictest_kind { BASICTEST_BEGIN , BASICTEST_BLOCK , BASICTEST_CHECK , BASICTEST_CHECKSTR , BASICTEST_REQUIRE , BASICTEST_EXPECT_ERROR , BASICTEST_BLOCKEND , BASICTEST_BROKEN , BASICTEST_INCOMPLETE , BASICTEST_END , BASICTEST_CHECKQ , BASICTEST_CHECKFLT , BASICTEST_RUN , BASICTEST_RUNEND } |
| The entry kinds. More... | |
| enum | basictest_block { BASICTEST_BLOCK_INIT , BASICTEST_BLOCK_CASE , BASICTEST_BLOCK_FINAL } |
| The blocks of a block entry. More... | |
| enum | basictest_err { BASICTEST_OK , BASICTEST_E_KIND , BASICTEST_E_FIELDS , BASICTEST_E_VALUE , BASICTEST_E_VERSION } |
| Why the reader refused a line (BASICTEST_OK = 0). More... | |
Functions | |
| size_t | basictest_write (const struct basictest_entry *e, uint8_t *buf, size_t size) |
| Writes the line of an entry, with its LF, to buf. | |
| size_t | basictest_decimal (uint32_t v, uint8_t *buf) |
| Writes v in decimal (no sign, no leading zero) to buf, which has room for 10 bytes; the writer's and the error text's helper. | |
| uint32_t | basictest_crc32 (const uint8_t *data, size_t length) |
| The CRC32 of a string value: the standard CRC-32 of IEEE 802.3 (zlib, PNG; the polynomial $EDB88320 reflected, $FFFFFFFF at the start and XORed at the end); $CBF43926 for "123456789", 0 for none. | |
| int | basictest_read (uint8_t *line, size_t length, uint32_t line_number, struct basictest_entry *e, struct basictest_error *err) |
| Reads one line of the result file (without its LF) into e. | |
| size_t | basictest_error_text (const struct basictest_error *err, char *buf, size_t size) |
| Writes the text of a reader error ("line 3: check: malformed
value in field 5"), 0-terminated, cut to fit size bytes (size > 0). The entry name is written as a string value. | |
| #define BASICTEST_VERSION 1 |
The format version the codec writes and reads (begin).
| enum basictest_block |
| enum basictest_err |
| enum basictest_kind |
| uint32_t basictest_crc32 | ( | const uint8_t * | data, |
| size_t | length ) |
The CRC32 of a string value: the standard CRC-32 of IEEE 802.3 (zlib, PNG; the polynomial $EDB88320 reflected, $FFFFFFFF at the start and XORed at the end); $CBF43926 for "123456789", 0 for none.
| size_t basictest_decimal | ( | uint32_t | v, |
| uint8_t * | buf ) |
Writes v in decimal (no sign, no leading zero) to buf, which has room for 10 bytes; the writer's and the error text's helper.
| size_t basictest_error_text | ( | const struct basictest_error * | err, |
| char * | buf, | ||
| size_t | size ) |
Writes the text of a reader error ("line 3: check: malformed value in field 5"), 0-terminated, cut to fit size bytes (size > 0). The entry name is written as a string value.
| int basictest_read | ( | uint8_t * | line, |
| size_t | length, | ||
| uint32_t | line_number, | ||
| struct basictest_entry * | e, | ||
| struct basictest_error * | err ) |
Reads one line of the result file (without its LF) into e.
The string values are decoded in place: e's strings point into line, which the call changes. line_number is the number of the line in the file, for the error.
| size_t basictest_write | ( | const struct basictest_entry * | e, |
| uint8_t * | buf, | ||
| size_t | size ) |
Writes the line of an entry, with its LF, to buf.