Changeset 122c3b8 in mainline


Ignore:
Timestamp:
2018-07-05T21:41:24Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
17012fcf
Parents:
8349334
git-author:
Dzejrou <dzejrou@…> (2018-05-15 22:21:45)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:24)
Message:

cpp: added tests for unique_ptr<T[]>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/src/internal/test/memory.cpp

    r8349334 r122c3b8  
    8787        }
    8888        test_eq("unique_ptr move pt2", mock::destructor_calls, 1U);
     89
     90        mock::clear();
     91        {
     92            auto ptr = std::make_unique<mock[]>(10U);
     93            test_eq("unique_ptr make_unique array version", mock::constructor_calls, 10U);
     94
     95            new(&ptr[5]) mock{};
     96            test_eq("placement new into the array", mock::constructor_calls, 11U);
     97            test_eq("original not destroyed during placement new", mock::destructor_calls, 0U);
     98        }
     99        test_eq("unique_ptr array out of scope", mock::destructor_calls, 10U);
    89100    }
    90101}
Note: See TracChangeset for help on using the changeset viewer.