aboutsummaryrefslogtreecommitdiff
path: root/sys/libbio/test.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-04-25 11:38:29 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-04-25 11:38:29 -0700
commit788ddbd8e113cd4f9694aee779c5b5dcca26e30b (patch)
tree32e2db53cf5cd3fb907e6b17ab9ef6bdab8d9f4c /sys/libbio/test.c
parent1f166f0a4ed9ed32ade1ed21a571c9b2d0171ebc (diff)
feat: updated fasta code to allow for iteration
Diffstat (limited to 'sys/libbio/test.c')
-rw-r--r--sys/libbio/test.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/sys/libbio/test.c b/sys/libbio/test.c
index 115ee46..14f2b06 100644
--- a/sys/libbio/test.c
+++ b/sys/libbio/test.c
@@ -5,9 +5,8 @@
// -----------------------------------------------------------------------
// Point of entry for testing
-
-int
-main()
+error
+test·newick()
{
error err;
bio·Tree t;
@@ -36,3 +35,40 @@ main()
return 0;
}
+error
+test·fasta()
+{
+ error err;
+ Stream *fd;
+
+ bio·Seq seq;
+ bio·FastaReader *rdr;
+
+ fd = io·open("/home/nolln/root/data/test/zika.fa", "r");
+ rdr = bio·newfastareader((io·Reader){.read = &io·read}, fd, mem·sys, nil);
+
+ err = 0;
+ while (!err) {
+ err = bio·readfasta(rdr, &seq);
+ if (!err) {
+ printf(">%s\n", seq.name);
+ }
+ }
+
+ io·close(fd);
+ return err <= 0 ? 0 : 1;
+}
+
+error
+main()
+{
+ error err;
+ if (err = test·newick(), err) {
+ errorf("test fail: newick");
+ }
+
+ if (err = test·fasta(), err) {
+ errorf("test fail: fasta");
+ }
+}
+