Skip to content
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

Added missing virtual destructors #218

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions api/Print.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class Print
void setWriteError(int err = 1) { write_error = err; }
public:
Print() : write_error(0) {}
virtual ~Print() {}


int getWriteError() { return write_error; }
void clearWriteError() { setWriteError(0); }
Expand Down
1 change: 1 addition & 0 deletions api/Printable.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Print;
class Printable
{
public:
virtual ~Printable() {}
virtual size_t printTo(Print& p) const = 0;
};

Expand Down
20 changes: 19 additions & 1 deletion test/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
build
build
### CMake ###
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

### CMake Patch ###
CMakeUserPresets.json

# External projects
*-prefix/
15 changes: 13 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ cmake_minimum_required(VERSION 2.8)

project(test-ArduinoCore-API)

Include(FetchContent)

FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.4.0
)

FetchContent_MakeAvailable(Catch2)

##########################################################################

include_directories(..)
include_directories(include)
include_directories(external/catch/v2.13.9/include)

##########################################################################

Expand Down Expand Up @@ -103,6 +112,7 @@ set(TEST_SRCS
src/WCharacter/test_isUpperCase.cpp
src/WCharacter/test_isWhitespace.cpp
src/WCharacter/test_toAscii.cpp
src/Interfaces/test_virtualDestructor.cpp
)

set(TEST_DUT_SRCS
Expand All @@ -118,7 +128,6 @@ set(TEST_DUT_SRCS
##########################################################################

set(TEST_TARGET_SRCS
src/main.cpp
src/dtostrf.cpp
src/itoa.cpp
src/MillisFake.cpp
Expand All @@ -144,5 +153,7 @@ add_executable(
${TEST_TARGET_SRCS}
)

target_link_libraries( ${TEST_TARGET} Catch2WithMain )

##########################################################################

Loading
Loading