X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/08e7455d67920bbd7a87f440d00f2c1e071314a0..3150aca44effea27a875c990e1cdcfbab5e6895c:/src/xbt/config_test.cpp diff --git a/src/xbt/config_test.cpp b/src/xbt/config_test.cpp index c8e630c8d1..bbda2822ce 100644 --- a/src/xbt/config_test.cpp +++ b/src/xbt/config_test.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2004-2022. 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. */ @@ -21,26 +21,32 @@ TEST_CASE("xbt::config: Configuration support", "config") auto temp = simgrid_config; simgrid_config = nullptr; simgrid::config::declare_flag("speed", "description", 0); - simgrid::config::declare_flag("peername", "description", ""); + simgrid::config::alias("speed", {"velocity"}); + simgrid::config::declare_flag("peer-name", "description", ""); simgrid::config::declare_flag("user", "description", ""); SECTION("Alloc and free a config set") { INFO("Alloc and free a config set"); - simgrid::config::set_parse("peername:veloce user:bidule"); + simgrid::config::set_parse("peer-name:veloce user:bidule"); } SECTION("Data retrieving tests") { 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("speed"); REQUIRE(ival == 42); // Unexpected value for speed 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("peer_name:fellow"), std::out_of_range); + + INFO("Set value by alias"); + simgrid::config::set_parse("velocity:33"); + ival = simgrid::config::get_value("speed"); + REQUIRE(ival == 33); // Unexpected value for speed } SECTION("C++ flags")