0

Often I see this type of declaration+implementation in C++ when I read some codes from OpenCV or OpenCascade

TEST(Shape_SCD, regression)
{
    const int NSN_val=5;//10;//20; //number of shapes per class
    const int NP_val=120; //number of points simplifying the contour
    const float CURRENT_MAX_ACCUR_val=95; //99% and 100% reached in several tests, 95 is fixed as minimum boundary
    ShapeBaseTest<float, computeShapeDistance_Chi> test(NSN_val, NP_val, CURRENT_MAX_ACCUR_val);
    test.safe_run();
}

This can turn out to be a silly question, isn't it? since I don't get what type of declaration this is. It does look like a function but there is no return type. If it is a constructor, why isn't there any type of the variables in argument list?

Thanks

Iharob Al Asimi
  • 52,653
  • 6
  • 59
  • 97
TSL_
  • 2,049
  • 3
  • 34
  • 55
  • or I might think this is a macro defined elsewhere in the library? this should be right :D – TSL_ Nov 24 '15 at 02:49
  • 4
    It looks like a test definition using the google test framework (https://github.com/google/googletest) – Paul Rooney Nov 24 '15 at 02:55
  • @PaulRooney Technically that doesn't answer his question. They're macros. – erip Nov 24 '15 at 02:58
  • 1
    Since this is opencv we are talking about, https://github.com/Itseez/opencv/blob/master/modules/ts/include/opencv2/ts/ts_ext.hpp – T.C. Nov 24 '15 at 03:23
  • Thanks @PaulRooney! you open me up to the concept of test framework. @T.C. ok! so OpenCV has its test framework of its own. Both are interesting for me to know more! – TSL_ Nov 24 '15 at 05:43

1 Answers1

2

TEST is a macro. After the macro is expanded, this will be a normal function definition (with a return type). You should be able to see this if you look up the definition of the macro.

user253751
  • 57,427
  • 7
  • 48
  • 90