UrielCh/opencv-sandbox

Add unit test for class and function

Opened this issue · 5 comments

Actual

no unit test on generator

Expected

Class :

  1. use AKAZE and create a unit test for class_info.gen_header_code(codegen)
  2. Test a simple function with one variant
  3. Test the AKAZEWrapper::Init generation
  4. Test the constructor AKAZEWrapper::AKAZEWrapper
  5. test a 2 variants function Algorithm.write

func : use cv.Algorithm.write with 2 variants

@UrielCh just to cross-check

Please confirm the last manually-generated template is the one in https://github.com/UrielCh/opencv-sandbox/blob/class/cc-obj/AKAZE.h

Thanks

Let me check if some vacuuming is still necessary .....

the 2 folder cc-v4/ and cc-obj/ are up to date

I would like to check with you the constructor behavior in https://github.com/UrielCh/opencv-sandbox/blob/broken/cc-obj/AKAZE.cpp

I'm seeing multiple constructor/create methods :

  1. CreateStatic https://github.com/UrielCh/opencv-sandbox/blob/class/cc-obj/AKAZE.cpp#L235
  2. AKAZEWrapper::Init https://github.com/UrielCh/opencv-sandbox/blob/class/cc-obj/AKAZE.cpp#L241
  3. AKAZEWrapper::AKAZEWrapper(const Napi::CallbackInfo &info, const cv::Ptr<cv::AKAZE> &akaze) https://github.com/UrielCh/opencv-sandbox/blob/class/cc-obj/AKAZE.cpp#L285
  4. AKAZEWrapper::AKAZEWrapper(const Napi::CallbackInfo &info) https://github.com/UrielCh/opencv-sandbox/blob/class/cc-obj/AKAZE.cpp#L285

Excuse my C++ question if some of them sounds dumb

Here are my questions :
A. I get that 1. CreateStatic is the binding for AKAZE.create, but why are we using New in it, i feel it would make more sense to do cv::AKAZE::create in order to use the same generator pattern for all the static fns
B. On 2. and 3. i'm not clear about the role of each, is it really needed to have 3. ?
C. Why 3. is empty ? DOes it means it should be implemented next or is it normal ?
D. I understand that 4. is an old generated version, but why is it still here, do we need to remove it or to generate it ?

Thanks for your feedbacks

I think AKAZE have an init function, so ne regular constructor is kind of private.
most class do not have an static init method.