Pigweed
 
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
35#define PW_UNIT_TEST_LINK_FILE_CONTAINING_TEST(suite, name) \
36 _PW_UNIT_TEST_LINK_TESTS(_pw_unit_test_Info_##suite##_##name)
37
38#define _PW_UNIT_TEST_LINK_TESTS(info) \
39 extern "C" { \
40 \
41 extern ::pw::unit_test::internal::TestInfo info; \
42 \
43 [[maybe_unused]] const ::pw::unit_test::internal::ReferToTestInfo \
44 _pw_unit_test_reference_to_ensure_link_##info(info); \
45 \
46 } /* extern "C" */ \
47 \
48 static_assert(true, "Macros must end with a semicolon")
49
50namespace pw::unit_test::internal {
51
52// Refers to the TestInfo to ensure it is linked in.
54 public:
55 explicit ReferToTestInfo(const TestInfo& info);
56};
57
58} // namespace pw::unit_test::internal
Definition: static_library_support.h:53
Definition: framework_backend.h:642