sltest.CodeImporter.SandboxSettings Class
Namespace: sltest.CodeImporter
Description
Use an object of the sltest.CodeImporter.SandboxSettings
class to configure
a sandbox for C code unit testing. Creating an sltest.CodeImporter
object also
creates a SandboxSettings
object with default values.
SandboxSettings
objects do not apply when the TestType
setting of the sltest.CodeImporter
object is
IntegrationTest
.
Properties
Mode
— Sandbox generation mode
"GenerateAggregatedHeader"
(default) | "GeneratePreprocessedSource"
| "UseOriginalCode"
Sandbox generation mode, specified as one of these values:
"GenerateAggregatedHeader"
— For a single C code source file, generates a sandbox that includes a minimal, aggregated header file and stubs for undefined symbols. The header file contains the symbols required for compilation."GeneratePreprocessedSource"
— Generates a sandbox containing the preprocessed version of the C code source files and creates stubs for undefined symbols."UseOriginalCode"
— Generates a sandbox using the original C code without any modifications. However, if the code has undefined symbols, theCodeImporter
creates stub files.
Attributes:
GetAccess | public |
SetAccess | public |
CopySourceFiles
— Whether to copy source files into the sandbox
true
or 1
(default) | false
or 0
Whether to copy specified source files into the sandbox, specified as a numeric or
logical 1
(true
) or 0
(false
). When CopySourceFiles
is
1
or true
,
If
Mode
isGenerateAggregatedHeader
, theCodeImporter
copies the specified source file to the sandboxsrc
folder.If
Mode
isUseOriginalCode
, theCodeImporter
copies the required header and source files to the sandboxinclude
andsrc
folders, respectively.If
Mode
isGeneratePreprocessedSource
, theCopySourceFiles
setting is ignored.
Attributes:
GetAccess | public |
SetAccess | public |
RemoveAllPragma
— Whether to remove pragmas from code files
false
or 0
(default) | true
or 1
Whether to remove pragmas from code files, specified as a numeric or logical
1
(true
) or 0
(false
). When RemoveAllPragma
is
true
or 1
,
If
Mode
isGenerateAggregatedHeader
, theCodeImporter
removes all#pragma
instances from the aggregated header file.If
Mode
isGeneratePreprocessedSource
, theCodeImporter
removes all#pragma
instances from the preprocessed source.If
Mode
isUseOriginalCode
,RemoveAllPragma
is ignored.
Attributes:
GetAccess | public |
SetAccess | public |
RemoveVariableDefinitionInHeader
— Whether to remove global definitions
false
or 0
(default) | true
or 1
Whether to remove all global variable definitions
in the generated header file and replace them with extern declarations, specified as a
numeric or logical 1
(true
) or
0
(false
).
RemoveVariableDefinitionInHeader
applies only to
GenerateAggregatedHeader
mode. When
RemoveVariableDefinitionInHeader
is true
or
1
,
If
Mode
isGenerateAggregatedHeader
, the global variable definitions are replaced in the aggregated header file.If
Mode
isGeneratePreprocessedSource
orUseOriginalCode
,RemoveVariableDefinitionInHeader
is ignored.
Note
If a source or header file that contains a global variable definition is included
multiple times in the source file you are importing, set
RemoveVariableDefinitionHeader
to true
or
1
. The corresponding setting in the wizard is Remove
variable definition in header file.
Attributes:
GetAccess | public |
SetAccess | public |
Examples
Change Sandbox Settings
Change the sandbox mode and variable definition header settings.
codeimport_obj = sltest.CodeImporter('myCodeTest'); codeimport_obj.CustomCode.SourceFiles = {'myCode1.c','myCode2.c'}; codeimport_obj.SandboxSettings.Mode = "GeneratePreprocessedSource"; codeimport_obj.SandboxSettings.RemoveVariableDefinitionInHeader = true;
Version History
Introduced in R2021a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)