blob: 0a8228bced74db83d1b68cf5a28bf882a4bdde41 (
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
34
35
36
|
/** Test if-declarations (C2y) */
#include <testfwk.h>
#ifdef __SDCC
_Pragma("std_c2y")
bool foo(int i)
{
if (int j = i + 1; j != 0)
return j;
else
return false;
}
bool bar(int i)
{
switch (int j = i + 1)
{
case 0:
return j;
default:
return true;
}
}
#endif
void testIfDecl(void)
{
#ifdef __SDCC
ASSERT(foo(0) == true);
ASSERT(foo(-1) == false);
ASSERT(bar(0) == true);
ASSERT(bar(-1) == false);
#endif
}
|