unbound: testcode/unitldns.c File Reference

unbound 0.1

Macros | Functions | Variables
unitldns.c File Reference

Calls ldns unit tests. More...

`#include "config.h"`
`#include "util/log.h"`
`#include "testcode/unitmain.h"`
`#include "sldns/sbuffer.h"`
`#include "sldns/str2wire.h"`
`#include "sldns/wire2str.h"`
`#include "sldns/parseutil.h"`

## Macros
#define | xstr(s)
#define | str(s)
#define | SRCDIRSTR xstr(SRCDIR)

## Functions
static void | buf_to_hex (uint8_t *b, size_t blen, char *s, size_t slen)
| print buffer to hex into string
static void | rr_transform (char *txt_in, char *wire1, char *txt_out, char *wire2, size_t bufs)
| Transform input.
static void | rr_checks (char *wire_chk, char *txt_chk, char *txt_out, char *wire_out, char *back)
| Check if results are correct.
static void | rr_test_file (const char *input, const char *check)
| read rrs to and from string, and wireformat Skips empty lines and comments.
static void | rr_tests (void)
| read rrs to and from string, to and from wireformat
static void | b64_test (void)
| test various base64 decoding options
void | ldns_test (void)
| unit test for ldns functions

## Variables
static int | vbmp = 0
| verbose this unit test

## Detailed Description

Calls ldns unit tests.

Exits with code 1 on a failure.

## Macro Definition Documentation

## ◆ xstr

#define xstr | ( |  | s | ) |

Value:
str(s)

## ◆ str

#define str | ( |  | s | ) |

Value:
#s

## Function Documentation

## ◆ rr_transform()

static void rr_transform | ( | char * | txt_in,
|  | char * | wire1,
|  | char * | txt_out,
|  | char * | wire2,
|  | size_t | bufs )
| static

Transform input.

Parameters

  txt_in | input text format.
  wire1 | output wireformat in hex (txt_in converted to wire).
  txt_out | output text format (converted from wire_out).
  wire2 | output wireformat in hex, txt_out converted back to wireformat.
  bufs | size of the text buffers.

References buf_to_hex(), sldns_get_errorstr_parse(), sldns_str2wire_rr_buf(), sldns_wire2str_rr_buf(), unit_assert, and vbmp.

Referenced by rr_test_file().

## ◆ rr_test_file()

static void rr_test_file | ( | const char * | input,
|  | const char * | check )
| static

read rrs to and from string, and wireformat Skips empty lines and comments.

Parameters

  input | input file with text format.
  check | check file with hex and then textformat

References fatal_exit(), rr_checks(), rr_transform(), and vbmp.

Referenced by rr_tests().