Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Convert some config flags to C++ API.
[simgrid.git] / src / xbt / config.cpp
1 /* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved.     */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include <cstdio>
7
8 #include <algorithm>
9 #include <cerrno>
10 #include <cstring>
11 #include <climits>
12
13 #include <functional>
14 #include <map>
15 #include <stdexcept>
16 #include <string>
17 #include <string>
18 #include <type_traits>
19 #include <typeinfo>
20 #include <vector>
21
22 #include "simgrid/sg_config.hpp"
23 #include "xbt/dynar.h"
24 #include "xbt/log.h"
25 #include "xbt/misc.h"
26 #include "xbt/sysdep.h"
27 #include <xbt/config.h>
28 #include <xbt/config.hpp>
29 #include <xbt/ex.hpp>
30
31 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg, xbt, "configuration support");
32
33 XBT_EXPORT_NO_IMPORT xbt_cfg_t simgrid_config = nullptr;
34
35 namespace simgrid {
36 namespace config {
37
38 namespace {
39
40 const char* true_values[] = {
41   "yes", "on", "true", "1"
42 };
43 const char* false_values[] = {
44   "no", "off", "false", "0"
45 };
46
47 static bool parseBool(const char* value)
48 {
49   for (const char* const& true_value : true_values)
50     if (std::strcmp(true_value, value) == 0)
51       return true;
52   for (const char* const& false_value : false_values)
53     if (std::strcmp(false_value, value) == 0)
54       return false;
55   throw std::range_error("not a boolean");
56 }
57
58 static double parseDouble(const char* value)
59 {
60   char* end;
61   errno = 0;
62   double res = std::strtod(value, &end);
63   if (errno == ERANGE)
64     throw std::range_error("out of range");
65   else if (errno)
66     xbt_die("Unexpected errno");
67   if (end == value || *end != '\0')
68     throw std::range_error("invalid double");
69   else
70     return res;
71 }
72
73 static long int parseLong(const char* value)
74 {
75   char* end;
76   errno = 0;
77   long int res = std::strtol(value, &end, 0);
78   if (errno) {
79     if (res == LONG_MIN && errno == ERANGE)
80       throw std::range_error("underflow");
81     else if (res == LONG_MAX && errno == ERANGE)
82       throw std::range_error("overflow");
83     xbt_die("Unexpected errno");
84   }
85   if (end == value || *end != '\0')
86     throw std::range_error("invalid integer");
87   else
88     return res;
89 }
90
91 // ***** ConfigType *****
92
93 /// A trait which define possible options types:
94 template <class T> class ConfigType;
95
96 template <> class ConfigType<int> {
97 public:
98   static constexpr const char* type_name = "int";
99   static inline double parse(const char* value)
100   {
101     return parseLong(value);
102   }
103 };
104 template <> class ConfigType<double> {
105 public:
106   static constexpr const char* type_name = "double";
107   static inline double parse(const char* value)
108   {
109     return parseDouble(value);
110   }
111 };
112 template <> class ConfigType<std::string> {
113 public:
114   static constexpr const char* type_name = "string";
115   static inline std::string parse(const char* value)
116   {
117     return std::string(value);
118   }
119 };
120 template <> class ConfigType<bool> {
121 public:
122   static constexpr const char* type_name = "boolean";
123   static inline bool parse(const char* value)
124   {
125     return parseBool(value);
126   }
127 };
128
129 // **** Forward declarations ****
130
131 class ConfigurationElement ;
132 template<class T> class TypedConfigurationElement;
133
134 // **** ConfigurationElement ****
135
136 class ConfigurationElement {
137 private:
138   std::string key;
139   std::string desc;
140   bool isdefault = true;
141
142 public:
143   /* Callback */
144   xbt_cfg_cb_t old_callback = nullptr;
145
146   ConfigurationElement(const char* key, const char* desc) : key(key ? key : ""), desc(desc ? desc : "") {}
147   ConfigurationElement(const char* key, const char* desc, xbt_cfg_cb_t cb)
148     : key(key ? key : ""), desc(desc ? desc : ""), old_callback(cb) {}
149
150   virtual ~ConfigurationElement()=default;
151
152   virtual std::string getStringValue() = 0;
153   virtual void setStringValue(const char* value) = 0;
154   virtual const char* getTypeName() = 0;
155
156   template<class T>
157   T const& getValue() const
158   {
159     return dynamic_cast<const TypedConfigurationElement<T>&>(*this).getValue();
160   }
161   template<class T>
162   void setValue(T value)
163   {
164     dynamic_cast<TypedConfigurationElement<T>&>(*this).setValue(std::move(value));
165   }
166   template<class T>
167   void setDefaultValue(T value)
168   {
169     dynamic_cast<TypedConfigurationElement<T>&>(*this).setDefaultValue(std::move(value));
170   }
171   void unsetDefault() { isdefault = false; }
172   bool isDefault() const { return isdefault; }
173
174   std::string const& getDescription() const { return desc; }
175   std::string const& getKey() const { return key; }
176 };
177
178 // **** TypedConfigurationElement<T> ****
179
180 // TODO, could we use boost::any with some Type* reference?
181 template<class T>
182 class TypedConfigurationElement : public ConfigurationElement {
183 private:
184   T content;
185   std::function<void(T&)> callback;
186
187 public:
188   TypedConfigurationElement(const char* key, const char* desc, T value = T())
189     : ConfigurationElement(key, desc), content(std::move(value))
190   {}
191   TypedConfigurationElement(const char* key, const char* desc, T value, xbt_cfg_cb_t cb)
192       : ConfigurationElement(key, desc, cb), content(std::move(value))
193   {}
194   TypedConfigurationElement(const char* key, const char* desc, T value, std::function<void(T&)> callback)
195       : ConfigurationElement(key, desc), content(std::move(value)), callback(std::move(callback))
196   {}
197   ~TypedConfigurationElement() = default;
198
199   std::string getStringValue() override;
200   const char* getTypeName() override;
201   void setStringValue(const char* value) override;
202
203   void update()
204   {
205     if (old_callback)
206       this->old_callback(getKey().c_str());
207     if (this->callback)
208       this->callback(this->content);
209   }
210
211   T const& getValue() const { return content; }
212
213   void setValue(T value)
214   {
215     this->content = std::move(value);
216     this->update();
217     this->unsetDefault();
218   }
219
220   void setDefaultValue(T value)
221   {
222     if (this->isDefault()) {
223       this->content = std::move(value);
224       this->update();
225     } else {
226       XBT_DEBUG("Do not override configuration variable '%s' with value '%s' because it was already set.",
227                 getKey().c_str(), to_string(value).c_str());
228     }
229   }
230 };
231
232 template<class T>
233 std::string TypedConfigurationElement<T>::getStringValue() // override
234 {
235   return to_string(content);
236 }
237
238 template<class T>
239 void TypedConfigurationElement<T>::setStringValue(const char* value) // override
240 {
241   this->content = ConfigType<T>::parse(value);
242   this->unsetDefault();
243   this->update();
244 }
245
246 template<class T>
247 const char* TypedConfigurationElement<T>::getTypeName() // override
248 {
249   return ConfigType<T>::type_name;
250 }
251
252 } // end of anonymous namespace
253
254 // **** Config ****
255
256 class Config {
257 private:
258   // name -> ConfigElement:
259   std::map<std::string, simgrid::config::ConfigurationElement*> options;
260   // alias -> ConfigElement from options:
261   std::map<std::string, simgrid::config::ConfigurationElement*> aliases;
262   bool warn_for_aliases = true;
263
264 public:
265   Config();
266   ~Config();
267
268   // No copy:
269   Config(Config const&) = delete;
270   Config& operator=(Config const&) = delete;
271
272   ConfigurationElement& operator[](const char* name);
273   template<class T>
274   TypedConfigurationElement<T>& getTyped(const char* name);
275   void alias(const char* realname, const char* aliasname);
276
277   template<class T, class... A>
278   simgrid::config::TypedConfigurationElement<T>*
279     registerOption(const char* name, A&&... a)
280   {
281     xbt_assert(options.find(name) == options.end(), "Refusing to register the config element '%s' twice.", name);
282     TypedConfigurationElement<T>* variable = new TypedConfigurationElement<T>(name, std::forward<A>(a)...);
283     XBT_DEBUG("Register cfg elm %s (%s) of type %s @%p in set %p)", name, variable->getDescription().c_str(),
284               variable->getTypeName(), variable, this);
285     options.insert({name, variable});
286     variable->update();
287     return variable;
288   }
289
290   // Debug:
291   void dump(const char *name, const char *indent);
292   void showAliases();
293   void help();
294
295 protected:
296   ConfigurationElement* getDictElement(const char* name);
297 };
298
299 Config::Config()
300 {
301   atexit(&sg_config_finalize);
302 }
303 Config::~Config()
304 {
305   XBT_DEBUG("Frees cfg set %p", this);
306   for (auto const& elm : options)
307     delete elm.second;
308 }
309
310 inline ConfigurationElement* Config::getDictElement(const char* name)
311 {
312   auto opt = options.find(name);
313   if (opt != options.end()) {
314     return opt->second;
315   } else {
316     auto als = aliases.find(name);
317     if (als != aliases.end()) {
318       ConfigurationElement* res = als->second;
319       if (warn_for_aliases)
320         XBT_INFO("Option %s has been renamed to %s. Consider switching.", name, res->getKey().c_str());
321       return res;
322     } else {
323       THROWF(not_found_error, 0, "Bad config key: %s", name);
324     }
325   }
326 }
327
328 inline ConfigurationElement& Config::operator[](const char* name)
329 {
330   return *(getDictElement(name));
331 }
332
333 void Config::alias(const char* realname, const char* aliasname)
334 {
335   xbt_assert(aliases.find(aliasname) == aliases.end(), "Alias '%s' already.", aliasname);
336   ConfigurationElement* element = this->getDictElement(realname);
337   xbt_assert(element, "Cannot define an alias to the non-existing option '%s'.", realname);
338   this->aliases.insert({aliasname, element});
339 }
340
341 /** @brief Dump a config set for debuging purpose
342  *
343  * @param name The name to give to this config set
344  * @param indent what to write at the beginning of each line (right number of spaces)
345  */
346 void Config::dump(const char *name, const char *indent)
347 {
348   if (name)
349     printf("%s>> Dumping of the config set '%s':\n", indent, name);
350
351   for (auto const& elm : options)
352     printf("%s  %s: ()%s) %s", indent, elm.first.c_str(), elm.second->getTypeName(),
353            elm.second->getStringValue().c_str());
354
355   if (name)
356     printf("%s<< End of the config set '%s'\n", indent, name);
357   fflush(stdout);
358 }
359
360 /** @brief Displays the declared aliases and their replacement */
361 void Config::showAliases()
362 {
363   for (auto const& elm : aliases)
364     printf("   %-40s %s\n", elm.first.c_str(), elm.second->getKey().c_str());
365 }
366
367 /** @brief Displays the declared options and their description */
368 void Config::help()
369 {
370   for (auto const& elm : options) {
371     simgrid::config::ConfigurationElement* variable = this->options.at(elm.first);
372     printf("   %s: %s\n", elm.first.c_str(), variable->getDescription().c_str());
373     printf("       Type: %s; ", variable->getTypeName());
374     printf("Current value: %s\n", variable->getStringValue().c_str());
375   }
376 }
377
378 // ***** getConfig *****
379
380 template <class T> XBT_PUBLIC T const& getConfig(const char* name)
381 {
382   return (*simgrid_config)[name].getValue<T>();
383 }
384
385 template XBT_PUBLIC int const& getConfig<int>(const char* name);
386 template XBT_PUBLIC double const& getConfig<double>(const char* name);
387 template XBT_PUBLIC bool const& getConfig<bool>(const char* name);
388 template XBT_PUBLIC std::string const& getConfig<std::string>(const char* name);
389
390 // ***** alias *****
391
392 void alias(const char* realname, std::initializer_list<const char*> aliases)
393 {
394   for (auto const& aliasname : aliases)
395     simgrid_config->alias(realname, aliasname);
396 }
397
398 // ***** declareFlag *****
399
400 template <class T>
401 XBT_PUBLIC void declareFlag(const char* name, const char* description, T value, std::function<void(const T&)> callback)
402 {
403   if (simgrid_config == nullptr)
404     simgrid_config = xbt_cfg_new();
405   simgrid_config->registerOption<T>(
406     name, description, std::move(value), std::move(callback));
407 }
408
409 template XBT_PUBLIC void declareFlag(const char* name, const char* description, int value,
410                                      std::function<void(int const&)> callback);
411 template XBT_PUBLIC void declareFlag(const char* name, const char* description, double value,
412                                      std::function<void(double const&)> callback);
413 template XBT_PUBLIC void declareFlag(const char* name, const char* description, bool value,
414                                      std::function<void(bool const&)> callback);
415 template XBT_PUBLIC void declareFlag(const char* name, const char* description, std::string value,
416                                      std::function<void(std::string const&)> callback);
417 }
418 }
419
420 // ***** C bindings *****
421
422 xbt_cfg_t xbt_cfg_new()
423 {
424   return new simgrid::config::Config();
425 }
426 void xbt_cfg_free(xbt_cfg_t * cfg) { delete *cfg; }
427
428 void xbt_cfg_dump(const char *name, const char *indent, xbt_cfg_t cfg)
429 {
430   cfg->dump(name, indent);
431 }
432
433 /*----[ Registering stuff ]-----------------------------------------------*/
434
435 void xbt_cfg_register_double(const char *name, double default_value,
436   xbt_cfg_cb_t cb_set, const char *desc)
437 {
438   if (simgrid_config == nullptr)
439     simgrid_config = xbt_cfg_new();
440   simgrid_config->registerOption<double>(name, desc, default_value, cb_set);
441 }
442
443 void xbt_cfg_register_int(const char *name, int default_value,xbt_cfg_cb_t cb_set, const char *desc)
444 {
445   if (simgrid_config == nullptr)
446     simgrid_config = xbt_cfg_new();
447   simgrid_config->registerOption<int>(name, desc, default_value, cb_set);
448 }
449
450 void xbt_cfg_register_string(const char *name, const char *default_value, xbt_cfg_cb_t cb_set, const char *desc)
451 {
452   if (simgrid_config == nullptr)
453     simgrid_config = xbt_cfg_new();
454   simgrid_config->registerOption<std::string>(name, desc, default_value ? default_value : "", cb_set);
455 }
456
457 void xbt_cfg_register_boolean(const char *name, const char*default_value,xbt_cfg_cb_t cb_set, const char *desc)
458 {
459   if (simgrid_config == nullptr)
460     simgrid_config = xbt_cfg_new();
461   simgrid_config->registerOption<bool>(name, desc, simgrid::config::parseBool(default_value), cb_set);
462 }
463
464 void xbt_cfg_register_alias(const char *realname, const char *aliasname)
465 {
466   if (simgrid_config == nullptr)
467     simgrid_config = xbt_cfg_new();
468   simgrid_config->alias(realname, aliasname);
469 }
470
471 void xbt_cfg_aliases() { simgrid_config->showAliases(); }
472 void xbt_cfg_help()    { simgrid_config->help(); }
473
474 /*----[ Setting ]---------------------------------------------------------*/
475
476 /** @brief Add values parsed from a string into a config set
477  *
478  * @param options a string containing the content to add to the config set. This is a '\\t',' ' or '\\n' or ','
479  * separated list of variables. Each individual variable is like "[name]:[value]" where [name] is the name of an
480  * already registered variable, and [value] conforms to the data type under which this variable was registered.
481  *
482  * @todo This is a crude manual parser, it should be a proper lexer.
483  */
484 void xbt_cfg_set_parse(const char *options)
485 {
486   if (not options || not strlen(options)) { /* nothing to do */
487     return;
488   }
489
490   XBT_DEBUG("List to parse and set:'%s'", options);
491   std::string optionlist(options);
492   while (not optionlist.empty()) {
493     XBT_DEBUG("Still to parse and set: '%s'", optionlist.c_str());
494
495     // skip separators
496     size_t pos = optionlist.find_first_not_of(" \t\n,");
497     optionlist.erase(0, pos);
498     // find option
499     pos              = optionlist.find_first_of(" \t\n,");
500     std::string name = optionlist.substr(0, pos);
501     optionlist.erase(0, pos);
502     XBT_DEBUG("parse now:'%s'; parse later:'%s'", name.c_str(), optionlist.c_str());
503
504     if (name.empty())
505       continue;
506
507     pos = name.find(':');
508     xbt_assert(pos != std::string::npos, "Option '%s' badly formatted. Should be of the form 'name:value'",
509                name.c_str());
510
511     std::string val = name.substr(pos + 1);
512     name.erase(pos);
513
514     const std::string path("path");
515     if (name.compare(0, path.length(), path) != 0)
516       XBT_INFO("Configuration change: Set '%s' to '%s'", name.c_str(), val.c_str());
517
518     (*simgrid_config)[name.c_str()].setStringValue(val.c_str());
519   }
520 }
521
522 /** @brief Set the value of a variable, using the string representation of that value
523  *
524  * @param key name of the variable to modify
525  * @param value string representation of the value to set
526  */
527
528 void xbt_cfg_set_as_string(const char *key, const char *value)
529 {
530   (*simgrid_config)[key].setStringValue(value);
531 }
532
533 /** @brief Set an integer value to \a name within \a cfg if it wasn't changed yet
534  *
535  * This is useful to change the default value of a variable while allowing
536  * users to override it with command line arguments
537  */
538 void xbt_cfg_setdefault_int(const char *key, int value)
539 {
540   (*simgrid_config)[key].setDefaultValue<int>(value);
541 }
542
543 /** @brief Set an integer value to \a name within \a cfg if it wasn't changed yet
544  *
545  * This is useful to change the default value of a variable while allowing
546  * users to override it with command line arguments
547  */
548 void xbt_cfg_setdefault_double(const char *key, double value)
549 {
550   (*simgrid_config)[key].setDefaultValue<double>(value);
551 }
552
553 /** @brief Set a string value to \a name within \a cfg if it wasn't changed yet
554  *
555  * This is useful to change the default value of a variable while allowing
556  * users to override it with command line arguments
557  */
558 void xbt_cfg_setdefault_string(const char *key, const char *value)
559 {
560   (*simgrid_config)[key].setDefaultValue<std::string>(value ? value : "");
561 }
562
563 /** @brief Set an boolean value to \a name within \a cfg if it wasn't changed yet
564  *
565  * This is useful to change the default value of a variable while allowing
566  * users to override it with command line arguments
567  */
568 void xbt_cfg_setdefault_boolean(const char *key, const char *value)
569 {
570   (*simgrid_config)[key].setDefaultValue<bool>(simgrid::config::parseBool(value));
571 }
572
573 /** @brief Set an integer value to \a name within \a cfg
574  *
575  * @param key the name of the variable
576  * @param value the value of the variable
577  */
578 void xbt_cfg_set_int(const char *key, int value)
579 {
580   (*simgrid_config)[key].setValue<int>(value);
581 }
582
583 /** @brief Set or add a double value to \a name within \a cfg
584  *
585  * @param key the name of the variable
586  * @param value the double to set
587  */
588 void xbt_cfg_set_double(const char *key, double value)
589 {
590   (*simgrid_config)[key].setValue<double>(value);
591 }
592
593 /** @brief Set or add a string value to \a name within \a cfg
594  *
595  * @param key the name of the variable
596  * @param value the value to be added
597  *
598  */
599 void xbt_cfg_set_string(const char* key, const char* value)
600 {
601   (*simgrid_config)[key].setValue<std::string>(value);
602 }
603
604 /** @brief Set or add a boolean value to \a name within \a cfg
605  *
606  * @param key the name of the variable
607  * @param value the value of the variable
608  */
609 void xbt_cfg_set_boolean(const char *key, const char *value)
610 {
611   (*simgrid_config)[key].setValue<bool>(simgrid::config::parseBool(value));
612 }
613
614
615 /* Say if the value is the default value */
616 int xbt_cfg_is_default_value(const char *key)
617 {
618   return (*simgrid_config)[key].isDefault() ? 1 : 0;
619 }
620
621 /*----[ Getting ]---------------------------------------------------------*/
622 /** @brief Retrieve an integer value of a variable (get a warning if not uniq)
623  *
624  * @param key the name of the variable
625  *
626  * Returns the first value from the config set under the given name.
627  */
628 int xbt_cfg_get_int(const char *key)
629 {
630   return (*simgrid_config)[key].getValue<int>();
631 }
632
633 /** @brief Retrieve a double value of a variable (get a warning if not uniq)
634  *
635  * @param key the name of the variable
636  *
637  * Returns the first value from the config set under the given name.
638  */
639 double xbt_cfg_get_double(const char *key)
640 {
641   return (*simgrid_config)[key].getValue<double>();
642 }
643
644 /** @brief Retrieve a string value of a variable (get a warning if not uniq)
645  *
646  * @param key the name of the variable
647  *
648  * Returns the first value from the config set under the given name.
649  * If there is more than one value, it will issue a warning.
650  * Returns nullptr if there is no value.
651  *
652  * \warning the returned value is the actual content of the config set
653  */
654 std::string xbt_cfg_get_string(const char* key)
655 {
656   return (*simgrid_config)[key].getValue<std::string>();
657 }
658
659 /** @brief Retrieve a boolean value of a variable (get a warning if not uniq)
660  *
661  * @param key the name of the variable
662  *
663  * Returns the first value from the config set under the given name.
664  * If there is more than one value, it will issue a warning.
665  */
666 int xbt_cfg_get_boolean(const char *key)
667 {
668   return (*simgrid_config)[key].getValue<bool>() ? 1 : 0;
669 }
670
671 #ifdef SIMGRID_TEST
672
673 #include <string>
674
675 #include "xbt.h"
676 #include "xbt/ex.h"
677 #include <xbt/ex.hpp>
678
679 #include <xbt/config.hpp>
680
681 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_cfg);
682
683 XBT_TEST_SUITE("config", "Configuration support");
684
685 XBT_PUBLIC_DATA xbt_cfg_t simgrid_config;
686
687 static void make_set()
688 {
689   simgrid_config = nullptr;
690   xbt_log_threshold_set(&_XBT_LOGV(xbt_cfg), xbt_log_priority_critical);
691   xbt_cfg_register_int("speed", 0, nullptr, "");
692   xbt_cfg_register_string("peername", "", nullptr, "");
693   xbt_cfg_register_string("user", "", nullptr, "");
694 }                               /* end_of_make_set */
695
696 XBT_TEST_UNIT("memuse", test_config_memuse, "Alloc and free a config set")
697 {
698   auto temp = simgrid_config;
699   make_set();
700   xbt_test_add("Alloc and free a config set");
701   xbt_cfg_set_parse("peername:veloce user:bidule");
702   xbt_cfg_free(&simgrid_config);
703   simgrid_config = temp;
704 }
705
706 XBT_TEST_UNIT("use", test_config_use, "Data retrieving tests")
707 {
708   auto temp = simgrid_config;
709   make_set();
710   xbt_test_add("Get a single value");
711   {
712     /* get_single_value */
713     xbt_cfg_set_parse("peername:toto:42 speed:42");
714     int ival = xbt_cfg_get_int("speed");
715     if (ival != 42)
716       xbt_test_fail("Speed value = %d, I expected 42", ival);
717   }
718
719   xbt_test_add("Access to a non-existant entry");
720   {
721     try {
722       xbt_cfg_set_parse("color:blue");
723     } catch(xbt_ex& e) {
724       if (e.category != not_found_error)
725         xbt_test_exception(e);
726     }
727   }
728   xbt_cfg_free(&simgrid_config);
729   simgrid_config = temp;
730 }
731
732 XBT_TEST_UNIT("c++flags", test_config_cxx_flags, "C++ flags")
733 {
734   auto temp = simgrid_config;
735   make_set();
736   xbt_test_add("C++ declaration of flags");
737
738   simgrid::config::Flag<int> int_flag("int", "", 0);
739   simgrid::config::Flag<std::string> string_flag("string", "", "foo");
740   simgrid::config::Flag<double> double_flag("double", "", 0.32);
741   simgrid::config::Flag<bool> bool_flag1("bool1", "", false);
742   simgrid::config::Flag<bool> bool_flag2("bool2", "", true);
743
744   xbt_test_add("Parse values");
745   xbt_cfg_set_parse("int:42 string:bar double:8.0 bool1:true bool2:false");
746   xbt_test_assert(int_flag == 42, "Check int flag");
747   xbt_test_assert(string_flag == "bar", "Check string flag");
748   xbt_test_assert(double_flag == 8.0, "Check double flag");
749   xbt_test_assert(bool_flag1, "Check bool1 flag");
750   xbt_test_assert(not bool_flag2, "Check bool2 flag");
751
752   xbt_cfg_free(&simgrid_config);
753   simgrid_config = temp;
754 }
755
756 #endif                          /* SIMGRID_TEST */