A small idea for a C ++ unit test

xiaoxiao2021-03-06  153

???????? In Python, each module has a self-test code, although it is not forced, but it is recommended, I think this is very good.

???????? This is included with one (or more) use cases, which is convenient for others to verify ???????? And I think: This technology is also easier to implement in C !?? ?????? //*.h file

???????? Class Declarations ...

???????? //*.cpp file

???????? Class Definitions ...

???????? #ifndef no_self_test

???????? void main () {

????????????? // ...

????????}

????????? # ENDIF

Such each module can be compiled separately. At the same time, it is assembled to other works, because the project defines the macro '' '' '' ', so that the main function of each module will not be compiled, it will not cause error in connecting.

转载请注明原文地址:https://www.9cbs.com/read-128365.html

New Post(0)