These are chat archives for symengine/symengine

25th
Jun 2015
Ondřej Čertík
@certik
Jun 25 2015 01:36 UTC
@Sumith1896 put it into symengine/catch/catch.hpp for now.
Later we can move all third party libraries into something like symengine/tpl
Sumith Kulal
@Sumith1896
Jun 25 2015 09:59 UTC
As a standard practice in Catch it is suggested to use only one main, so as to not compile the header file multiple times. But we have 7 folders of tests. Any idea on how to handle them with one main?
@isuruf @certik Any suggestions?
Basic worry, I can have one main for each folder using a header file or so
How do I do for multiple folders?
Isuru Fernando
@isuruf
Jun 25 2015 10:05 UTC
Have a main at a file in symengine/tests ?
Sumith Kulal
@Sumith1896
Jun 25 2015 10:08 UTC
How to execute the cpps in folders?
Isuru Fernando
@isuruf
Jun 25 2015 10:12 UTC
You can include them by using the folder name right?
Sumith Kulal
@Sumith1896
Jun 25 2015 10:21 UTC
So if I have a header file in each folder, and include in the main outside.
will that do?
Isuru Fernando
@isuruf
Jun 25 2015 10:25 UTC
I think so. I'm not sure about it.
Sumith Kulal
@Sumith1896
Jun 25 2015 10:25 UTC
Cool let me try
I want to get it with ctest right too, that's troubling me a bit
Sumith Kulal
@Sumith1896
Jun 25 2015 11:45 UTC
I have gotten it working but there is one problem
since there is only one main, there is only one executable
Hence, ctest now doesn't give a breakdown, just pass or fail, then one has to execute the Catch generated executable to see where it breaks
Is there a way in which ctest runs this new executable instead of the old ones?
So, if something breaks, user is notified at first go.
Isuru Fernando
@isuruf
Jun 25 2015 11:51 UTC
you can add it by using add_test
Francesco Biscani
@bluescarni
Jun 25 2015 11:55 UTC
just noticed this on the C++ subreddit, might be interesting @Sumith1896 https://vimeo.com/131632252
Sumith Kulal
@Sumith1896
Jun 25 2015 11:57 UTC
I saw the whole yesterday night :smile:
Very interesting points, BDD etc
Francesco Biscani
@bluescarni
Jun 25 2015 11:58 UTC
cool :)
Sumith Kulal
@Sumith1896
Jun 25 2015 11:59 UTC
But what troubles me is that we have multiple test files
And it is not an option to include headers in all
Is there a way to overrride ctest so that I can pass another executable?
Sumith Kulal
@Sumith1896
Jun 25 2015 15:06 UTC
I'll send in a PR, maybe we can discuss there.
Sumith Kulal
@Sumith1896
Jun 25 2015 15:55 UTC
The Catch team helped me out.
I have switched successfully, do have a look sympy/symengine#484
Sumith Kulal
@Sumith1896
Jun 25 2015 17:04 UTC
@isuruf you there?
Isuru Fernando
@isuruf
Jun 25 2015 17:04 UTC
yes
Sumith Kulal
@Sumith1896
Jun 25 2015 17:05 UTC
I was thinking of the Catch main to be like this
#define CATCH_CONFIG_RUNNER
#include "catch.hpp"
int main( int argc, char* const argv[] )
{
  print_stack_on_segfault();
  int result = Catch::Session().run( argc, argv );
  mpfr_free_cache() 
  return result;
}
What do you think?
Isuru Fernando
@isuruf
Jun 25 2015 17:06 UTC
Yes, that should do it
Sumith Kulal
@Sumith1896
Jun 25 2015 17:06 UTC
I'll add flint clean up etc.
But that should be on option only, right?
Isuru Fernando
@isuruf
Jun 25 2015 17:07 UTC
You only want to call mpfr_free_cache only when HAVE_SYMENGINE_MPFR is defined
yes
Sumith Kulal
@Sumith1896
Jun 25 2015 17:07 UTC
Yes
through a config file?
Isuru Fernando
@isuruf
Jun 25 2015 17:07 UTC
symengine/symengine_config.h
Sumith Kulal
@Sumith1896
Jun 25 2015 17:08 UTC
Yes, let me get to it.
Thanks @isuruf
Sumith Kulal
@Sumith1896
Jun 25 2015 18:00 UTC
I am getting this error
/home/sumith/github/csympy/symengine/catch/catch.cpp:7:40: fatal error: symengine/symengine_config.h: No such file or directory
 #include <symengine/symengine_config.h>
                                        ^
compilation terminated.
I don't have to link it, do I?
Isuru Fernando
@isuruf
Jun 25 2015 18:04 UTC

In symengine/CMakeLists.txt

add_subdirectory(catch)

# Include Catch headers:
include_directories(BEFORE ${catch_SOURCE_DIR})

These lines needs to be moved to the end just before the tests, so that this add_subdirectory(catch) would happen after include_directories(BEFORE ${symengine_SOURCE_DIR})

Sumith Kulal
@Sumith1896
Jun 25 2015 18:32 UTC
Cool, This^ works
@certik I would like to finalize the next works as soon as possible.
Sumith Kulal
@Sumith1896
Jun 25 2015 18:37 UTC
Just that whenever I write a post, I plan something and then end up doing something else :smile:
Also what should be included so that I can use this using SymEngine::print_stack_on_segfault; in catch.cpp?
Isuru Fernando
@isuruf
Jun 25 2015 18:39 UTC
symengine/symengine_rcp.h
Sumith Kulal
@Sumith1896
Jun 25 2015 19:20 UTC
Thanks @isuruf
sympy/symengine#484 is now ready
Ondřej Čertík
@certik
Jun 25 2015 23:39 UTC
Thanks @Sumith1896 for your work. Porting to Catch is extremely useful.