Re : [Block Pointer] make_block

Hi Phil,
Phil Bouchard <philippe@fornux.com> wrote : We can see it in action in the following example: https://svn.boost.org/svn/boost/sandbox/block_ptr/libs/smart_ptr/example/blo...
A detail : I think you could improve your sample by replacing __FUNCTION__ by BOOST_CURRENT_FUNCTION (which is more portable), or by writing directly the name of the function.
Is it time for a review? I looked for automated tests in the sandbox directory (not examples) and I did not find any.
Instead of doing "cout", you could use a class like that : class ForTests { static int counter; // incremented at each construction int id; // id = current value of the counter in the constructor static std::vector<int> destructionOrder; }; Each destruction pushes the id in the destructionOrder vector. Then at the end of the program you just need to compare the content of destructionOrder with what you should expect (and return 1 or 0). Also the same might be done for construction. Good job BTW, and good luck for the review, Pierre Morcello

On 4/30/2011 12:31 AM, Pierre Morcello wrote:
Hi Phil,
A detail : I think you could improve your sample by replacing __FUNCTION__ by BOOST_CURRENT_FUNCTION (which is more portable), or by writing directly the name of the function.
Is it time for a review? I looked for automated tests in the sandbox directory (not examples) and I did not find any.
I completely forgot about that, thanks for the hint.
Instead of doing "cout", you could use a class like that : class ForTests { static int counter; // incremented at each construction int id; // id = current value of the counter in the constructor static std::vector<int> destructionOrder; }; Each destruction pushes the id in the destructionOrder vector. Then at the end of the program you just need to compare the content of destructionOrder with what you should expect (and return 1 or 0). Also the same might be done for construction.
Good job BTW, and good luck for the review,
Right on...! -Phil

On 4/30/2011 12:31 AM, Pierre Morcello wrote:
Instead of doing "cout", you could use a class like that : class ForTests { static int counter; // incremented at each construction int id; // id = current value of the counter in the constructor static std::vector<int> destructionOrder; }; Each destruction pushes the id in the destructionOrder vector. Then at the end of the program you just need to compare the content of destructionOrder with what you should expect (and return 1 or 0). Also the same might be done for construction.
I added the automated test here: https://svn.boost.org/svn/boost/sandbox/block_ptr/libs/smart_ptr/test/block_... I am having issues with the Jamfile but there's a Makefile which works well. -Phil
participants (2)
-
Phil Bouchard
-
Pierre Morcello