2022-04-10 08:22:58 +00:00
|
|
|
// Copyright 2022 Dietrich Epp.
|
|
|
|
// This file is part of SyncFiles. SyncFiles is licensed under the terms of the
|
|
|
|
// Mozilla Public License, version 2.0. See LICENSE.txt for details.
|
|
|
|
#ifndef LIB_TEST_H
|
|
|
|
#define LIB_TEST_H
|
2022-04-21 17:57:17 +00:00
|
|
|
// test.h - unit testing definitions.
|
2022-03-23 05:26:25 +00:00
|
|
|
|
2022-03-25 05:45:55 +00:00
|
|
|
#include "lib/defs.h"
|
2022-04-22 15:36:17 +00:00
|
|
|
#include "lib/error.h"
|
2022-03-23 05:26:25 +00:00
|
|
|
|
2022-04-21 17:57:17 +00:00
|
|
|
// The number of test failures.
|
2022-03-30 07:46:19 +00:00
|
|
|
extern int gFailCount;
|
2022-03-23 05:26:25 +00:00
|
|
|
|
2022-04-21 17:57:17 +00:00
|
|
|
// Set the name of the current test.
|
2022-03-30 07:46:19 +00:00
|
|
|
void SetTestName(const char *name);
|
|
|
|
|
2022-04-21 17:57:17 +00:00
|
|
|
// Set the name of the current test.
|
2022-03-30 07:46:19 +00:00
|
|
|
void SetTestNamef(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
|
|
|
|
2022-04-21 17:57:17 +00:00
|
|
|
// Fail the current test.
|
2022-03-30 07:46:19 +00:00
|
|
|
void Failf(const char *msg, ...) __attribute__((format(printf, 1, 2)));
|
|
|
|
|
2022-04-21 17:57:17 +00:00
|
|
|
// Return the description of an error code. Fatal error if the error code is
|
|
|
|
// invalid.
|
2022-03-30 07:46:19 +00:00
|
|
|
const char *ErrorDescriptionOrDie(ErrorCode err);
|
|
|
|
|
2022-11-16 23:19:05 +00:00
|
|
|
// Print information about completed tests and return the status code.
|
2022-04-10 07:51:59 +00:00
|
|
|
int TestsDone(void);
|
2022-03-23 05:26:25 +00:00
|
|
|
|
|
|
|
#endif
|