From 7980288a94fb36869b5bc7a235c1e5563859fce9 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Fri, 27 Nov 2020 00:19:26 +0300 Subject: [PATCH] Reenable some tests --- tests/expectations/constant.both.c | 6 ++---- tests/expectations/constant.both.compat.c | 6 ++---- tests/expectations/constant.c | 6 ++---- tests/expectations/constant.compat.c | 6 ++---- tests/expectations/constant.cpp | 6 ++---- tests/expectations/constant.pyx | 6 ++---- tests/expectations/constant.tag.c | 6 ++---- tests/expectations/constant.tag.compat.c | 6 ++---- tests/expectations/constant.tag.pyx | 6 ++---- tests/expectations/prefix.both.c | 4 +--- tests/expectations/prefix.both.compat.c | 4 +--- tests/expectations/prefix.c | 4 +--- tests/expectations/prefix.compat.c | 4 +--- tests/expectations/prefix.cpp | 4 +--- tests/expectations/prefix.pyx | 4 +--- tests/expectations/prefix.tag.c | 4 +--- tests/expectations/prefix.tag.compat.c | 4 +--- tests/expectations/prefix.tag.pyx | 4 +--- tests/rust/constant.rs | 7 ++----- tests/rust/prefix.rs | 8 ++------ 20 files changed, 31 insertions(+), 74 deletions(-) diff --git a/tests/expectations/constant.both.c b/tests/expectations/constant.both.c index e6fba19..73ae532 100644 --- a/tests/expectations/constant.both.c +++ b/tests/expectations/constant.both.c @@ -38,11 +38,9 @@ #define XBOOL 1 -#define XFALSE1 ((0 << 3) | 1) +#define XFALSE ((0 << SHIFT) | XBOOL) -#define XTRUE1 (1 << (3 | 1)) - -#define XFALSE2 (0 << SHIFT) +#define XTRUE (1 << (SHIFT | XBOOL)) #define CAST (uint8_t)'A' diff --git a/tests/expectations/constant.both.compat.c b/tests/expectations/constant.both.compat.c index d6dcc53..08843c6 100644 --- a/tests/expectations/constant.both.compat.c +++ b/tests/expectations/constant.both.compat.c @@ -38,11 +38,9 @@ #define XBOOL 1 -#define XFALSE1 ((0 << 3) | 1) +#define XFALSE ((0 << SHIFT) | XBOOL) -#define XTRUE1 (1 << (3 | 1)) - -#define XFALSE2 (0 << SHIFT) +#define XTRUE (1 << (SHIFT | XBOOL)) #define CAST (uint8_t)'A' diff --git a/tests/expectations/constant.c b/tests/expectations/constant.c index 831b205..3ae4680 100644 --- a/tests/expectations/constant.c +++ b/tests/expectations/constant.c @@ -38,11 +38,9 @@ #define XBOOL 1 -#define XFALSE1 ((0 << 3) | 1) +#define XFALSE ((0 << SHIFT) | XBOOL) -#define XTRUE1 (1 << (3 | 1)) - -#define XFALSE2 (0 << SHIFT) +#define XTRUE (1 << (SHIFT | XBOOL)) #define CAST (uint8_t)'A' diff --git a/tests/expectations/constant.compat.c b/tests/expectations/constant.compat.c index a14a251..654a75e 100644 --- a/tests/expectations/constant.compat.c +++ b/tests/expectations/constant.compat.c @@ -38,11 +38,9 @@ #define XBOOL 1 -#define XFALSE1 ((0 << 3) | 1) +#define XFALSE ((0 << SHIFT) | XBOOL) -#define XTRUE1 (1 << (3 | 1)) - -#define XFALSE2 (0 << SHIFT) +#define XTRUE (1 << (SHIFT | XBOOL)) #define CAST (uint8_t)'A' diff --git a/tests/expectations/constant.cpp b/tests/expectations/constant.cpp index 8c233ae..c8196d3 100644 --- a/tests/expectations/constant.cpp +++ b/tests/expectations/constant.cpp @@ -35,11 +35,9 @@ static const int64_t SHIFT = 3; static const int64_t XBOOL = 1; -static const int64_t XFALSE1 = ((0 << 3) | 1); +static const int64_t XFALSE = ((0 << SHIFT) | XBOOL); -static const int64_t XTRUE1 = (1 << (3 | 1)); - -static const int64_t XFALSE2 = (0 << SHIFT); +static const int64_t XTRUE = (1 << (SHIFT | XBOOL)); static const uint8_t CAST = (uint8_t)'A'; diff --git a/tests/expectations/constant.pyx b/tests/expectations/constant.pyx index 8a7e21f..8ec614e 100644 --- a/tests/expectations/constant.pyx +++ b/tests/expectations/constant.pyx @@ -37,11 +37,9 @@ cdef extern from *: const int64_t XBOOL # = 1 - const int64_t XFALSE1 # = ((0 << 3) | 1) + const int64_t XFALSE # = ((0 << SHIFT) | XBOOL) - const int64_t XTRUE1 # = (1 << (3 | 1)) - - const int64_t XFALSE2 # = (0 << SHIFT) + const int64_t XTRUE # = (1 << (SHIFT | XBOOL)) const uint8_t CAST # = 'A' diff --git a/tests/expectations/constant.tag.c b/tests/expectations/constant.tag.c index 6b776ae..b5aa355 100644 --- a/tests/expectations/constant.tag.c +++ b/tests/expectations/constant.tag.c @@ -38,11 +38,9 @@ #define XBOOL 1 -#define XFALSE1 ((0 << 3) | 1) +#define XFALSE ((0 << SHIFT) | XBOOL) -#define XTRUE1 (1 << (3 | 1)) - -#define XFALSE2 (0 << SHIFT) +#define XTRUE (1 << (SHIFT | XBOOL)) #define CAST (uint8_t)'A' diff --git a/tests/expectations/constant.tag.compat.c b/tests/expectations/constant.tag.compat.c index f9f9889..2154e49 100644 --- a/tests/expectations/constant.tag.compat.c +++ b/tests/expectations/constant.tag.compat.c @@ -38,11 +38,9 @@ #define XBOOL 1 -#define XFALSE1 ((0 << 3) | 1) +#define XFALSE ((0 << SHIFT) | XBOOL) -#define XTRUE1 (1 << (3 | 1)) - -#define XFALSE2 (0 << SHIFT) +#define XTRUE (1 << (SHIFT | XBOOL)) #define CAST (uint8_t)'A' diff --git a/tests/expectations/constant.tag.pyx b/tests/expectations/constant.tag.pyx index 545196e..5d60f6a 100644 --- a/tests/expectations/constant.tag.pyx +++ b/tests/expectations/constant.tag.pyx @@ -37,11 +37,9 @@ cdef extern from *: const int64_t XBOOL # = 1 - const int64_t XFALSE1 # = ((0 << 3) | 1) + const int64_t XFALSE # = ((0 << SHIFT) | XBOOL) - const int64_t XTRUE1 # = (1 << (3 | 1)) - - const int64_t XFALSE2 # = (0 << SHIFT) + const int64_t XTRUE # = (1 << (SHIFT | XBOOL)) const uint8_t CAST # = 'A' diff --git a/tests/expectations/prefix.both.c b/tests/expectations/prefix.both.c index 3e1772f..2c6e0ce 100644 --- a/tests/expectations/prefix.both.c +++ b/tests/expectations/prefix.both.c @@ -7,9 +7,7 @@ #define PREFIX_X (22 << 22) -#define PREFIX_Y1 ((22 << 22) + (22 << 22)) - -#define PREFIX_Y2 PREFIX_X +#define PREFIX_Y (PREFIX_X + PREFIX_X) typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN]; diff --git a/tests/expectations/prefix.both.compat.c b/tests/expectations/prefix.both.compat.c index 4b1ae21..ed9924b 100644 --- a/tests/expectations/prefix.both.compat.c +++ b/tests/expectations/prefix.both.compat.c @@ -7,9 +7,7 @@ #define PREFIX_X (22 << 22) -#define PREFIX_Y1 ((22 << 22) + (22 << 22)) - -#define PREFIX_Y2 PREFIX_X +#define PREFIX_Y (PREFIX_X + PREFIX_X) typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN]; diff --git a/tests/expectations/prefix.c b/tests/expectations/prefix.c index 1f98d3d..6ba9396 100644 --- a/tests/expectations/prefix.c +++ b/tests/expectations/prefix.c @@ -7,9 +7,7 @@ #define PREFIX_X (22 << 22) -#define PREFIX_Y1 ((22 << 22) + (22 << 22)) - -#define PREFIX_Y2 PREFIX_X +#define PREFIX_Y (PREFIX_X + PREFIX_X) typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN]; diff --git a/tests/expectations/prefix.compat.c b/tests/expectations/prefix.compat.c index 5a715ae..bc719bf 100644 --- a/tests/expectations/prefix.compat.c +++ b/tests/expectations/prefix.compat.c @@ -7,9 +7,7 @@ #define PREFIX_X (22 << 22) -#define PREFIX_Y1 ((22 << 22) + (22 << 22)) - -#define PREFIX_Y2 PREFIX_X +#define PREFIX_Y (PREFIX_X + PREFIX_X) typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN]; diff --git a/tests/expectations/prefix.cpp b/tests/expectations/prefix.cpp index 57dda7e..abde339 100644 --- a/tests/expectations/prefix.cpp +++ b/tests/expectations/prefix.cpp @@ -8,9 +8,7 @@ static const int32_t PREFIX_LEN = 22; static const int64_t PREFIX_X = (22 << 22); -static const int64_t PREFIX_Y1 = ((22 << 22) + (22 << 22)); - -static const int64_t PREFIX_Y2 = PREFIX_X; +static const int64_t PREFIX_Y = (PREFIX_X + PREFIX_X); using PREFIX_NamedLenArray = int32_t[PREFIX_LEN]; diff --git a/tests/expectations/prefix.pyx b/tests/expectations/prefix.pyx index 501ae9e..c2ec8b1 100644 --- a/tests/expectations/prefix.pyx +++ b/tests/expectations/prefix.pyx @@ -10,9 +10,7 @@ cdef extern from *: const int64_t PREFIX_X # = (22 << 22) - const int64_t PREFIX_Y1 # = ((22 << 22) + (22 << 22)) - - const int64_t PREFIX_Y2 # = PREFIX_X + const int64_t PREFIX_Y # = (PREFIX_X + PREFIX_X) ctypedef int32_t PREFIX_NamedLenArray[PREFIX_LEN]; diff --git a/tests/expectations/prefix.tag.c b/tests/expectations/prefix.tag.c index 880f603..005f062 100644 --- a/tests/expectations/prefix.tag.c +++ b/tests/expectations/prefix.tag.c @@ -7,9 +7,7 @@ #define PREFIX_X (22 << 22) -#define PREFIX_Y1 ((22 << 22) + (22 << 22)) - -#define PREFIX_Y2 PREFIX_X +#define PREFIX_Y (PREFIX_X + PREFIX_X) typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN]; diff --git a/tests/expectations/prefix.tag.compat.c b/tests/expectations/prefix.tag.compat.c index f691e31..52069c4 100644 --- a/tests/expectations/prefix.tag.compat.c +++ b/tests/expectations/prefix.tag.compat.c @@ -7,9 +7,7 @@ #define PREFIX_X (22 << 22) -#define PREFIX_Y1 ((22 << 22) + (22 << 22)) - -#define PREFIX_Y2 PREFIX_X +#define PREFIX_Y (PREFIX_X + PREFIX_X) typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN]; diff --git a/tests/expectations/prefix.tag.pyx b/tests/expectations/prefix.tag.pyx index 514cb22..638696e 100644 --- a/tests/expectations/prefix.tag.pyx +++ b/tests/expectations/prefix.tag.pyx @@ -10,9 +10,7 @@ cdef extern from *: const int64_t PREFIX_X # = (22 << 22) - const int64_t PREFIX_Y1 # = ((22 << 22) + (22 << 22)) - - const int64_t PREFIX_Y2 # = PREFIX_X + const int64_t PREFIX_Y # = (PREFIX_X + PREFIX_X) ctypedef int32_t PREFIX_NamedLenArray[PREFIX_LEN]; diff --git a/tests/rust/constant.rs b/tests/rust/constant.rs index db60b0b..637a2ce 100644 --- a/tests/rust/constant.rs +++ b/tests/rust/constant.rs @@ -23,11 +23,8 @@ pub const NEG_ONE: i8 = -1; // Some doc for shifting // pub const SHIFT: i64 = 3; pub const XBOOL: i64 = 1; -// pub const XFALSE: i64 = (0 << SHIFT) | XBOOL; // Crashes Cython compiler -// pub const XTRUE: i64 = 1 << (SHIFT | XBOOL); // Crashes Cython compiler -pub const XFALSE1: i64 = (0 << 3) | 1; -pub const XTRUE1: i64 = 1 << (3 | 1); -pub const XFALSE2: i64 = 0 << SHIFT; +pub const XFALSE: i64 = (0 << SHIFT) | XBOOL; +pub const XTRUE: i64 = 1 << (SHIFT | XBOOL); pub const CAST: u8 = 'A' as u8; pub const DOUBLE_CAST: u32 = 1 as f32 as u32; diff --git a/tests/rust/prefix.rs b/tests/rust/prefix.rs index 6f29b5a..89d4638 100644 --- a/tests/rust/prefix.rs +++ b/tests/rust/prefix.rs @@ -11,14 +11,10 @@ pub enum AbsoluteFontWeight { } #[no_mangle] -pub extern "C" fn root(x: NamedLenArray, y: ValuedLenArray, z: AbsoluteFontWeight) { } +pub extern "C" fn root(x: NamedLenArray, y: ValuedLenArray, z: AbsoluteFontWeight) {} #[no_mangle] pub const X: i64 = 22 << 22; -// #[no_mangle] -// pub const Y: i64 = X + X; // Crashes Cython compiler #[no_mangle] -pub const Y1: i64 = (22 << 22) + (22 << 22); -#[no_mangle] -pub const Y2: i64 = X; +pub const Y: i64 = X + X;