Skip to content

Exercises related to Testing

Write a test program for unique_ptr

Exercice 1

Based on the instructions given in the testing codelab, add a test function to the ptr_test test program to check that the ownership is passed correctly between two instances of `std::unique_ptr.

Implement the test and verify that it is successful.

Write a test program for raw pointers

Exercice 2

Based on the instructions given in the testing codelab, add the following test function to the ptr_test test program: test that when creating a raw pointer and deallocating it correctly, the destructor is called as expected.

Implement the test and verify that it is successful.