#ifndef TEST_UTILS_H_INCLUDED
#define TEST_UTILS_H_INCLUDED

#include <stdio.h>

#include "merkle.h"

void __attribute__ ((noreturn)) __attribute__ ((__format__ (__printf__, 1, 2)))
die (const char *format, ...);

void
hash_from_base64 (struct sigsum_hash *dst, const char *b64);

unsigned
path_from_base64 (unsigned max_size, struct sigsum_hash *path,
		  const char *const *b64);

void
dump_hex (FILE *f, size_t size, const uint8_t *data);

/* Reads a file in the source directory, dies on failure. */
size_t
read_src_file (const char *name, char **data);

/* Using a storage class specifier (in particular, static) in a
   compound literal is allowed from C23. Unfortunately, not supported
   by clang-19 or by clang-21, not even with -std=c23. */
#if defined (__clang_major__) && __clang_major__ <= 21
#define LITERAL_STATIC
#else
#define LITERAL_STATIC static
#endif

#endif /* TEST_UTILS_H_INCLUDED */
