Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

unitester.cpp File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cassert>
#include <string>
#include "univalue.h"
+ Include dependency graph for unitester.cpp:

Go to the source code of this file.

Macros

#define ARRAY_SIZE(arr)   (sizeof(arr) / sizeof((arr)[0]))
 
#define d_assert(expr)   { if (!(expr)) { test_failed = true; fprintf(stderr, "%s failed\n", filename.c_str()); } }
 
#define f_assert(expr)   { if (!(expr)) { test_failed = true; fprintf(stderr, "%s failed\n", __func__); } }
 

Functions

string srcdir (JSON_TEST_SRC)
 
static std::string rtrim (std::string s)
 
static void runtest (string filename, const string &jdata)
 
static void runtest_file (const char *filename_)
 
void unescape_unicode_test ()
 
int main (int argc, char *argv[])
 

Variables

static bool test_failed = false
 
static const char * filenames []
 

Macro Definition Documentation

◆ ARRAY_SIZE

#define ARRAY_SIZE (   arr)    (sizeof(arr) / sizeof((arr)[0]))

Definition at line 17 of file unitester.cpp.

Referenced by main().

◆ d_assert

#define d_assert (   expr)    { if (!(expr)) { test_failed = true; fprintf(stderr, "%s failed\n", filename.c_str()); } }

Definition at line 24 of file unitester.cpp.

Referenced by runtest().

◆ f_assert

#define f_assert (   expr)    { if (!(expr)) { test_failed = true; fprintf(stderr, "%s failed\n", __func__); } }

Definition at line 25 of file unitester.cpp.

Referenced by unescape_unicode_test().

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 160 of file unitester.cpp.

References ARRAY_SIZE, filenames, runtest_file(), test_failed, and unescape_unicode_test().

◆ rtrim()

static std::string rtrim ( std::string  s)
static

Definition at line 27 of file unitester.cpp.

Referenced by runtest().

◆ runtest()

static void runtest ( string  filename,
const string &  jdata 
)
static

Definition at line 33 of file unitester.cpp.

References d_assert, prefix, UniValue::read(), rtrim(), and UniValue::write().

Referenced by runtest_file().

◆ runtest_file()

static void runtest_file ( const char *  filename_)
static

Definition at line 57 of file unitester.cpp.

References fsbridge::fopen(), runtest(), and srcdir().

Referenced by main().

◆ srcdir()

string srcdir ( JSON_TEST_SRC  )

Referenced by runtest_file().

◆ unescape_unicode_test()

void unescape_unicode_test ( )

Definition at line 138 of file unitester.cpp.

References f_assert, and UniValue::read().

Referenced by main().

Variable Documentation

◆ filenames

const char* filenames[]
static

Definition at line 81 of file unitester.cpp.

Referenced by main().

◆ test_failed

bool test_failed = false
static

Definition at line 22 of file unitester.cpp.

Referenced by main().

Released under the MIT license