aboutsummaryrefslogtreecommitdiff
path: root/sys/libbio/test.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-04-28 16:32:06 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-04-28 16:32:06 -0700
commita48e7f9fd525b4da828605fb7be4d2a35dde4e23 (patch)
tree51b7def97deeaa70c8003225fabd2bb62a1101f4 /sys/libbio/test.c
parenta6d9c8be245ef171423ddeb8466a27ad715012e0 (diff)
feat: prototype of rerooting function
Diffstat (limited to 'sys/libbio/test.c')
-rw-r--r--sys/libbio/test.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/libbio/test.c b/sys/libbio/test.c
index baccd42..5059ce6 100644
--- a/sys/libbio/test.c
+++ b/sys/libbio/test.c
@@ -93,22 +93,23 @@ test·newick()
{
error err;
bio·Tree t;
- mem·Arena *mem;
+ mem·Arena *heap;
Stream *fd[2];
io·Peeker rdr;
io·Putter wtr;
- mem·Allocator al;
- mem = mem·newarena(mem·sys, nil);
- rdr = (io·Peeker){.get = &io·getbyte, .unget = &io·ungetbyte};
- wtr = (io·Putter){.put = &io·putbyte, .putstr = &io·putstring};
- al = (mem·Allocator) { .alloc = &mem·arenaalloc, .free = nil, };
+ heap = mem·newarena(mem·sys, nil);
+ rdr = (io·Peeker){.get = &io·getbyte, .unget = &io·ungetbyte};
+ wtr = (io·Putter){.put = &io·putbyte, .putstr = &io·putstring};
fd[0] = io·open("/home/nolln/root/data/test/zika.nwk", "r");
fd[1] = io·open("/home/nolln/root/data/test/zika.proc.nwk", "w");
- err = bio·readnewick(rdr, fd[0], al, mem, &t);
+ t.h = heap;
+ t.heap = (mem·Allocator){ .alloc = &mem·arenaalloc, .free = nil, };
+
+ err = bio·readnewick(rdr, fd[0], &t);
phylo·ladderize(t.root);
printf("Loaded tree with %d leafs and %d nodes\n", t.nleaf, t.root->nnode);
@@ -119,7 +120,7 @@ test·newick()
io·close(fd[0]);
io·close(fd[1]);
- mem·freearena(mem);
+ mem·freearena(heap);
return 0;
}