Exemple #1
0
static void
test_aux_data_added_nvpairs_are_returned_by_foreach_in_order(void)
{
  LogTransportAuxData *aux = construct_aux_with_some_data();

  log_transport_aux_data_add_nv_pair(aux, "super", "lativus");
  assert_concatenated_nvpairs(aux, "foo=bar\nsuper=lativus\n");
  free_aux(aux);
}
Exemple #2
0
static void
test_aux_data_reinit_returns_aux_into_initial_state_without_leaks(void)
{
  LogTransportAuxData *aux = construct_aux_with_some_data();

  log_transport_aux_data_reinit(aux);
  assert_null(aux->peer_addr, "aux->peer_addr is not NULL after reinit");

  free_aux(aux);
}
Exemple #3
0
static void
test_aux_data_copy_creates_an_identical_copy(void)
{
  LogTransportAuxData *aux = construct_aux_with_some_data();
  LogTransportAuxData aux_copy;
  gchar *orig, *copy;

  log_transport_aux_data_copy(&aux_copy, aux);

  orig = _concat_nvpairs(aux);
  copy = _concat_nvpairs(&aux_copy);
  assert_string(orig, copy, "copy incorrectly copied aux->nvpairs");
  g_free(orig);
  g_free(copy);
  log_transport_aux_data_destroy(&aux_copy);
  free_aux(aux);
}
Exemple #4
0
static void
test_aux_data_copy_separates_the_copies(void)
{
  LogTransportAuxData *aux = construct_aux_with_some_data();
  LogTransportAuxData aux_copy;
  gchar *orig, *copy;
  
  log_transport_aux_data_copy(&aux_copy, aux);
  log_transport_aux_data_add_nv_pair(aux, "super", "lativus");
  
  orig = _concat_nvpairs(aux);
  copy = _concat_nvpairs(&aux_copy);
  assert_false(strcmp(orig, copy) == 0, "copy incorrectly copied aux->nvpairs as change to one of them affected the other, orig=%s, copy=%s", orig, copy);
  g_free(orig);
  g_free(copy);
  log_transport_aux_data_destroy(&aux_copy);
  free_aux(aux);
}