-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix strong symbol definitions in Differentiator.h. Add unittests.
- Loading branch information
1 parent
fbe246a
commit a7313b3
Showing
10 changed files
with
184 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_clad_unittest(DifferentiatorHTests | ||
DifferentiatorH.cpp | ||
MultiIncludeDifferentiatorH.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "clad/Differentiator/Differentiator.h" | ||
|
||
#include "gtest/gtest.h" | ||
|
||
TEST(DifferentiatorH, GetLength) { | ||
EXPECT_TRUE(clad::GetLength("") == 0); | ||
EXPECT_TRUE(clad::GetLength("abc") == 3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "clad/Differentiator/Differentiator.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
add_custom_target(CladUnitTests) | ||
set_target_properties(CladUnitTests PROPERTIES FOLDER "Clang tests") | ||
|
||
# LLVM builds (not installed llvm) provides gtest. | ||
if (NOT TARGET gtest) | ||
include(CladGoogleTest) | ||
include(AddCladBenchmark) | ||
endif() | ||
|
||
# add_clad_unittest(test_dirname file1.cpp file2.cpp) | ||
# | ||
# Will compile the list of files together and link against clad. | ||
# Produces a binary named 'basename(test_dirname)'. | ||
function(add_clad_unittest test_dirname) | ||
add_unittest(CladUnitTests ${test_dirname} ${ARGN}) | ||
|
||
# Remove the llvm_gtest_* coming from add_unittest. | ||
get_target_property(GTEST_LINKED_LIBS ${test_dirname} LINK_LIBRARIES) | ||
list(REMOVE_ITEM GTEST_LINKED_LIBS llvm_gtest_main llvm_gtest) | ||
set_property(TARGET ${test_dirname} PROPERTY LINK_LIBRARIES ${GTEST_LINKED_LIBS}) | ||
|
||
enable_clad_for_executable(${test_dirname}) | ||
#target_include_directories(${test_dirname}) | ||
set(gtest_libs gtest gtest_main) | ||
# Clang prior than clang13 (I think) merges both gmock into gtest. | ||
if (TARGET gmock) | ||
list(APPEND gtest_libs gmock gmock_main) | ||
endif() | ||
|
||
target_link_libraries(${test_dirname} PUBLIC ${gtest_libs}) | ||
|
||
endfunction() | ||
|
||
add_subdirectory(Basic) | ||
|