unittest: use common_setup / common_shutdown almost everywhere.

Avoids much cut & paste.  Some tests don't need any of it, but most
want at least some of this infrastructure.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2020-12-02 10:40:04 +10:30
parent 39f4ca98b5
commit ca2bd98082
43 changed files with 147 additions and 208 deletions

View File

@@ -3,6 +3,7 @@
#include <ccan/mem/mem.h>
#include <ccan/tal/str/str.h>
#include <common/json.h>
#include <common/setup.h>
#include <common/utils.h>
#include <inttypes.h>
#include <stdio.h>
@@ -287,17 +288,15 @@ static void test_json_bad_utf8(void)
assert(json_parse_simple(tmpctx, buf, strlen(buf)));
}
int main(void)
int main(int argc, char *argv[])
{
setup_locale();
setup_tmpctx();
common_setup(argv[0]);
test_json_tok_size();
test_json_tok_bitcoin_amount();
test_json_tok_millionths();
test_json_delve();
test_json_bad_utf8();
assert(!taken_any());
take_cleanup();
tal_free(tmpctx);
common_shutdown();
}