Changed from google test to catch#961
Changed from google test to catch#961alecjacobson merged 5 commits intolibigl:devfrom teseoch:catch2
Conversation
alecjacobson
left a comment
There was a problem hiding this comment.
This is great. We can't merge until all tests are ported.
tests/CMakeLists.txt
Outdated
|
|
||
| SET(TEST_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}) | ||
| list(APPEND CMAKE_MODULE_PATH ${LIBIGL_EXTERNAL}/Catch2/contrib) | ||
| INCLUDE_DIRECTORIES(${TEST_ROOT_DIR}) |
There was a problem hiding this comment.
I think the TEST_ROOT_DIR and the include_directory can go away now. Or at least should use an interface target like the tutorials.
tests/CMakeLists.txt
Outdated
| # (last added will run first and those should be the fastest tests) | ||
| IF(LIBIGL_WITH_MOSEK) | ||
| ADD_SUBDIRECTORY(${TEST_ROOT_DIR}/include/igl/mosek) | ||
| file(GLOB TEST_SRC_FILES ${TEST_ROOT_DIR}/include/igl/mosek/*.cpp) |
There was a problem hiding this comment.
${TEST_ROOT_DIR}/ is just . in this case, can be removed.
tests/CMakeLists.txt
Outdated
| file(GLOB TEST_INC_FILES ${TEST_ROOT_DIR}/include/igl/copyleft/boolean/*.h ${TEST_ROOT_DIR}/include/igl/copyleft/cgal/*.h ${TEST_ROOT_DIR}/include/igl/copyleft/boolean/*.inl ${TEST_ROOT_DIR}/include/igl/copyleft/cgal/*.inl) | ||
| target_sources(libigl_tests PRIVATE ${TEST_SRC_FILES} ${TEST_INC_FILES}) | ||
|
|
||
| target_link_libraries(libigl_tests PUBLIC igl::igl::cgal) |
There was a problem hiding this comment.
Should be target_link_libraries(libigl_tests PUBLIC igl::cgal)
|
|
||
| avg = igl::avg_edge_length(V,F); | ||
| ASSERT_NEAR((12.*sqrt(side_sq) + 6.*sqrt(diag_sq))/(12.+6.), avg, epsilon); | ||
| REQUIRE (avg == Approx ((12.*sqrt(side_sq) + 6.*sqrt(diag_sq))/(12.+6.)).margin( epsilon)); |
There was a problem hiding this comment.
I would remove the space between the macro and the parenthesis (to keep it consistent).
There was a problem hiding this comment.
this part was autogenerated with a script. There might be a lot of cases like that. I dont think it is worth to time investment
There was a problem hiding this comment.
find tests/ -exec sed -i 's/REQUIRE (/REQUIRE(/g' {} \; (may need to escape the ().
There was a problem hiding this comment.
On mac you need sed -i "" 's/...' instead.
|
I fixed the couple of stuff in the cmake and reneabled the test with parameters. With respect to the old version, it generates only 1 test case per set of parameters. I think it makes more sense. |
|
Mmm it seems to me that all tests have been ported (except bbw on windows which has some issues, but the test passes on mac and linux). @teseoch could you confirm? If that's the case I think we should merge this ASAP and polish it later. This PR is blocking all the other ones that require unit tests. |
|
We also need a well documented conversion script for PRs or other existing
gtests.
…On Tue, Oct 23, 2018 at 20:56 Daniele Panozzo ***@***.***> wrote:
Mmm it seems to me that all tests have been ported (except bbw on windows
which has some issues, but the test passes on mac and linux). @teseoch
<https://github.com/teseoch> could you confirm? If that's the case I
think we should merge this ASAP and polish it later. This PR is blocking
all the other ones that require unit tests.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#961 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACI0mRfY1xj3fe4cn4UocWL59sK0AN_Aks5un2ZygaJpZM4Xxg8m>
.
|
|
There's only one other PRs (for embree). But the documentation on the website for the unit tests is a bit outdated (it still refers to the old repo). |
|
I have many tests that I haven’t pushed yet. We should document the
conversion process.
…On Tue, Oct 23, 2018 at 21:08 Jérémie Dumas ***@***.***> wrote:
There's only one other PRs (for embree). But the documentation on the
website for the unit tests is a bit outdated (it still refers to the old
repo).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#961 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACI0mQxuBJ20kGfO-kcs6z1Wd93DgcDgks5un2kmgaJpZM4Xxg8m>
.
|
|
I have used this script to convert gtest into catch2 testes |
|
This looks good to me and the script is a good way to convert old tests. @alecjacobson can we merge? I would like to enable the testing on windows which depends on this PR. |
|
Enabling the testing on Windows is independent from this PR, it's just a matter of setting proper flags in the CMake. |
|
Can we merge #952 (which uses Google Test) before we merge this PR? |
|
@alecjacobson can you review your review? |
| @@ -134,10 +134,10 @@ function(igl_download_triangle) | |||
| endfunction() | |||
|
|
|||
| ## Google test | |||
|
I also have some unit tests that I want to create and push, but maybe it is better to wait until this pr is merged? |
|
It'd make sense to merge this one first and then convert existing PRs and use Catch2 for writing new tests. |
|
Also, catch2 has the interesting tag feature. Currently, we are using the same tag, |
|
Agreed. Can have one tag per module for now (core, cgal, embree, etc.). |
|
i am using the suite name for the different modules eg shall we merge? |
|
@teseoch does that script work for TEST and TEST_P ? |
|
@alecjacobson no the script dosent work with TEST_P. To change the TEST_P you need to move the content of the TEST_P in a lambda like You can look at the this file: |
|
Is it possible to script this? There are some new tests that need to be converted. |
|
Unless you have >10 new tests that use |
|
can we merge before pushing new tests? |
Still missing to port
INSTANTIATE_TEST_CASE_PCheck all that apply (change to
[x])