X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d8398e5f4a86e11454615ba47806b7aba7e56cba..ab5814bd4ea6117ecf9ac2df328333e89eb45f5f:/src/xbt/dict_test.cpp?ds=sidebyside diff --git a/src/xbt/dict_test.cpp b/src/xbt/dict_test.cpp index 227f04aebe..4e7613791e 100644 --- a/src/xbt/dict_test.cpp +++ b/src/xbt/dict_test.cpp @@ -1,6 +1,6 @@ /* dict - a generic dictionary, variation over hash table */ -/* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2004-2023. 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. */ @@ -12,7 +12,7 @@ #include #include -#include "catch.hpp" +#include "src/3rd-party/catch.hpp" #define STR(str) ((str) ? (str) : "(null)") @@ -93,21 +93,6 @@ static void search_not_found(const_xbt_dict_t head, const char* data) REQUIRE(xbt_dict_get_or_null(head, data) == nullptr); } -static void count(const_xbt_dict_t dict, int length) -{ - INFO("Count elements (expecting " << length << ")"); - REQUIRE(xbt_dict_length(dict) == length); // Announced length differs - - xbt_dict_cursor_t cursor; - char* key; - void* data; - int effective = 0; - xbt_dict_foreach (dict, cursor, key, data) - effective++; - - REQUIRE(effective == length); // Effective length differs -} - static int countelems(const_xbt_dict_t head) { xbt_dict_cursor_t cursor; @@ -121,6 +106,13 @@ static int countelems(const_xbt_dict_t head) return res; } +static void count(const_xbt_dict_t dict, int length) +{ + INFO("Count elements (expecting " << length << ")"); + REQUIRE(xbt_dict_length(dict) == length); // Announced length differs + REQUIRE(countelems(dict) == length); // Effective length differs +} + TEST_CASE("xbt::dict: dict data container", "dict") { SECTION("Basic usage: change, retrieve and traverse homogeneous dicts")