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)   str(s)
 
#define str(s)   #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. More...
 
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. More...
 
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.

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_ininput text format.
wire1output wireformat in hex (txt_in converted to wire).
txt_outoutput text format (converted from wire_out).
wire2output wireformat in hex, txt_out converted back to wireformat.
bufssize of the text buffers.

References sldns_str2wire_rr_buf(), and vbmp.

◆ 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
inputinput file with text format.
checkcheck file with hex and then textformat

Referenced by rr_tests().