10 #define NO_CATCH_CONFIG_MAIN 11 #define CATCH_CONFIG_RUNNER 13 #define DISABLE_LOG_TO_STDOUT 18 #include "../../filesystem.h" 26 #define _fileno fileno 40 , _old_no(
_dup( _no ))
42 std::freopen( std::tmpnam(
nullptr ),
"w",
f );
46 _dup2( _old_no, _no );
103 double matlab_cost = scene.
cost - scene.
d_cost;
104 double d_cost_pct = abs( scene.
d_cost ) * 100. / matlab_cost;
123 int main(
int argc,
char * argv[] )
125 Catch::Session session;
132 bool verbose =
false;
134 bool debug_mode =
false;
138 for(
int i = 1;
i < argc; ++
i )
142 char const *
dir = argv[
i];
143 if( !strcmp( dir,
"-v" ) )
145 LOG_TO_STDOUT.
enable( verbose =
true );
148 if( ! strcmp( dir,
"-d" ) || ! strcmp( dir,
"--debug" ) )
153 if( ! strcmp( dir,
"--stats" ) )
159 TRACE(
"\n\nProcessing: " << dir <<
" ..." );
160 Catch::CustomRunContext
ctx( config );
161 ctx.set_redirection( !verbose );
169 glob( dir,
"yuy_prev_z_i.files",
179 scene_dir =
get_parent( scene_dir, &binFiles );
180 if( binFiles !=
"binFiles" )
182 auto x = strlen( dir ) + 1;
183 std::string test_name =
x > scene_dir.length() ?
"." : scene_dir.substr(
x );
191 catch_total = ctx.run_test( test_name, [&]() {
218 <<
" " << n_scenes <<
" scene totals:",
223 TRACE(
"done!\n\n" );
226 catch( std::exception
const &
e )
228 std::cerr <<
"caught exception: " << e.what() << std::endl;
233 std::cerr <<
"caught unknown exception!" << std::endl;
float memory_consumption_peak
GLuint const GLchar * name
void print_scene_stats(std::string const &name, size_t n_failed, scene_stats const &scene)
std::string join(const std::string &base, const std::string &path)
static void glob(const std::string &directory, const std::string &spec, std::function< void(std::string const &) > fn, bool recursive=true, bool includeDirectories=false)
int main(int argc, char *argv[])
GLsizei const GLchar *const * string
static std::string get_parent(std::string const &path, std::string *basename=nullptr)
size_t n_valid_scene_diff
size_t n_valid_result_diff
void enable(bool on=true)
redirect_file(FILE *f=stdout)
void compare_scene(std::string const &scene_dir, bool debug_mode=true, scene_stats *stats=nullptr)
REQUIRE_NOTHROW(rs2_log(RS2_LOG_SEVERITY_INFO,"Log message using rs2_log()", nullptr))
static const char native_separator
std::string to_string(T value)