workin on edgelists...

This commit is contained in:
tTh 2023-03-30 05:16:19 +02:00
parent 9e81fa8319
commit 9577f1da1f
3 changed files with 14 additions and 11 deletions

View File

@ -10,7 +10,7 @@
CC = gcc CC = gcc
OPT = -Wall -g -O3 -DDEBUG_LEVEL=0 -DMUST_ABORT=0 OPT = -Wall -g -pg -DDEBUG_LEVEL=0 -DMUST_ABORT=0
libbubulles.a: bubulles.o edges.o libbubulles.a: bubulles.o edges.o
ar r $@ $? ar r $@ $?

View File

@ -4,7 +4,7 @@
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
#define LIBBB_VERSION 62 #define LIBBB_VERSION 63
#define SZ_BUBULLE_TEXT 81 /* arbitrary value */ #define SZ_BUBULLE_TEXT 81 /* arbitrary value */

21
tbb.c
View File

@ -6,7 +6,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include "bubulles.h" #include "bubulles.h"
#include "edges.h" #include "edges.h"
@ -27,19 +27,20 @@ print_edgelist_desc(list, 0);
foo = push_an_edge(list, 13, 37); foo = push_an_edge(list, 13, 37);
fprintf(stderr, " push edge -> %d\n", foo); fprintf(stderr, " push edge -> %d\n", foo);
foo = push_an_edge(list, 24, 36); foo = push_an_edge(list, 24, 36);
fprintf(stderr, " push edge -> %d\n", foo);
foo = print_the_edges(list, 0); foo = print_the_edges(stdout, list, 0);
for (idx=0; idx<k; idx++) { for (idx=0; idx<k; idx++) {
e0 = idx*7; e1 = 5-idx; e0 = idx*7; e1 = 5-idx;
foo = push_an_edge(list, e0, e1); foo = push_an_edge(list, e0, e1);
if (foo) { if (foo) {
fprintf(stderr, "push (%d, %d) -> %d\n", e0, e1, foo); fprintf(stderr, "push %d (%d, %d) -> %d\n", idx, e0, e1, foo);
break; break;
} }
} }
foo = print_the_edges(list, 0); foo = print_the_edges(stdout, list, 0); puts("");
foo = free_edgelist(list, 0); foo = free_edgelist(list, 0);
fprintf(stderr, " free list -> %d\n", foo); fprintf(stderr, " free list -> %d\n", foo);
@ -59,7 +60,7 @@ int e0, e1;
fprintf(stderr, "============== %s %7d ===========\n", __func__, k); fprintf(stderr, "============== %s %7d ===========\n", __func__, k);
list = alloc_edgelist("BIG!", k, 0); list = alloc_edgelist("gloubigoulba", k, 0);
if (NULL == list) { if (NULL == list) {
fprintf(stderr, "%s: epic fail\n", __func__); fprintf(stderr, "%s: epic fail\n", __func__);
abort(); abort();
@ -75,7 +76,7 @@ for (idx=0; idx<k; idx++) {
print_edgelist_desc(list, 0); print_edgelist_desc(list, 0);
foo = print_the_edges(list, 0); foo = print_the_edges(stdout, list, 0); puts("");
foo = free_edgelist(list, 0); foo = free_edgelist(list, 0);
fprintf(stderr, " %s: free list -> %d\n", __func__, foo); fprintf(stderr, " %s: free list -> %d\n", __func__, foo);
@ -189,6 +190,8 @@ fprintf(stderr, "*** Bubulles Testing %s %s\n\n", __DATE__, __TIME__);
bubulles_version(0); bubulles_version(0);
srand(getpid()); /* INIT RANDOM */
#if (0) #if (0)
test_alloc_free(5); test_alloc_free(5);
test_push_pop(20000); test_push_pop(20000);
@ -197,9 +200,9 @@ foo = test_peek_poke(5000);
fprintf(stderr, "test peek/poke -> %d\n", foo); fprintf(stderr, "test peek/poke -> %d\n", foo);
#endif #endif
foo = essai_des_edges_A(25); // XXX foo = essai_des_edges_A(25);
fprintf(stderr, "test A des edges -> %d\n", foo); // XXX fprintf(stderr, "test A des edges -> %d\n", foo);
foo = essai_des_edges_B(10000); foo = essai_des_edges_B(5000);
fprintf(stderr, "test B des edges -> %d\n", foo); fprintf(stderr, "test B des edges -> %d\n", foo);
return 0; return 0;