Compare commits

..

7 Commits

Author SHA1 Message Date
Peter Dimov 89b242e540 Add VS2026 to Drone 2025-12-25 16:31:01 +02:00
Peter Dimov c4e5a6541f Add a test_output_impl overload for char8_t 2025-12-25 15:05:02 +02:00
Peter Dimov abb1b9ce5b Add char8_t tests to lightweight_test_test6 2025-12-25 14:57:51 +02:00
Peter Dimov a35b0620a9 Update .drone.jsonnet 2025-12-21 20:13:06 +02:00
Peter Dimov f3cd3afb69 Specialize output for all pointer types; fixes EQ w/ wchar_t* et al 2025-12-21 19:02:50 +02:00
Peter Dimov 378dc90a73 Add lightweight_test_eq_ptr; tests EQ and NE with various pointer types. 2025-12-21 18:46:12 +02:00
Peter Dimov cc765abfc6 Split clang-win job in appveyor.yml to avoid timeout 2025-12-14 22:45:57 +02:00
6 changed files with 166 additions and 23 deletions
+24 -11
View File
@@ -382,26 +382,33 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
),
linux_pipeline(
"Linux 24.04 Clang 19 UBSAN",
"Linux 24.04 Clang 19",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-19', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
{ TOOLSET: 'clang', COMPILER: 'clang++-19', CXXSTD: '03,11,14,17,20,2b' },
"clang-19",
),
linux_pipeline(
"Linux 24.04 Clang 19 ASAN",
"Linux 24.04 Clang 20 UBSAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-19', CXXSTD: '03,11,14,17,20,2b' } + asan,
"clang-19",
),
linux_pipeline(
"Linux 25.04 Clang 20",
"cppalliance/droneubuntu2504:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-20', CXXSTD: '03,11,14,17,20,23,2c' },
{ TOOLSET: 'clang', COMPILER: 'clang++-20', CXXSTD: '03,11,14,17,20,23,2c' } + ubsan,
"clang-20",
),
linux_pipeline(
"Linux 24.04 Clang 20 ASAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-20', CXXSTD: '03,11,14,17,20,23,2c' } + asan,
"clang-20",
),
linux_pipeline(
"Linux 25.10 Clang 21",
"cppalliance/droneubuntu2510:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-21', CXXSTD: '03,11,14,17,20,23,2c' },
"clang-21",
),
macos_pipeline(
"MacOS 10.15 Xcode 12.2 UBSAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,1z' } + ubsan,
@@ -447,4 +454,10 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
"cppalliance/dronevs2022:1",
{ TOOLSET: 'msvc-14.3', CXXSTD: '14,17,20,latest', ADDRMD: '32,64' },
),
windows_pipeline(
"Windows VS2026 msvc-14.5",
"cppalliance/dronevs2026:1",
{ TOOLSET: 'msvc-14.5', CXXSTD: '14,17,20,latest', ADDRMD: '32,64' },
),
]
+6 -1
View File
@@ -30,7 +30,12 @@ environment:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
TOOLSET: clang-win
ADDRMD: 64
CXXSTD: 14,17,20,latest
CXXSTD: 14,17
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
TOOLSET: clang-win
ADDRMD: 64
CXXSTD: 20,latest
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ADDPATH: C:\cygwin\bin;
+17 -10
View File
@@ -156,18 +156,15 @@ inline void no_throw_failed_impl(const char* expr, const char* what, const char*
# pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
// specialize test output for char pointers to avoid printing as cstring
template <class T> inline const T& test_output_impl(const T& v) { return v; }
inline const void* test_output_impl(const char* v) { return v; }
inline const void* test_output_impl(const unsigned char* v) { return v; }
inline const void* test_output_impl(const signed char* v) { return v; }
inline const void* test_output_impl(char* v) { return v; }
inline const void* test_output_impl(unsigned char* v) { return v; }
inline const void* test_output_impl(signed char* v) { return v; }
template<class T> inline const void* test_output_impl(T volatile* v) { return const_cast<T*>(v); }
// specialize test output for pointers to avoid printing as cstring
template<class T> inline T const& test_output_impl( T const& v ) { return v; }
template<class T> inline void const* test_output_impl( T* const& v ) { return v; }
template<class T> inline void const* test_output_impl( T volatile* const& v ) { return const_cast<T*>(v); }
#if !defined( BOOST_NO_CXX11_NULLPTR )
inline const void* test_output_impl(std::nullptr_t) { return nullptr; }
inline const void* test_output_impl( std::nullptr_t ) { return nullptr; }
#endif
// print chars as numeric
@@ -210,6 +207,16 @@ inline std::string test_output_impl( char const& v )
}
}
#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L
inline std::string test_output_impl( char8_t const& v )
{
// assume that char is ASCII, compatible with char8_t
return test_output_impl( static_cast<char>( v ) );
}
#endif
// predicates
struct lw_test_eq
+3
View File
@@ -177,6 +177,9 @@ run lightweight_test_with_test.cpp
: : : $(pedantic-errors) ;
run-fail lightweight_test_with_fail.cpp ;
run lightweight_test_eq_ptr.cpp
: : : $(pedantic-errors) ;
run is_same_test.cpp ;
run typeinfo_test.cpp ;
+106
View File
@@ -0,0 +1,106 @@
// Copyright 2025 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/core/lightweight_test.hpp>
#include <boost/config.hpp>
int main()
{
{
char const* p = "12";
BOOST_TEST_EQ( p, p );
BOOST_TEST_NE( p, p + 1 );
}
{
wchar_t const* p = L"12";
BOOST_TEST_EQ( p, p );
BOOST_TEST_NE( p, p + 1 );
}
#if !defined( BOOST_NO_CXX11_CHAR16_T )
{
char16_t const* p = u"12";
BOOST_TEST_EQ( p, p );
BOOST_TEST_NE( p, p + 1 );
}
#endif
#if !defined( BOOST_NO_CXX11_CHAR32_T )
{
char32_t const* p = U"12";
BOOST_TEST_EQ( p, p );
BOOST_TEST_NE( p, p + 1 );
}
#endif
#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L
{
char8_t const* p = u8"12";
BOOST_TEST_EQ( p, p );
BOOST_TEST_NE( p, p + 1 );
}
#endif
{
int v;
int volatile* p = &v;
BOOST_TEST_EQ( p, p );
BOOST_TEST_NE( p, p + 1 );
}
{
int v;
int const volatile* p = &v;
BOOST_TEST_EQ( p, p );
BOOST_TEST_NE( p, p + 1 );
}
{
char v;
char volatile* p = &v;
BOOST_TEST_EQ( p, p );
BOOST_TEST_NE( p, p + 1 );
}
{
char v;
char const volatile* p = &v;
BOOST_TEST_EQ( p, p );
BOOST_TEST_NE( p, p + 1 );
}
{
wchar_t v;
wchar_t volatile* p = &v;
BOOST_TEST_EQ( p, p );
BOOST_TEST_NE( p, p + 1 );
}
{
wchar_t v;
wchar_t const volatile* p = &v;
BOOST_TEST_EQ( p, p );
BOOST_TEST_NE( p, p + 1 );
}
return boost::report_errors();
}
+10 -1
View File
@@ -1,6 +1,6 @@
// Test BOOST_TEST_EQ with character types
//
// Copyright 2020 Peter Dimov
// Copyright 2020, 2025 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
@@ -19,14 +19,23 @@ int main()
#if !defined(BOOST_NO_CXX11_CHAR16_T)
BOOST_TEST_EQ( u'A', u'A' );
BOOST_TEST_EQ( (char16_t)1, (char16_t)1 );
#endif
#if !defined(BOOST_NO_CXX11_CHAR32_T)
BOOST_TEST_EQ( U'A', U'A' );
BOOST_TEST_EQ( (char32_t)1, (char32_t)1 );
#endif
#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L
BOOST_TEST_EQ( u8'A', u8'A' );
BOOST_TEST_EQ( (char8_t)1, (char8_t)1 );
#endif
return boost::report_errors();