[libc] Switch to using the generic `<gpuintrin.h>` implementations (#121810)
[llvm-project.git] / libc / test / UnitTest / ZxTest.h
blob0881902d62b3b5344bafb83e979f36366e20cfe7
1 //===-- Header for using Fuchsia's zxtest framework ------------*- C++ -*-===//
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 #ifndef LLVM_LIBC_UTILS_UNITTEST_ZXTEST_H
10 #define LLVM_LIBC_UTILS_UNITTEST_ZXTEST_H
12 #include "src/__support/macros/config.h"
13 #include <zxtest/zxtest.h>
15 #define WITH_SIGNAL(X) #X
17 // These macros are used in string unittests.
18 #define ASSERT_ERRNO_EQ(VAL) \
19 ASSERT_EQ(VAL, static_cast<int>(LIBC_NAMESPACE::libc_errno))
20 #define ASSERT_ERRNO_SUCCESS() \
21 ASSERT_EQ(0, static_cast<int>(LIBC_NAMESPACE::libc_errno))
22 #define ASSERT_ERRNO_FAILURE() \
23 ASSERT_NE(0, static_cast<int>(LIBC_NAMESPACE::libc_errno))
25 #ifndef EXPECT_DEATH
26 // Since zxtest has ASSERT_DEATH but not EXPECT_DEATH, wrap calling it
27 // in a lambda returning void to swallow any early returns so that this
28 // can be used in a function that itself returns non-void.
29 #define EXPECT_DEATH(FUNC, SIG) ([&] { ASSERT_DEATH(FUNC, SIG); }())
30 #endif
32 namespace LIBC_NAMESPACE_DECL {
33 namespace testing {
35 using Test = ::zxtest::Test;
37 } // namespace testing
38 } // namespace LIBC_NAMESPACE_DECL
40 // zxtest does not have gmock-style matchers.
41 #define LIBC_TEST_HAS_MATCHERS() (0)
43 #endif // LLVM_LIBC_UTILS_UNITTEST_ZXTEST_H