[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / lldb / unittests / Core / StreamCallbackTest.cpp
blobd0e50b6864dd65af4b545a98573343a688f9b909
1 //===-- StreamCallbackTest.cpp --------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Utility/StreamCallback.h"
10 #include "gtest/gtest.h"
12 using namespace lldb;
13 using namespace lldb_private;
15 static char test_baton;
16 static size_t callback_count = 0;
17 static void TestCallback(const char *data, void *baton) {
18 EXPECT_STREQ("Foobar", data);
19 EXPECT_EQ(&test_baton, baton);
20 ++callback_count;
23 TEST(StreamCallbackTest, Callback) {
24 StreamCallback stream(TestCallback, &test_baton);
25 stream << "Foobar";
26 EXPECT_EQ(1u, callback_count);