This file is indexed.

/usr/include/autounit/autounit.h is in libautounit-dev 0.20.1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
/* Autounit test
 * Copyright (C) 2001-2002  Simon Janes
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef AUTOUNIT_C_TEST_H
#define AUTOUNIT_C_TEST_H

#include <stdarg.h>
#include <glib.h>

struct autounit_test_t_struct;

typedef gint (*autounit_test_fp_t)(struct autounit_test_t_struct *t);
typedef gint (*autounit_test_setup_fp_t)(struct autounit_test_t_struct *t);
typedef gint (*autounit_test_teardown_fp_t)(struct autounit_test_t_struct *t);
typedef gint (*autounit_test_set_status_fp)(struct autounit_test_t_struct *t,
					    char *msg);
/**
 * A function of this type should return
 * 0 for equal
 * 1 for ob1 greater than ob2
 * -1 for ob1 less than ob2
 */
typedef gint (*autounit_compare_func)(gpointer ob1, gpointer ob2);
typedef gchar* (*autounit_to_string_func)(gpointer ob1);

struct autounit_suite_t_struct {
  GString *suite_name;
  GString *suite_status;
  gboolean suite_run;
  gint suite_pct_complete;
  gdouble suite_seconds_elapsed;
  gulong suite_useconds_elapsed;
  gint total_tests;
  gint failed_tests;
    
  autounit_test_setup_fp_t setup_fp;
  autounit_test_teardown_fp_t teardown_fp;
  GSList *tests;
};
typedef struct autounit_suite_t_struct autounit_suite_t;

struct autounit_test_t_struct {
  autounit_suite_t *suite;

  GString *test_name;
  gboolean test_run;
  GString *test_status;
  gint failed_assertions;
  gint total_assertions;
  gdouble test_seconds_elapsed;
  gulong test_useconds_elapsed;
  autounit_test_fp_t test_fp;
  autounit_test_set_status_fp fail_fp;
  autounit_test_set_status_fp succeed_fp;
  gboolean do_fork;
  gpointer test_data;
  gint ref_count;
};
typedef struct autounit_test_t_struct autounit_test_t;

struct autounit_test_group_t_struct {
  char *name;
  autounit_test_fp_t test;
  gboolean enabled;
  gboolean forking;
};
typedef struct autounit_test_group_t_struct autounit_test_group_t;

struct autounit_stress_report_t_struct {
  gint     *round;
  gint     modulo;
};
typedef struct autounit_stress_report_t_struct autounit_stress_report_t;

/* Suite methods */
autounit_suite_t* au_new_suite(GString *suite_name,
                               autounit_test_setup_fp_t setup_fp,
                               autounit_test_teardown_fp_t teardown_fp);
void au_delete_suite(autounit_suite_t *t);

autounit_suite_t* au_add_test(autounit_suite_t *suite,
                              autounit_test_t *test);
autounit_suite_t* au_add_test_group(autounit_suite_t *suite,
                                    autounit_test_group_t *group);

gint au_run_suite(autounit_suite_t *suite);
gint au_run_stress_suite(autounit_suite_t *suite,
                         gint rounds,gint modulo);

/* Test methods */
autounit_test_t* au_new_test(GString *test_name,
			     autounit_test_fp_t test_fp);
void au_delete_test(autounit_test_t *t);

gint au_test_ref(autounit_test_t *t);
gint au_test_unref(autounit_test_t *t);

void au_remove_test(autounit_suite_t *tc, autounit_test_t *t);

void au_run_test(autounit_test_t *test);
void au_run_test_fork(autounit_test_t *test, autounit_stress_report_t *status);
void au_run_stress_test(autounit_test_t *test,
                        autounit_stress_report_t *report);

GString *au_test_serialize(autounit_test_t *test);
autounit_test_t *au_test_unserialize(GString *test_ser);

void au_test_set_fork_mode(autounit_test_t *t, gboolean mode);
gboolean au_test_get_fork_mode(autounit_test_t *t);

void au_test_append_msg(autounit_test_t *t, char *msg);

#define au_return_on_fail(func) \
    if(!func) { \
        return FALSE; \
    }

typedef enum
{
    AU_REL_GT,
    AU_REL_GT_EQ,
    AU_REL_LT,
    AU_REL_LT_EQ,
    AU_REL_EQUAL,
    AU_REL_NOTEQUAL
} AU_ASSERT_RELATION_TYPE;

gboolean au_assert_true(autounit_test_t *t, gboolean result, 
                        char *filename, int lineno, char *msg, ...);
gboolean au_assert_true_v(autounit_test_t *t, gboolean result, 
                          char *filename, int lineno, char *msg, va_list ap);

gboolean au_assert_str_int(autounit_test_t *t,
                           AU_ASSERT_RELATION_TYPE type,
                           char *str1, char *str2,
                           char *filename, int lineno,  char *msg, ...);
gboolean au_assert_str_int_v(autounit_test_t *t,
                             AU_ASSERT_RELATION_TYPE type,
                             char *str1, char *str2, 
                             char *filename, int lineno, char *msg,
                             va_list ap);

gboolean au_assert_guint64_int(autounit_test_t *t,
                               AU_ASSERT_RELATION_TYPE type,
                               guint64 in1, guint64 in2,
                               char *filename, int lineno, char *msg, ...);
gboolean au_assert_guint64_int_v(autounit_test_t *t,
                                 AU_ASSERT_RELATION_TYPE type,
                                 guint64 in1, guint64 in2,
                                 char *filename, int lineno, char *msg,
                                 va_list ap);

gboolean au_assert_gint64_int(autounit_test_t *t,
                              AU_ASSERT_RELATION_TYPE type,
                              gint64 in1, gint64 in2,
                              char *filename, int lineno, char *msg, ...);
gboolean au_assert_gint64_int_v(autounit_test_t *t,
                                AU_ASSERT_RELATION_TYPE type,
                                gint64 in1, gint64 in2,
                                char *filename, int lineno, char *msg,
                                va_list ap);

gboolean au_asserteq_char_int(autounit_test_t *t, char in1, char in2,
                              char *filename, int lineno, char *msg, ...);
gboolean au_asserteq_char_int_v(autounit_test_t *t, char in1, char in2,
                                char *filename, int lineno, char *msg,
                                va_list ap);

gboolean au_assert_obj_int(autounit_test_t *t,
                           AU_ASSERT_RELATION_TYPE type,
                           gpointer ob1, gpointer ob2,
                           autounit_compare_func func, 
                           autounit_to_string_func string_func1,
                           autounit_to_string_func string_func2,
                           char *filename, int lineno, char *msg, ...);
gboolean au_assert_obj_int_v(autounit_test_t *t,
                             AU_ASSERT_RELATION_TYPE type,
                             gpointer ob1, gpointer ob2,
                             autounit_compare_func compare_func,
                             autounit_to_string_func string_func1,
                             autounit_to_string_func string_func2,
                             char *filename, int lineno, char *msg,
                             va_list ap);


#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define au_assert(t, expr, err_msg, ...) au_assert_true(t, expr, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_assert_fail(t, err_msg, ...) au_assert_true(t, 0, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_assert_succeed(t, err_msg, ...) au_assert_true(t, 1, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_asserteq_str(t, str1, str2, err_msg, ...) au_assert_str_int(t, AU_REL_EQUAL, str1, str2, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_assertrel_str(t, type, str1, str2, err_msg, ...) au_assert_str_int(t, type, str1, str2, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_asserteq_uint64(t, in1, in2, err_msg, ...) au_assert_guint64_int(t, AU_REL_EQUAL, in1, in2, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_assertrel_uint64(t, type, in1, in2, err_msg, ...) au_assert_guint64_int(t, type, in1, in2, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_asserteq_int(t, in1, in2, err_msg, ...) au_assert_gint64_int(t, AU_REL_EQUAL, in1, in2, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_assertrel_int(t, type, in1, in2, err_msg, ...) au_assert_gint64_int(t, type, in1, in2, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_asserteq_char(t, in1, in2, err_msg, ...) au_asserteq_char_int(t, in1, in2, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_asserteq_obj(t, ob1, ob2, compare_func, err_msg, ...) au_assert_obj_int(t, AU_REL_EQUAL, (gpointer)ob1, (gpointer)ob2, compare_func, 0, 0, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_assertrel_obj(t, type, ob1, ob2, compare_func, err_msg, ...) au_assert_obj_int(t, type, (gpointer)ob1, (gpointer)ob2, compare_func, 0, 0, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_assert_null(t, ob1, err_msg, ...) au_assert(t, ob1 == 0, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#define au_assert_not_null(t, ob1, err_msg, ...) au_assert(t, ob1 != 0, __FILE__, __LINE__, err_msg, __VA_ARGS__)

#elif defined (__GNUC__)
#define au_assert(t, expr, err_msg...) au_assert_true(t, expr, __FILE__, __LINE__, err_msg)

#define au_assert_fail(t, err_msg...) au_assert_true(t, 0, __FILE__, __LINE__, err_msg)

#define au_assert_succeed(t, err_msg...) au_assert_true(t, 1, __FILE__, __LINE__, err_msg)

#define au_asserteq_str(t, str1, str2, err_msg...) au_assert_str_int(t, AU_REL_EQUAL, str1, str2, __FILE__, __LINE__, err_msg)

#define au_assertrel_str(t, type, str1, str2, err_msg...) au_assert_str_int(t, type, str1, str2, __FILE__, __LINE__, err_msg)

#define au_asserteq_uint64(t, in1, in2, err_msg...) au_assert_guint64_int(t, AU_REL_EQUAL, in1, in2, __FILE__, __LINE__, err_msg)

#define au_assertrel_uint64(t, type, in1, in2, err_msg...) au_assert_guint64_int(t, type, in1, in2, __FILE__, __LINE__, err_msg)

#define au_asserteq_int(t, in1, in2, err_msg...) au_assert_gint64_int(t, AU_REL_EQUAL, in1, in2, __FILE__, __LINE__, err_msg)

#define au_assertrel_int(t, type, in1, in2, err_msg...) au_assert_gint64_int(t, type, in1, in2, __FILE__, __LINE__, err_msg)

#define au_asserteq_char(t, in1, in2, err_msg...) au_asserteq_char_int(t, in1, in2, __FILE__, __LINE__, err_msg)

#define au_asserteq_obj(t, ob1, ob2, compare_func, err_msg...) au_assert_obj_int(t, AU_REL_EQUAL, (gpointer)ob1, (gpointer)ob2, compare_func, 0, 0, __FILE__, __LINE__, err_msg)

#define au_assertrel_obj(t, type, ob1, ob2, compare_func, err_msg...) au_assert_obj_int(t, type, (gpointer)ob1, (gpointer)ob2, compare_func, 0, 0, __FILE__, __LINE__, err_msg)

#define au_assert_null(t, ob1, err_msg...) au_assert(t, ob1 == 0, __FILE__, __LINE__, err_msg)

#define au_assert_not_null(t, ob1, err_msg...) au_assert(t, ob1 != 0, __FILE__, __LINE__, err_msg)

#else

static gboolean
au_assert(autounit_test_t *t, gboolean expr, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_true_v(t, expr, __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_assert_fail(autounit_test_t *t, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_true_v(t, 0, __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_assert_succeed(autounit_test_t *t, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_true_v(t, 1, __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_assert_null(autounit_test_t *t, gpointer ob1, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_true_v(t, ob1 == 0, __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_assert_not_null(autounit_test_t *t, gpointer ob1, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_true_v(t, ob1 != 0, __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_asserteq_str(autounit_test_t *t, gchar *str1, gchar *str2, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_str_int_v(t, AU_REL_EQUAL, str1, str2, __FILE__, 0,
                              msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_assertrel_str(autounit_test_t *t, AU_ASSERT_RELATION_TYPE type,
                 gchar *str1, gchar *str2, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_str_int_v(t, type, str1, str2, __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_asserteq_uint64(autounit_test_t *t, guint64 in1, guint64 in2,
                   char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_guint64_int_v(t, AU_REL_EQUAL, in1, in2, __FILE__, 0,
                                    msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_assertrel_uint64(autounit_test_t *t, AU_ASSERT_RELATION_TYPE, type
                    guint64 in1, guint64 in2, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_guint64_int_v(t, type, in1, in2, __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_asserteq_int(autounit_test_t *t, gint64 in1, gint64 in2, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_gint64_int_v(t, in1, in2, __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_assertrel_int(autounit_test_t *t, AU_ASSERT_RELATION_TYPE type,
                  gint64 in1, gint64 in2, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_gint64_int_v(t, type, in1, in2, __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_asserteq_char(autounit_test_t *t, gchar in1, gchar in2, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_asserteq_char_int_v(t, in1, in2, __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_asserteq_obj(autounit_test_t *t, gpointer ob1, gpointer ob2,
                autounit_compare_func compare, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_obj_int_v(t, AU_REL_EQUAL, ob1, ob2, compare, 0, 0,
                              __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}

static gboolean
au_assertrel_obj(autounit_test_t *t, AU_ASSERT_RELATION_TYPE type,
                 gpointer ob1, gpointer ob2,
                 autounit_compare_func compare, char *msg, ...)
{
    gboolean ret;
    va_list ap;
    va_start(ap, msg);
    ret = au_assert_obj_int_v(t, type, ob1, ob2, compare, 0, 0,
                              __FILE__, 0, msg, ap);
    va_end(ap);
    return ret;
}


#endif

#endif  /* AUTOUNIT_C_TEST_H */