Boost unit testing main function?

后端 未结 4 1972
[愿得一人]
[愿得一人] 2021-01-11 16:51

How do I define my own main() function when testing with boost?

Boost is using it\'s own main function, but I\'m using a custom memory manager and it ne

4条回答
  •  耶瑟儿~
    2021-01-11 17:14

    I do not believe you actually need your own main. I think you are much better off with global fixture:

    struct AllocatorSetup {
        AllocatorSetup()   { /* setup your allocator here */ }
        ~AllocatorSetup()  { /* shutdown your allocator/check memory leaks here */ }
    };
    
    BOOST_GLOBAL_FIXTURE( AllocatorSetup );
    

提交回复
热议问题