<commit_before>//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer, deleter) ctor

// unique_ptr(pointer, deleter()) only requires MoveConstructible deleter

#include <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

int main()
{
    {
    A* p = new A[3];
    assert(A::count == 3);
    std::unique_ptr<A[], Deleter<A[]> > s(p, Deleter<A[]>());
    assert(s.get() == p);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
}<commit_msg>Add a test for uniqueptr having either NULL and nullptr<commit_after>//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer, deleter) ctor

// unique_ptr(pointer, deleter()) only requires MoveConstructible deleter

#include <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

int main()
{
    {
    A* p = new A[3];
    assert(A::count == 3);
    std::unique_ptr<A[], Deleter<A[]> > s(p, Deleter<A[]>());
    assert(s.get() == p);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);

    { // LWG#2520 says that nullptr is a valid input as well as null
    std::unique_ptr<A[], Deleter<A[]> > s1(NULL, Deleter<A[]>());
    std::unique_ptr<A[], Deleter<A[]> > s2(nullptr, Deleter<A[]>());
    }
    assert(A::count == 0);
}
{'fraction_non_alphanumeric': 0.3076216712580349, 'fraction_numerical': 0.007805325987144169, 'mean_word_length': 1.797175866495507, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '836492', 'n_tokens_mistral': 712, 'n_tokens_neox': 687, 'n_words': 183}