Skip to content

Commit f40608e

Browse files
committed
Add testing export macros
1 parent 36d16d7 commit f40608e

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

Code/max/Testing/TestingExport.hpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2026, The max Contributors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#ifndef MAX_TESTING_EXPORT_HPP
6+
#define MAX_TESTING_EXPORT_HPP
7+
8+
// There are functions which are only used within a given translation unit.
9+
// They should not be exported to the linker.
10+
11+
// However, you will want to test those functions. And since the test code
12+
// likely lives in a different file, you *will* want the functions to be
13+
// exported to the linker.
14+
15+
// If a project has the definition MAX_TEST, these macros will export the
16+
// functions marked with them.
17+
// A normal project won't define MAX_TEST and so the functions remain hidden.
18+
19+
#ifdef MAX_TEST
20+
#define MAX_TESTING_EXPORT_DECLARATION( Declaration ) Declaration
21+
#define MAX_TESTING_EXPORT_DEFINITION( Definition ) Definition
22+
#else
23+
#define MAX_TESTING_EXPORT_DECLARATION( Declaration )
24+
#define MAX_TESTING_EXPORT_DEFINITION( Definition ) static Definition
25+
#endif
26+
27+
#endif // #ifndef MAX_TESTING_EXPORT_HPP

Projects/VisualStudio/max/max.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@
289289
<ClInclude Include="..\..\..\Code\max\Logging\DoNothingLogger.hpp" />
290290
<ClInclude Include="..\..\..\Code\max\Testing\CoutResultPolicy.hpp" />
291291
<ClInclude Include="..\..\..\Code\max\Testing\Test.hpp" />
292+
<ClInclude Include="..\..\..\Code\max\Testing\TestingExport.hpp" />
292293
<ClInclude Include="..\..\..\Code\max\Testing\TestSuite.hpp" />
293294
</ItemGroup>
294295
<ItemGroup>

Projects/VisualStudio/max/max.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@
492492
<ClInclude Include="..\..\..\Code\max\Algorithms\DeferTest.hpp">
493493
<Filter>Code\max\Algorithms</Filter>
494494
</ClInclude>
495+
<ClInclude Include="..\..\..\Code\max\Testing\TestingExport.hpp">
496+
<Filter>Code\max\Testing</Filter>
497+
</ClInclude>
495498
</ItemGroup>
496499
<ItemGroup>
497500
<ClCompile Include="..\..\..\Code\max\Algorithms\IsBetweenTest.cpp">

0 commit comments

Comments
 (0)