blob: e0fcb0f1a668fc5e1ed59ad1c85c546246ddcc37 (
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
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
|
/*
bug1738367.c
*/
#include <testfwk.h>
#ifdef __SDCC
#pragma std_sdcc99
#endif
#include <stdbool.h>
#ifdef __bool_true_false_are_defined
bool ternary(unsigned char status)
{
return (status == 0) ? 0 : 1;
}
bool ternary_inv(unsigned char status)
{
return (status == 0) ? 1 : 0;
}
bool ternary1(unsigned char status)
{
return status ? 1 : 0;
}
bool ternary1_inv(unsigned char status)
{
return status ? 0 : 1;
}
bool ternary2(unsigned char status)
{
return !status ? 0 : 1;
}
bool ternary2_inv(unsigned char status)
{
return !status ? 1 : 0;
}
#endif //__bool_true_false_are_defined
void
testBug(void)
{
#ifndef __SDCC_pic16
#ifdef __bool_true_false_are_defined
ASSERT(!ternary(0x00));
ASSERT( ternary(0x10));
ASSERT( ternary_inv(0x00));
ASSERT(!ternary_inv(0x10));
ASSERT(!ternary1(0x00));
ASSERT( ternary1(0x10));
ASSERT( ternary1_inv(0x00));
ASSERT(!ternary1_inv(0x10));
ASSERT(!ternary2(0x00));
ASSERT( ternary2(0x10));
ASSERT( ternary2_inv(0x00));
ASSERT(!ternary2_inv(0x10));
ASSERT(!ternary2_inv(1==1));
#endif //__bool_true_false_are_defined
#endif
}
|