Skip to content

Commit

Permalink
refactor: mock classes for failing apple clang dynamic cast
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarDuran committed Dec 17, 2024
1 parent 7ec6018 commit 1c08e81
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 128 deletions.
16 changes: 16 additions & 0 deletions src/coreComponents/codingUtilities/tests/BaseClass.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// BaseClass.cpp
// testRTTypes
//
// Created by Omar Duran on 12/16/24.
//

#include "BaseClass.hpp"

BaseClass::BaseClass() {

};

BaseClass::~BaseClass() {

};
20 changes: 20 additions & 0 deletions src/coreComponents/codingUtilities/tests/BaseClass.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// BaseClass.hpp
// testRTTypes
//
// Created by Omar Duran on 12/16/24.
//

#ifndef BaseClass_hpp
#define BaseClass_hpp

#include <stdio.h>

class BaseClass
{
public:
explicit BaseClass();
virtual ~BaseClass();
};

#endif /* BaseClass_hpp */
16 changes: 13 additions & 3 deletions src/coreComponents/codingUtilities/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ set( testSources
testRTTypes.cpp
testUtilities.cpp )

set( dependencyList codingUtilities ${parallelDeps} )
set(mock_object_headers
BaseClass.hpp
DerivedFinalClass.hpp
)

set(mock_object_impl
BaseClass.cpp
DerivedFinalClass.cpp
)

set( dependencyList codingUtilities ${parallelDeps})

geos_decorate_link_dependencies( LIST decoratedDependencies
DEPENDENCIES ${dependencyList} )
Expand All @@ -14,9 +24,9 @@ foreach( test ${testSources} )

get_filename_component( test_name ${test} NAME_WE )
blt_add_executable( NAME ${test_name}
SOURCES ${test}
SOURCES ${test} ${mock_object_headers} ${mock_object_impl}
OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY}
DEPENDS_ON ${decoratedDependencies} gtest dataRepository)
DEPENDS_ON ${decoratedDependencies} gtest dataRepository )

geos_add_test( NAME ${test_name}
COMMAND ${test_name} )
Expand Down
11 changes: 11 additions & 0 deletions src/coreComponents/codingUtilities/tests/DerivedClassFinal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// DerivedClassFinal.cpp
// testRTTypes
//
// Created by Omar Duran on 12/16/24.
//

#include "DerivedClassFinal.hpp"

Derived::Derived() = default;

23 changes: 23 additions & 0 deletions src/coreComponents/codingUtilities/tests/DerivedClassFinal.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// DerivedClassFinal.hpp
// testRTTypes
//
// Created by Omar Duran on 12/16/24.
//

#ifndef DerivedClassFinal_hpp
#define DerivedClassFinal_hpp

#include <stdio.h>

class Derived final : public Base
{
public:
explicit Derived();

virtual ~Derived() noexcept override {

};
};

#endif /* DerivedClassFinal_hpp */
10 changes: 10 additions & 0 deletions src/coreComponents/codingUtilities/tests/DerivedFinalClass.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// DerivedFinalClass.cpp
// testRTTypes
//
// Created by Omar Duran on 12/16/24.
//

#include "DerivedFinalClass.hpp"

DerivedFinalClass::DerivedFinalClass() = default;
24 changes: 24 additions & 0 deletions src/coreComponents/codingUtilities/tests/DerivedFinalClass.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// DerivedFinalClass.hpp
// testRTTypes
//
// Created by Omar Duran on 12/16/24.
//

#ifndef DerivedFinalClass_hpp
#define DerivedFinalClass_hpp

#include <stdio.h>
#include "BaseClass.hpp"

class DerivedFinalClass final : public BaseClass
{
public:
explicit DerivedFinalClass();

virtual ~DerivedFinalClass() noexcept override {

};
};

#endif /* DerivedFinalClass_hpp */
Loading

0 comments on commit 1c08e81

Please sign in to comment.