A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prevent inlining for empty placeholders of sthread_enable/disable.
[simgrid.git]
/
src
/
xbt
/
config_test.cpp
diff --git
a/src/xbt/config_test.cpp
b/src/xbt/config_test.cpp
index
8b41924
..
d02767a
100644
(file)
--- a/
src/xbt/config_test.cpp
+++ b/
src/xbt/config_test.cpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2004-20
19
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-20
23
. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-13,52
+13,44
@@
XBT_PUBLIC_DATA simgrid::config::Config* simgrid_config;
XBT_PUBLIC_DATA simgrid::config::Config* simgrid_config;
-
static void make_set(
)
+
TEST_CASE("xbt::config: Configuration support", "config"
)
{
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_cfg);
xbt_log_threshold_set(&_XBT_LOGV(xbt_cfg), xbt_log_priority_critical);
{
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_cfg);
xbt_log_threshold_set(&_XBT_LOGV(xbt_cfg), xbt_log_priority_critical);
+
+ auto temp = simgrid_config;
simgrid_config = nullptr;
simgrid::config::declare_flag<int>("speed", "description", 0);
simgrid_config = nullptr;
simgrid::config::declare_flag<int>("speed", "description", 0);
- simgrid::config::declare_flag<std::string>("peername", "description", "");
+ simgrid::config::alias("speed", {"velocity"});
+ simgrid::config::declare_flag<std::string>("peer-name", "description", "");
simgrid::config::declare_flag<std::string>("user", "description", "");
simgrid::config::declare_flag<std::string>("user", "description", "");
-}
-
-TEST_CASE("xbt::config: Configuration support", "config")
-{
SECTION("Alloc and free a config set")
{
SECTION("Alloc and free a config set")
{
- auto temp = simgrid_config;
- make_set();
INFO("Alloc and free a config set");
INFO("Alloc and free a config set");
- simgrid::config::set_parse("peername:veloce user:bidule");
- simgrid::config::finalize();
- simgrid_config = temp;
+ simgrid::config::set_parse("peer-name:veloce user:bidule");
}
SECTION("Data retrieving tests")
{
}
SECTION("Data retrieving tests")
{
- auto temp = simgrid_config;
- make_set();
-
INFO("Get a single value");
/* get_single_value */
INFO("Get a single value");
/* get_single_value */
- simgrid::config::set_parse("peername:toto:42 speed:42");
+ simgrid::config::set_parse("peer
-
name:toto:42 speed:42");
int ival = simgrid::config::get_value<int>("speed");
REQUIRE(ival == 42); // Unexpected value for speed
int ival = simgrid::config::get_value<int>("speed");
REQUIRE(ival == 42); // Unexpected value for speed
- INFO("Access to a non-existant entry");
-
+ INFO("Access to a non-existent entry");
REQUIRE_THROWS_AS(simgrid::config::set_parse("color:blue"), std::out_of_range);
REQUIRE_THROWS_AS(simgrid::config::set_parse("color:blue"), std::out_of_range);
+ REQUIRE_THROWS_AS(simgrid::config::set_parse("peer_name:fellow"), std::out_of_range);
- simgrid::config::finalize();
- simgrid_config = temp;
+ INFO("Set value by alias");
+ simgrid::config::set_parse("velocity:33");
+ ival = simgrid::config::get_value<int>("speed");
+ REQUIRE(ival == 33); // Unexpected value for speed
}
SECTION("C++ flags")
{
}
SECTION("C++ flags")
{
- auto temp = simgrid_config;
- make_set();
INFO("C++ declaration of flags");
simgrid::config::Flag<int> int_flag("int", "", 0);
INFO("C++ declaration of flags");
simgrid::config::Flag<int> int_flag("int", "", 0);
@@
-74,8
+66,8
@@
TEST_CASE("xbt::config: Configuration support", "config")
REQUIRE(double_flag == 8.0); // Check double flag
REQUIRE(bool_flag1); // Check bool1 flag
REQUIRE(not bool_flag2); // Check bool2 flag
REQUIRE(double_flag == 8.0); // Check double flag
REQUIRE(bool_flag1); // Check bool1 flag
REQUIRE(not bool_flag2); // Check bool2 flag
-
- simgrid::config::finalize();
- simgrid_config = temp;
}
}
+
+ simgrid::config::finalize();
+ simgrid_config = temp;
}
}