bkpr-tests: first test of plugin bkpr database

First test of bookkeeper database, for just the migrations.
This commit is contained in:
niftynei
2022-07-19 14:38:26 +09:30
committed by Rusty Russell
parent fb951dbbd6
commit cd95d91ed5
5 changed files with 333 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
#ifndef LIGHTNING_PLUGINS_BKPR_TEST_TEST_UTILS_H
#define LIGHTNING_PLUGINS_BKPR_TEST_TEST_UTILS_H
#include "config.h"
/* Definitions "inspired" by libsecp256k1 */
#define TEST_FAILURE(msg) do { \
fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, msg); \
return false; \
} while(0)
#ifdef HAVE_BUILTIN_EXPECT
#define EXPECT(x,c) __builtin_expect((x),(c))
#else
#define EXPECT(x,c) (x)
#endif
#define CHECK_MSG(cond,msg) do { \
if (EXPECT(!(cond), 0)) { \
TEST_FAILURE(msg); \
} \
} while(0)
#define CHECK(cond) CHECK_MSG(cond,"test condition failed");
#endif /* LIGHTNING_PLUGINS_BKPR_TEST_TEST_UTILS_H */