aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/balloc/test/do_with_enabled/main.cpp
blob: 02c165ccc3c25abf560ebacf438d0092974ba7d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <library/cpp/balloc/optional/operators.h>

#undef NDEBUG

#include <cstdlib>
#include <cstring>
#include <cassert>

// internal hook for the testing
extern "C" bool IsOwnedByBalloc(void* ptr);

int main() {
    char* buf = (char*)malloc(100);
    assert(true == IsOwnedByBalloc(buf));

    ThreadDisableBalloc();
    char* buf2 = (char*)malloc(100);
    assert(false == IsOwnedByBalloc(buf2));

    free(buf);
    free(buf2);

    return 0;
}