Mistake on this page?
Report an issue in GitHub or email us
Typedefs | Functions
run_tests.h File Reference

Go to the source code of this file.

Typedefs

typedef void(* OutputStringCB) (const char *szString, void *pOutCtx, int bNewline)
 Type for function to output a text string. More...
 

Functions

int RunTests (const char *szTestNames[], OutputStringCB pfOutput, void *pOutCtx, int *pNumTestsRun)
 Runs the QCBOR tests. More...
 
void PrintSizes (OutputStringCB pfOutput, void *pOutCtx)
 Print sizes of encoder / decoder contexts. More...
 

Typedef Documentation

typedef void(* OutputStringCB) (const char *szString, void *pOutCtx, int bNewline)

Type for function to output a text string.

Parameters
[in]szStringThe string to output
[in]pOutCtxA context pointer; NULL if not needed
[in]bNewlineIf non-zero, output a newline after the string

This is a prototype of a function to be passed to RunTests() to output text strings.

This can be implemented with stdio (if available) using a straight call to fputs() where the FILE * is passed as the pOutCtx as shown in the example code below. This code is for Linux where the newline is a \n. Windows usually prefers \r\n.

1 static void fputs_wrapper(const char *szString, void *pOutCtx, int bNewLine)
2 {
3  fputs(szString, (FILE *)pOutCtx);
4  if(bNewLine) {
5  fputs("\n", pOutCtx);
6  }
7  }

Definition at line 42 of file run_tests.h.

Function Documentation

void PrintSizes ( OutputStringCB  pfOutput,
void *  pOutCtx 
)

Print sizes of encoder / decoder contexts.

Parameters
[in]pfOutputFunction that is called to output text strings.
[in]pOutCtxContext pointer passed to output function.
int RunTests ( const char *  szTestNames[],
OutputStringCB  pfOutput,
void *  pOutCtx,
int *  pNumTestsRun 
)

Runs the QCBOR tests.

Parameters
[in]szTestNamesAn argv-style list of test names to run. If empty, all are run.
[in]pfOutputFunction that is called to output text strings.
[in]pOutCtxContext pointer passed to output function.
[out]pNumTestsRunReturns the number of tests run. May be NULL.
Returns
The number of tests that failed. Zero means overall success.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.