/* 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. */
/* in your code is naturally the way to go outside a regression test */
INFO("==== Push " << NB_ELEM << " int, set them again 3 times, traverse them, shift them");
/* in your code is naturally the way to go outside a regression test */
INFO("==== Push " << NB_ELEM << " int, set them again 3 times, traverse them, shift them");
/* 1. Populate the dynar */
d = xbt_dynar_new(sizeof(int), nullptr);
for (int i = 0; i < NB_ELEM; i++) {
/* 1. Populate the dynar */
d = xbt_dynar_new(sizeof(int), nullptr);
for (int i = 0; i < NB_ELEM; i++) {
d = xbt_dynar_new(sizeof(char*), &xbt_free_ref);
/* 1. Populate the dynar */
for (int i = 0; i < NB_ELEM; i++) {
d = xbt_dynar_new(sizeof(char*), &xbt_free_ref);
/* 1. Populate the dynar */
for (int i = 0; i < NB_ELEM; i++) {
INFO("==== Unshift, traverse and pop " << NB_ELEM << " strings");
d = xbt_dynar_new(sizeof(char**), &xbt_free_ref);
for (int i = 0; i < NB_ELEM; i++) {
INFO("==== Unshift, traverse and pop " << NB_ELEM << " strings");
d = xbt_dynar_new(sizeof(char**), &xbt_free_ref);
for (int i = 0; i < NB_ELEM; i++) {
xbt_dynar_unshift(d, &s1);
}
/* 2. Traverse the dynar with the macro */
xbt_dynar_foreach (d, iter, s1) {
xbt_dynar_unshift(d, &s1);
}
/* 2. Traverse the dynar with the macro */
xbt_dynar_foreach (d, iter, s1) {
- snprintf(buf, 1023, "%u", NB_ELEM - iter - 1);
- REQUIRE(not strcmp(buf, s1)); // The retrieved value is not the same than the injected one
+ std::string val = std::to_string(NB_ELEM - iter - 1);
+ REQUIRE(s1 == val); // The retrieved value is not the same than the injected one
INFO("==== Push " << NB_ELEM << " strings, insert " << (NB_ELEM / 5) << " strings in the middle, shift everything");
d = xbt_dynar_new(sizeof(char*), &xbt_free_ref);
for (int i = 0; i < NB_ELEM; i++) {
INFO("==== Push " << NB_ELEM << " strings, insert " << (NB_ELEM / 5) << " strings in the middle, shift everything");
d = xbt_dynar_new(sizeof(char*), &xbt_free_ref);
for (int i = 0; i < NB_ELEM; i++) {
xbt_dynar_insert_at(d, NB_ELEM / 2, &s1);
}
for (int i = 0; i < NB_ELEM / 2; i++) {
xbt_dynar_insert_at(d, NB_ELEM / 2, &s1);
}
for (int i = 0; i < NB_ELEM / 2; i++) {
<< ". free the rest");
d = xbt_dynar_new(sizeof(char*), &xbt_free_ref);
for (int i = 0; i < NB_ELEM; i++) {
<< ". free the rest");
d = xbt_dynar_new(sizeof(char*), &xbt_free_ref);
for (int i = 0; i < NB_ELEM; i++) {