MCPcopy Create free account
hub / github.com/davisking/dlib / test_function_pointer

Function test_function_pointer

dlib/test/te.cpp:373–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371
372 template<template<class...> class Function, class Storage>
373 void test_function_pointer()
374 {
375 {
376 Function<Storage, void(int&)> f{global_function1};
377 DLIB_TEST(f);
378 int a = 0;
379 f(a);
380 DLIB_TEST(a == 1);
381
382 f = nullptr;
383 DLIB_TEST(!f);
384 f = global_function1;
385 DLIB_TEST(f);
386 f(a);
387 DLIB_TEST(a == 2);
388 }
389
390 /*! Use address !*/
391 {
392 Function<Storage, void(int&)> f{&global_function1};
393 DLIB_TEST(f);
394 int a = 0;
395 f(a);
396 DLIB_TEST(a == 1);
397
398 f = nullptr;
399 DLIB_TEST(!f);
400 f = &global_function1;
401 DLIB_TEST(f);
402 f(a);
403 DLIB_TEST(a == 2);
404 }
405 }
406
407 struct member_function
408 {

Callers

nothing calls this directly

Calls 1

fFunction · 0.70

Tested by

no test coverage detected