C/C++ API Reference
Loading...
Searching...
No Matches
static_library_support.h
1// Copyright 2022 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14#pragma once
15
16#include "pw_unit_test/framework.h"
17
19
37#define PW_UNIT_TEST_LINK_FILE_CONTAINING_TEST(suite, name) \
38 _PW_UNIT_TEST_LINK_TESTS(_pw_unit_test_Info_##suite##_##name)
39
41
42#define _PW_UNIT_TEST_LINK_TESTS(info) \
43 extern "C" { \
44 \
45 extern ::pw::unit_test::internal::TestInfo info; \
46 \
47 [[maybe_unused]] const ::pw::unit_test::internal::ReferToTestInfo \
48 _pw_unit_test_reference_to_ensure_link_##info(info); \
49 \
50 } /* extern "C" */ \
51 \
52 static_assert(true, "Macros must end with a semicolon")
53
54namespace pw::unit_test::internal {
55
56// Refers to the TestInfo to ensure it is linked in.
58 public:
59 explicit ReferToTestInfo(const TestInfo& info);
60};
61
62} // namespace pw::unit_test::internal
Definition: static_library_support.h:57
Definition: framework_backend.h:672