Exemple #1
0
CTEST2(tube, print_tubes)
{
    tube *t;
    spud_tube_id id;
    ASSERT_TRUE( tube_create(&t, &data->err) );
    tube_set_info(t, -1, NULL, NULL);
    ASSERT_TRUE(spud_create_id(&id, &data->err));
    tube_set_info(t, -1, NULL, &id);
    ASSERT_TRUE(tube_manager_add(data->mgr, t, &data->err));
    tube_manager_print_tubes(data->mgr);
}
Exemple #2
0
LS_API bool
spud_init(spud_header*  hdr,
          spud_tube_id* id,
          ls_err*       err)
{
  memcpy(hdr->magic, SpudMagicCookie, SPUD_MAGIC_COOKIE_SIZE);
  hdr->flags = 0;
  if (id != NULL)
  {
    return spud_set_id(hdr, id, err);
  }
  else
  {
    return spud_create_id(&hdr->tube_id, err);
  }
}
Exemple #3
0
CTEST2(tube, manager_foreach)
{
    tube * tubes[TMGR_FOREACH_NUMTUBES];
    spud_tube_id ids[TMGR_FOREACH_NUMTUBES];

    for (int i = 0; i < TMGR_FOREACH_NUMTUBES; ++i) {
        ASSERT_TRUE(tube_create(&tubes[i], &data->err));
        ASSERT_TRUE(spud_create_id(&ids[i], &data->err));
        tube_set_info(tubes[i], -1, NULL, &ids[i]);
        ASSERT_TRUE(tube_manager_add(data->mgr, tubes[i], &data->err));
    }

    int num_tubes = 0;
    tube_manager_foreach(data->mgr, _mock_tube_walker, (void *) &num_tubes);
    ASSERT_TRUE(num_tubes == TMGR_FOREACH_NUMTUBES);
}