edgelists : second milestone reached
This commit is contained in:
63
tbb.c
63
tbb.c
@@ -11,10 +11,13 @@
|
||||
#include "edges.h"
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
int essai_des_edges(int k)
|
||||
int essai_des_edges_A(int k)
|
||||
{
|
||||
EdgeList * list;
|
||||
int foo, idx;
|
||||
int e0, e1;
|
||||
|
||||
fprintf(stderr, "============== %s %7d ===========\n", __func__, k);
|
||||
|
||||
list = alloc_edgelist("oups?", k, 0);
|
||||
fprintf(stderr, " alloc edge list -> %p\n", list);
|
||||
@@ -27,10 +30,13 @@ foo = push_an_edge(list, 24, 36);
|
||||
|
||||
foo = print_the_edges(list, 0);
|
||||
|
||||
for (idx=0; idx<10; idx++) {
|
||||
foo = push_an_edge(list, idx*7, -idx);
|
||||
|
||||
|
||||
for (idx=0; idx<k; idx++) {
|
||||
e0 = idx*7; e1 = 5-idx;
|
||||
foo = push_an_edge(list, e0, e1);
|
||||
if (foo) {
|
||||
fprintf(stderr, "push (%d, %d) -> %d\n", e0, e1, foo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foo = print_the_edges(list, 0);
|
||||
@@ -38,9 +44,48 @@ foo = print_the_edges(list, 0);
|
||||
foo = free_edgelist(list, 0);
|
||||
fprintf(stderr, " free list -> %d\n", foo);
|
||||
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* ici on va faire des essais sur la gestion
|
||||
* de la dé-duplication des aretes.
|
||||
*/
|
||||
int essai_des_edges_B(int k)
|
||||
{
|
||||
EdgeList * list;
|
||||
int foo, idx;
|
||||
int e0, e1;
|
||||
|
||||
fprintf(stderr, "============== %s %7d ===========\n", __func__, k);
|
||||
|
||||
list = alloc_edgelist("BIG!", k, 0);
|
||||
if (NULL == list) {
|
||||
fprintf(stderr, "%s: epic fail\n", __func__);
|
||||
abort();
|
||||
}
|
||||
|
||||
print_edgelist_desc(list, 0);
|
||||
|
||||
for (idx=0; idx<k; idx++) {
|
||||
e0 = rand() % 666;
|
||||
e1 = rand() % 666;
|
||||
foo = push_a_missing_edge(list, e0, e1);
|
||||
}
|
||||
|
||||
print_edgelist_desc(list, 0);
|
||||
|
||||
foo = print_the_edges(list, 0);
|
||||
|
||||
foo = free_edgelist(list, 0);
|
||||
fprintf(stderr, " %s: free list -> %d\n", __func__, foo);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
void test_alloc_free(int nbelm)
|
||||
{
|
||||
BBList *bublist;
|
||||
@@ -152,8 +197,10 @@ foo = test_peek_poke(5000);
|
||||
fprintf(stderr, "test peek/poke -> %d\n", foo);
|
||||
#endif
|
||||
|
||||
foo = essai_des_edges(10);
|
||||
fprintf(stderr, "test des edges -> %d\n", foo);
|
||||
foo = essai_des_edges_A(25);
|
||||
fprintf(stderr, "test A des edges -> %d\n", foo);
|
||||
foo = essai_des_edges_B(10000);
|
||||
fprintf(stderr, "test B des edges -> %d\n", foo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user