File: binary.c

package info (click to toggle)
libfiu 1.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 768 kB
  • sloc: ansic: 2,633; python: 973; makefile: 599; sh: 309
file content (35 lines) | stat: -rw-r--r-- 978 bytes parent folder | download | duplicates (2)
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
// A binary that uses some of the same function names as libfiu.
// We use this to test function name collissions.

#include "libcoltest.h"
#include <stdio.h> // printf()

#define ASSERT_CALLED(NAME, N)                                                 \
	if (called_##NAME != N) {                                              \
		printf("Error: " #NAME "called %d != " #N "\n",                \
		       called_##NAME);                                         \
		return 1;                                                      \
	}

#define CHECK(NAME)                                                            \
	ASSERT_CALLED(NAME, 0)                                                 \
	NAME();                                                                \
	ASSERT_CALLED(NAME, 1)

int called_wtable_set = 0;

void wtable_set(void)
{
	called_wtable_set++;
}

int main(void)
{
	// Defined in libcoltest.
	CHECK(wtable_get)

	// Defined here.
	CHECK(wtable_set)

	return 0;
}