libcss
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
testutils.h File Reference
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

Go to the source code of this file.

Macros

#define UNUSED(x)   ((x) = (x))
 
#define assert(expr)    ((void) ((expr) || (__assert2 (#expr, __func__, __FILE__, __LINE__), 0)))
 

Typedefs

typedef bool(* line_func) (const char *data, size_t datalen, void *pw)
 

Functions

void __assert2 (const char *expr, const char *function, const char *file, int line)
 
char * css__parse_strnchr (const char *str, size_t len, int chr)
 
bool css__parse_testfile (const char *filename, line_func callback, void *pw)
 
size_t css__parse_filesize (const char *filename)
 
css_error css_error_from_string (const char *str, size_t len)
 

Macro Definition Documentation

◆ assert

#define assert (   expr)     ((void) ((expr) || (__assert2 (#expr, __func__, __FILE__, __LINE__), 0)))

◆ UNUSED

#define UNUSED (   x)    ((x) = (x))

Typedef Documentation

◆ line_func

typedef bool(* line_func) (const char *data, size_t datalen, void *pw)

Function Documentation

◆ __assert2()

void __assert2 ( const char *  expr,
const char *  function,
const char *  file,
int  line 
)

◆ css__parse_filesize()

size_t css__parse_filesize ( const char *  filename)

Read the size of a file

Parameters
filenameName of file to read size of
Returns
File size (in bytes), or 0 on error

◆ css__parse_strnchr()

char * css__parse_strnchr ( const char *  str,
size_t  len,
int  chr 
)

Length-limited strchr

Parameters
strString to search in
lenLength of string
chrCharacter to search for
Returns
Pointer to character in string, or NULL if not found

◆ css__parse_testfile()

bool css__parse_testfile ( const char *  filename,
line_func  callback,
void *  pw 
)

Testcase datafile parser driver

Parameters
filenameName of file to parse
callbackPointer to function to handle each line of input data
pwPointer to client-specific private data
Returns
true on success, false otherwise.

◆ css_error_from_string()

css_error css_error_from_string ( const char *  str,
size_t  len 
)

Convert a string representation of an error name to a LibCSS error code

Parameters
strString containing error name
lenLength of string (bytes)
Returns
LibCSS error code, or CSS_OK if unknown