[go: nahoru, domu]

Skip to content

Commit

Permalink
add tests to check to make sure that the static and shared libs can b…
Browse files Browse the repository at this point in the history
…e used properly
  • Loading branch information
Sawwave committed Feb 8, 2024
1 parent ac22bd4 commit cd8ada2
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/sharedLibTest/awfmiTest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "AwFmIndex.h"
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
struct AwFmIndex *index;

struct AwFmIndexConfiguration config;
config.suffixArrayCompressionRatio = 2;
config.kmerLengthInSeedTable = 2;
config.alphabetType = AwFmAlphabetDna;
config.keepSuffixArrayInMemory = true;
config.storeOriginalSequence = false;

enum AwFmReturnCode awfmrc = awFmCreateIndexFromFasta(&index,& config, "test.fa", "output.awfmi");

if (awFmReturnCodeIsFailure(awfmrc))
{
printf("ERROR: createIndex returned error code %u\n", awfmrc);
exit(-1);
}
else
{
printf("createIndex successful\n");
}

awFmDeallocIndex(index);
}
14 changes: 14 additions & 0 deletions test/sharedLibTest/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
TEST_SRC = awfmiTest.c

CFLAGS = -std=c11 -Wall -mtune=native -fopenmp -mavx2 -O3
LDLIBS = -lawfmindex

EXE = sharedLibTest.out

sharedLibTest: $(TEST_SRC)
if [ -z "$$LD_LIBRARY_PATH" ]; then export LD_LIBRARY_PATH=/usr/local/lib; fi
gcc $(TEST_SRC) -o $(EXE) $(CFLAGS) $(LDLIBS)

.PHONY: clean
clean:
rm -f $(EXE)
2 changes: 2 additions & 0 deletions test/sharedLibTest/test.fa
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
>test 1 header
test1sequencedataagasfnlawebrfilqawhbefrilahwbseflikhabsdlfikhbas
32 changes: 32 additions & 0 deletions test/staticLibTest/awfmiTest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "AwFmIndex.h"
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{

struct AwFmIndex *index;

struct AwFmIndexConfiguration config;
config.suffixArrayCompressionRatio = 2;
config.kmerLengthInSeedTable = 2;
config.alphabetType = AwFmAlphabetDna;
config.keepSuffixArrayInMemory = true;
config.storeOriginalSequence = false;

enum AwFmReturnCode awfmrc = awFmCreateIndexFromFasta(&index,& config, "test.fa", "output.awfmi");

if (awFmReturnCodeIsFailure(awfmrc))
{
printf("ERROR: createIndex returned error code %u\n", awfmrc);
exit(-1);
}
else
{
printf("createIndex successful\n");
}

awFmDeallocIndex(index);
}
14 changes: 14 additions & 0 deletions test/staticLibTest/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
TEST_SRC = awfmiTest.c

CFLAGS = -std=c11 -Wall -mtune=native -fopenmp -mavx2 -O3
LDFLAGS = -L../../build
LDLIBS = -lawfmindex

EXE = staticLibTest.out

staticLibTest: $(TEST_SRC)
gcc $(TEST_SRC) $(LDFLAGS) -o $(EXE) $(CFLAGS) $(LDLIBS)

.PHONY: clean
clean:
rm -f $(EXE)
2 changes: 2 additions & 0 deletions test/staticLibTest/test.fa
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
>test 1 header
test1sequencedataagasfnlawebrfilqawhbefrilahwbseflikhabsdlfikhbas

0 comments on commit cd8ada2

Please sign in to comment.