Skip to content

Disable bogus tests if char is unsigned #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/generating.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <climits>
#include <ctre.hpp>

void empty_symbol() { }
Expand Down Expand Up @@ -52,10 +53,16 @@ static_assert(same_f(CTRE_GEN("(?:abc)"), ctre::string<'a','b','c'>()));
// support for hexdec
static_assert(same_f(CTRE_GEN("\\x40"), ctre::character<char{0x40}>()));
static_assert(same_f(CTRE_GEN("\\x7F"), ctre::character<char{0x7F}>()));
#if CHAR_MAX < 128
// only characters with value < 128 are char otherwise they are internally char32_t
static_assert(same_f(CTRE_GEN("\\x80"), ctre::character<char32_t{0x80}>()));
static_assert(same_f(CTRE_GEN("\\xFF"), ctre::character<char32_t{0xFF}>()));
static_assert(same_f(CTRE_GEN("\\x{FF}"), ctre::character<char32_t{0xFF}>()));
#else
static_assert(same_f(CTRE_GEN("\\x80"), ctre::character<char{0x80}>()));
static_assert(same_f(CTRE_GEN("\\xFF"), ctre::character<char{0xFF}>()));
static_assert(same_f(CTRE_GEN("\\x{FF}"), ctre::character<char{0xFF}>()));
#endif
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#endif
#else
static_assert(same_f(CTRE_GEN("\\x80"), ctre::character<char{0x80}>()));
static_assert(same_f(CTRE_GEN("\\xFF"), ctre::character<char{0xFF}>()));
static_assert(same_f(CTRE_GEN("\\x{FF}"), ctre::character<char{0xFF}>()));
#endif

static_assert(same_f(CTRE_GEN("\\x{FFF}"), ctre::character<char32_t{0xFFF}>()));
static_assert(same_f(CTRE_GEN("\\x{ABCD}"), ctre::character<char32_t{0xABCD}>()));

Expand Down