简体   繁体   中英

How to auto run one hundred C++ functions with same parameters?

I have a C++ binary library.

There are almost one hundred C++ functions with different name, but same parameter types and same return type. And the values they parameter can be are equal.

I now want to test all of them with all of parameter values. And maybe return values to txt files.

How can I realize this? I want to store function names in a string list, and use eval() like python, but C++ doesn't have this feature.

Thank you!

In C++ you can create an array of function pointers and then loop over that array, calling each of the functions and giving always the same values to parameters from corresponding unchanging variables.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM