blob: e52194d2d97e172cffda43846b252d9b7010b7b8 (
plain)
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
|
/*
* bug-1918.c
*/
#include <testfwk.h>
#if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // pdk needs function pointer to be reentrant even for a single argument
int run_func0 (int (*f) (int), int d);
int run_func1 (int (*) (int), int);
int test_func (int x)
{
return x > 0 ? x + 1 : x - 1;
}
int run_func0 (int (*f) (int), int d)
{
return f(d) + 10;
}
int run_func1 (int (*f) (int), int d)
{
return f(d) - 10;
}
#endif
void testBug (void)
{
#if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15)
ASSERT (run_func0 (test_func, 23) == 34);
ASSERT (run_func1 (test_func, -23) == -34);
#endif
}
|