Skip to content

Commit e0fe4e4

Browse files
jaseemabidemilio
authored andcommitted
Add tests for expressions like (0 << SHIFT) | BOOL
Fixes #412
1 parent df347d9 commit e0fe4e4

File tree

16 files changed

+96
-0
lines changed

16 files changed

+96
-0
lines changed

tests/expectations/both/constant.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@
2121

2222
#define QUOTE '\''
2323

24+
#define SHIFT 3
25+
2426
#define TAB '\t'
2527

28+
#define XBOOL 1
29+
30+
#define XFALSE ((0 << SHIFT) | XBOOL)
31+
32+
#define XTRUE (1 << (SHIFT | XBOOL))
33+
2634
#define ZOM 3.14
2735

2836
typedef struct Foo {

tests/expectations/both/constant.compat.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@
2121

2222
#define QUOTE '\''
2323

24+
#define SHIFT 3
25+
2426
#define TAB '\t'
2527

28+
#define XBOOL 1
29+
30+
#define XFALSE ((0 << SHIFT) | XBOOL)
31+
32+
#define XTRUE (1 << (SHIFT | XBOOL))
33+
2634
#define ZOM 3.14
2735

2836
typedef struct Foo {

tests/expectations/both/prefix.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
#define PREFIX_LEN 42
77

8+
#define PREFIX_X (42 << 42)
9+
10+
#define PREFIX_Y (PREFIX_X + PREFIX_X)
11+
812
typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
913

1014
typedef int32_t PREFIX_ValuedLenArray[42];

tests/expectations/both/prefix.compat.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
#define PREFIX_LEN 42
77

8+
#define PREFIX_X (42 << 42)
9+
10+
#define PREFIX_Y (PREFIX_X + PREFIX_X)
11+
812
typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
913

1014
typedef int32_t PREFIX_ValuedLenArray[42];

tests/expectations/constant.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@
2121

2222
#define QUOTE '\''
2323

24+
#define SHIFT 3
25+
2426
#define TAB '\t'
2527

28+
#define XBOOL 1
29+
30+
#define XFALSE ((0 << SHIFT) | XBOOL)
31+
32+
#define XTRUE (1 << (SHIFT | XBOOL))
33+
2634
#define ZOM 3.14
2735

2836
typedef struct {

tests/expectations/constant.compat.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@
2121

2222
#define QUOTE '\''
2323

24+
#define SHIFT 3
25+
2426
#define TAB '\t'
2527

28+
#define XBOOL 1
29+
30+
#define XFALSE ((0 << SHIFT) | XBOOL)
31+
32+
#define XTRUE (1 << (SHIFT | XBOOL))
33+
2634
#define ZOM 3.14
2735

2836
typedef struct {

tests/expectations/constant.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@ static const int8_t POS_ONE = 1;
2121

2222
static const uint32_t QUOTE = '\'';
2323

24+
static const int64_t SHIFT = 3;
25+
2426
static const uint32_t TAB = '\t';
2527

28+
static const int64_t XBOOL = 1;
29+
30+
static const int64_t XFALSE = ((0 << SHIFT) | XBOOL);
31+
32+
static const int64_t XTRUE = (1 << (SHIFT | XBOOL));
33+
2634
static const float ZOM = 3.14;
2735

2836
struct Foo {

tests/expectations/prefix.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
#define PREFIX_LEN 42
77

8+
#define PREFIX_X (42 << 42)
9+
10+
#define PREFIX_Y (PREFIX_X + PREFIX_X)
11+
812
typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
913

1014
typedef int32_t PREFIX_ValuedLenArray[42];

tests/expectations/prefix.compat.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
#define PREFIX_LEN 42
77

8+
#define PREFIX_X (42 << 42)
9+
10+
#define PREFIX_Y (PREFIX_X + PREFIX_X)
11+
812
typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
913

1014
typedef int32_t PREFIX_ValuedLenArray[42];

tests/expectations/prefix.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
static const int32_t PREFIX_LEN = 42;
77

8+
static const int64_t PREFIX_X = (42 << 42);
9+
10+
static const int64_t PREFIX_Y = (PREFIX_X + PREFIX_X);
11+
812
using PREFIX_NamedLenArray = int32_t[PREFIX_LEN];
913

1014
using PREFIX_ValuedLenArray = int32_t[42];

0 commit comments

Comments
 (0)