git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 3c74d287aa0ba54577e93a82ef8dbb2a5e4d282e 1981 bytes (raw)
name: reftable/test_framework.h 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
 
/*
Copyright 2020 Google LLC

Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
*/

#ifndef TEST_FRAMEWORK_H
#define TEST_FRAMEWORK_H

#include "system.h"

#ifdef NDEBUG
#undef NDEBUG
#endif

#ifdef assert
#undef assert
#endif

#define assert_err(c)                                                  \
	if (c != 0) {                                                  \
		fflush(stderr);                                        \
		fflush(stdout);                                        \
		fprintf(stderr, "%s: %d: error == %d (%s), want 0\n",  \
			__FILE__, __LINE__, c, reftable_error_str(c)); \
		abort();                                               \
	}

#define assert_streq(a, b)                                               \
	if (strcmp(a, b)) {                                              \
		fflush(stderr);                                          \
		fflush(stdout);                                          \
		fprintf(stderr, "%s:%d: %s (%s) != %s (%s)\n", __FILE__, \
			__LINE__, #a, a, #b, b);                         \
		abort();                                                 \
	}

#define assert(c)                                                          \
	if (!(c)) {                                                        \
		fflush(stderr);                                            \
		fflush(stdout);                                            \
		fprintf(stderr, "%s: %d: failed assertion %s\n", __FILE__, \
			__LINE__, #c);                                     \
		abort();                                                   \
	}

struct test_case {
	const char *name;
	void (*testfunc)(void);
};

struct test_case *new_test_case(const char *name, void (*testfunc)(void));
struct test_case *add_test_case(const char *name, void (*testfunc)(void));
int test_main(int argc, const char *argv[]);

void set_test_hash(uint8_t *p, int i);

#endif

debug log:

solving 3c74d287aa ...
found 3c74d287aa in https://public-inbox.org/git/7bf59d491d75b72b4046661ec94c5e1d6a52047c.1600283416.git.gitgitgadget@gmail.com/

applying [1/1] https://public-inbox.org/git/7bf59d491d75b72b4046661ec94c5e1d6a52047c.1600283416.git.gitgitgadget@gmail.com/
diff --git a/reftable/test_framework.h b/reftable/test_framework.h
new file mode 100644
index 0000000000..3c74d287aa

Checking patch reftable/test_framework.h...
Applied patch reftable/test_framework.h cleanly.

index at:
100644 3c74d287aa0ba54577e93a82ef8dbb2a5e4d282e	reftable/test_framework.h

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).