Skip to content

Commit cbd8321

Browse files
committed
[skip ci] Use a 'more constexpr-friendy' test for compare() (#34, thanks to @mcskatkat)
1 parent 060c67f commit cbd8321

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/string-view.t.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,9 @@ CASE( "string_view: Allows to compare empty string_views as equal via compare(),
378378
CASE( "string_view: Allows to constexpr-compare string_views via compare(), (1) (C++14)" )
379379
{
380380
#if nssv_HAVE_CONSTEXPR_14
381-
constexpr char hello[] = "hello";
382-
constexpr char world[] = "world";
383-
384-
static_assert( string_view( hello ).compare( string_view( hello ) ) == 0, "" );
385-
static_assert( string_view( hello ).compare( string_view( world ) ) < 0, "" );
386-
static_assert( string_view( world ).compare( string_view( hello ) ) > 0, "" );
381+
static_assert( string_view( "hello" ).compare( string_view( "hello" ) ) == 0, "" );
382+
static_assert( string_view( "hello" ).compare( string_view( "world" ) ) < 0, "" );
383+
static_assert( string_view( "world" ).compare( string_view( "hello" ) ) > 0, "" );
387384
#else
388385
EXPECT( !!"C++14 constexpr is not available (no C++14)" );
389386
#endif

0 commit comments

Comments
 (0)