Skip to content
Snippets Groups Projects
Commit d89457bb authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

[cleanup] Remove nullptr tests.

parent 823c5ef8
Branches
Tags
No related merge requests found
......@@ -23,7 +23,6 @@ set(TESTS
mpiguardtest
mpihelpertest
mpihelpertest2
nullptr_test
pathtest
parametertreelocaletest
parametertreetest
......@@ -52,7 +51,7 @@ set(COMPILEFAILTESTS
check_fvector_size_fail1
check_fvector_size_fail2
genericiterator_compile_fail
nullptr-test-fail)
)
# Add the executables needed for the tests
add_executable("arraylisttest" arraylisttest.cc)
......@@ -122,12 +121,6 @@ target_link_libraries(mpihelpertest2 "dunecommon")
add_DUNE_MPI_flags(mpihelpertest2)
set_target_properties(mpihelpertest2 PROPERTIES COMPILE_FLAGS "-DMPIHELPER_PREINITIALIZE")
add_executable("nullptr_test" nullptr-test.cc nullptr-test2.cc)
target_link_libraries(nullptr_test "dunecommon")
add_executable("nullptr_test_fail" EXCLUDE_FROM_ALL nullptr-test.cc)
target_link_libraries(nullptr_test_fail "dunecommon")
set_target_properties(nullptr_test_fail PROPERTIES COMPILE_FLAGS "-DFAIL")
add_executable("parametertreelocaletest" parametertreelocaletest.cc)
target_link_libraries("parametertreelocaletest" "dunecommon")
......
......@@ -25,7 +25,6 @@ TESTPROGS = \
mpiguardtest \
mpihelpertest \
mpihelpertest2 \
nullptr-test \
pathtest \
parametertreelocaletest \
parametertreetest \
......@@ -53,8 +52,7 @@ COMPILE_XFAIL=$(DUNE_COMMON_BIN)/xfail-compile-tests
COMPILE_XFAIL_TESTS = \
check_fvector_size_fail1 \
check_fvector_size_fail2 \
genericiterator_compile_fail \
nullptr-test-fail
genericiterator_compile_fail
compile_XFAIL:
for i in $(COMPILE_XFAIL_TESTS); do \
......@@ -160,10 +158,6 @@ mpihelpertest2_CPPFLAGS = $(AM_CPPFLAGS) $(DUNEMPICPPFLAGS) -DMPIHELPER_PREINITI
mpihelpertest2_LDADD = $(DUNEMPILIBS) $(LDADD)
mpihelpertest2_LDFLAGS = $(AM_LDFLAGS) $(DUNEMPILDFLAGS)
nullptr_test_SOURCES = nullptr-test.cc nullptr-test2.cc
nullptr_test_fail_SOURCES = nullptr-test.cc
nullptr_test_fail_CPPFLAGS = $(AM_CPPFLAGS) -DFAIL
parametertreelocaletest_SOURCES = parametertreelocaletest.cc
parametertreetest_SOURCES = parametertreetest.cc
......
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <dune/common/nullptr.hh>
#include <dune/common/unused.hh>
void basic_tests()
{
typedef Dune::nullptr_t NULLPTR_T DUNE_UNUSED;
char* ch = nullptr; // ch has the null pointer value
char* ch2 = 0; // ch2 has the null pointer value
#ifdef FAIL
int n = nullptr; // error
++n;
#endif
int n2 = 0; // n2 is zero
if( ch == 0 ) // evaluates to true
;
if( ch == nullptr ) // evaluates to true
;
if( nullptr == ch ) // evaluates to true
;
if( ch ) // evaluates to false
;
if( n2 == 0 ) // evaluates to true
;
ch = ch2;
#ifdef FAIL
if( n2 == nullptr ) // error
;
if( nullptr ) // error, no conversion to bool
;
if( nullptr == 0 ) // error
;
// arithmetic
nullptr = 0; // error, nullptr is not an lvalue
nullptr + 2; // error
#endif
}
int main()
{
basic_tests();
return 0;
}
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <dune/common/nullptr.hh>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment