cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
object_factory_parameters.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Object Factory
4
5
Author: Diffblue Ltd
6
7
\*******************************************************************/
8
9
#include "
object_factory_parameters.h
"
10
11
#include <
util/cmdline.h
>
12
#include <
util/options.h
>
13
14
void
object_factory_parameterst::set
(
const
optionst
&options)
15
{
16
if
(options.
is_set
(
"max-nondet-array-length"
))
17
{
18
max_nondet_array_length
=
19
options.
get_unsigned_int_option
(
"max-nondet-array-length"
);
20
}
21
if
(options.
is_set
(
"max-nondet-tree-depth"
))
22
{
23
max_nondet_tree_depth =
24
options.
get_unsigned_int_option
(
"max-nondet-tree-depth"
);
25
}
26
if
(options.
is_set
(
"min-null-tree-depth"
))
27
{
28
min_null_tree_depth
=
29
options.
get_unsigned_int_option
(
"min-null-tree-depth"
);
30
}
31
if
(options.
is_set
(
"max-nondet-string-length"
))
32
{
33
max_nondet_string_length
=
34
options.
get_unsigned_int_option
(
"max-nondet-string-length"
);
35
}
36
if
(options.
is_set
(
"string-printable"
))
37
{
38
string_printable
= options.
get_bool_option
(
"string-printable"
);
39
}
40
if
(options.
is_set
(
"string-input-value"
))
41
{
42
string_input_values
= options.
get_list_option
(
"string-input-value"
);
43
}
44
if
(options.
is_set
(
"min-nondet-string-length"
))
45
{
46
min_nondet_string_length
=
47
options.
get_unsigned_int_option
(
"min-nondet-string-length"
);
48
}
49
}
50
54
void
parse_object_factory_options
(
const
cmdlinet
&cmdline,
optionst
&options)
55
{
56
if
(cmdline.
isset
(
"max-nondet-array-length"
))
57
{
58
options.
set_option
(
59
"max-nondet-array-length"
, cmdline.
get_value
(
"max-nondet-array-length"
));
60
}
61
if
(cmdline.
isset
(
"max-nondet-tree-depth"
))
62
{
63
options.
set_option
(
64
"max-nondet-tree-depth"
, cmdline.
get_value
(
"max-nondet-tree-depth"
));
65
}
66
if
(cmdline.
isset
(
"min-null-tree-depth"
))
67
{
68
options.
set_option
(
69
"min-null-tree-depth"
, cmdline.
get_value
(
"min-null-tree-depth"
));
70
}
71
if
(cmdline.
isset
(
"max-nondet-string-length"
))
72
{
73
options.
set_option
(
74
"max-nondet-string-length"
,
75
cmdline.
get_value
(
"max-nondet-string-length"
));
76
}
77
if
(cmdline.
isset
(
"string-printable"
))
78
{
79
options.
set_option
(
"string-printable"
,
true
);
80
}
81
if
(cmdline.
isset
(
"string-non-empty"
))
82
{
83
options.
set_option
(
"min-nondet-string-length"
, 1);
84
}
85
if
(cmdline.
isset
(
"string-input-value"
))
86
{
87
options.
set_option
(
88
"string-input-value"
, cmdline.
get_values
(
"string-input-value"
));
89
}
90
}
cmdlinet
Definition
cmdline.h:20
cmdlinet::get_value
std::string get_value(char option) const
Definition
cmdline.cpp:48
cmdlinet::isset
virtual bool isset(char option) const
Definition
cmdline.cpp:30
cmdlinet::get_values
const std::list< std::string > & get_values(const std::string &option) const
Definition
cmdline.cpp:119
optionst
Definition
options.h:23
optionst::get_unsigned_int_option
unsigned int get_unsigned_int_option(const std::string &option) const
Definition
options.cpp:56
optionst::is_set
bool is_set(const std::string &option) const
N.B. opts.is_set("foo") does not imply opts.get_bool_option("foo").
Definition
options.cpp:62
optionst::get_bool_option
bool get_bool_option(const std::string &option) const
Definition
options.cpp:44
optionst::set_option
void set_option(const std::string &option, const bool value)
Definition
options.cpp:28
optionst::get_list_option
const value_listt & get_list_option(const std::string &option) const
Definition
options.cpp:80
cmdline.h
parse_object_factory_options
void parse_object_factory_options(const cmdlinet &cmdline, optionst &options)
Parse the object factory parameters from a given command line.
Definition
object_factory_parameters.cpp:54
object_factory_parameters.h
options.h
Options.
object_factory_parameterst::max_nondet_array_length
size_t max_nondet_array_length
Maximum value for the non-deterministically-chosen length of an array.
Definition
object_factory_parameters.h:34
object_factory_parameterst::string_input_values
std::list< std::string > string_input_values
Force one of finitely many explicitly given input strings.
Definition
object_factory_parameters.h:76
object_factory_parameterst::min_null_tree_depth
size_t min_null_tree_depth
Maximum depth of pointer chains (that contain recursion) in the nondet generated input objects.
Definition
object_factory_parameters.h:70
object_factory_parameterst::string_printable
bool string_printable
Force string content to be ASCII printable characters when set to true.
Definition
object_factory_parameters.h:73
object_factory_parameterst::max_nondet_string_length
size_t max_nondet_string_length
Maximum value for the non-deterministically-chosen length of a string.
Definition
object_factory_parameters.h:41
object_factory_parameterst::set
void set(const optionst &)
Assigns the parameters from given options.
Definition
object_factory_parameters.cpp:14
object_factory_parameterst::min_nondet_string_length
size_t min_nondet_string_length
Minimum value for the non-deterministically-chosen length of a string.
Definition
object_factory_parameters.h:44
util
object_factory_parameters.cpp
Generated by
1.17.0