CBMC
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 
10 
11 #include <util/cmdline.h>
12 #include <util/options.h>
13 
15 {
16  if(options.is_set("max-nondet-array-length"))
17  {
19  options.get_unsigned_int_option("max-nondet-array-length");
20  }
21  if(options.is_set("max-nondet-tree-depth"))
22  {
24  options.get_unsigned_int_option("max-nondet-tree-depth");
25  }
26  if(options.is_set("min-null-tree-depth"))
27  {
29  options.get_unsigned_int_option("min-null-tree-depth");
30  }
31  if(options.is_set("max-nondet-string-length"))
32  {
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  {
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 }
std::string get_value(char option) const
Definition: cmdline.cpp:48
virtual bool isset(char option) const
Definition: cmdline.cpp:30
const std::list< std::string > & get_values(const std::string &option) const
Definition: cmdline.cpp:119
unsigned int get_unsigned_int_option(const std::string &option) const
Definition: options.cpp:56
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
bool get_bool_option(const std::string &option) const
Definition: options.cpp:44
void set_option(const std::string &option, const bool value)
Definition: options.cpp:28
const value_listt & get_list_option(const std::string &option) const
Definition: options.cpp:80
void parse_object_factory_options(const cmdlinet &cmdline, optionst &options)
Parse the object factory parameters from a given command line.
Options.
size_t max_nondet_array_length
Maximum value for the non-deterministically-chosen length of an array.
std::list< std::string > string_input_values
Force one of finitely many explicitly given input strings.
size_t max_nondet_tree_depth
Maximum depth of pointer chains (that contain recursion) in the nondet generated input objects.
size_t min_null_tree_depth
To force a certain depth of non-null objects.
bool string_printable
Force string content to be ASCII printable characters when set to true.
size_t max_nondet_string_length
Maximum value for the non-deterministically-chosen length of a string.
void set(const optionst &)
Assigns the parameters from given options.
size_t min_nondet_string_length
Minimum value for the non-deterministically-chosen length of a string.