Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
telatin committed Sep 28, 2022
1 parent c4c0e8e commit 35df686
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 19 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ STATIC=$(BIN2)/bamtocov $(BIN2)/bamtocounts $(BIN2)/covtotarget $(BIN2)/bamcount


$(BIN)/%: $(SOURCE)/%.nim $(SOURCE)/covutils.nim bamtocov.nimble
nim c $(NIM_PATHS) -d:NimblePkgVersion=$(VERSION) -d:release --opt:speed --out:$@ $<
nim c $(NIM_PATHS) -d:NimblePkgVersion=$(VERSION) -d:danger --opt:speed --out:$@ $<

all: $(LIST)

Expand All @@ -27,8 +27,9 @@ $(BIN2)/%: $(SOURCE)/%.nim bamtocov.nimble ./hts_nim_static_builder
mkdir -p $(BIN2)
echo target: $@
echo base: $(shell basename $@)
./hts_nim_static_builder -n bamtocov.nimble -s $< -- -d:NimblePkgVersion=2.7.0
./hts_nim_static_builder -n bamtocov.nimble -s $< -- -d:NimblePkgVersion=$(VERSION)
mv ./$(shell basename $@) $(BIN2)

test: testshpec

testall: testbash testshpec testshunit2
Expand Down
41 changes: 41 additions & 0 deletions Makefile.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Create "make test"
.PHONY: testshpec testshunit2 test clean build

BIN=./bin
SOURCE=./src
NIM_PATHS= --colors:on --noNimblePath --path:/local/giovanni/bamtocov/nimbledeps/pkgs/hts-0.3.17 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/docopt-0.6.8 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/regex-0.19.0 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/unicodedb-0.9.0 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/lapper-0.1.7
VERSION := $(shell grep version bamtocov.nimble | grep -o "[0-9]\\+\.[0-9]\.[0-9]\\+")
LIST=$(BIN)/bamtocov $(BIN)/bamtoreads $(BIN)/bamtocounts $(BIN)/covtotarget $(BIN)/bamcountrefs $(BIN)/gff2bed $(BIN)/bamtocounts_legacy $(BIN)/bamtarget

$(BIN)/%: $(SOURCE)/%.nim $(SOURCE)/covutils.nim bamtocov.nimble
nim c $(NIM_PATHS) -d:NimblePkgVersion=$(VERSION) -d:release --opt:speed --out:$@ $<

all: $(LIST)


test: testshpec

testall: testbash testshpec testshunit2
testshpec:
@echo " --- Test shpec --- "
./tests/bin/shpec ./tests/shpec/bamtocov.sh

testshunit2:
@echo " --- Test shunit2 --- "
./tests/unit/bamtocov-base.sh

testbash:
@echo " --- Test (legacy) --- "
bash tests/all.sh


build:
nimble build


clean:
@echo "Cleaning..."
@for i in $(LIST); \
do \
if [ -e "$$i" ]; then rm -f $$i; echo "Removing $$i"; else echo "$$i Not found"; fi \
done
1 change: 0 additions & 1 deletion nim.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# nim c -a -d:static -d:release

-d:danger
-d:release
--opt:speed
@if static:
passC:"-static"
Expand Down
24 changes: 12 additions & 12 deletions tests/results/mini_wig250_max.wig
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
fixedStep chrom=seq1 span=250
0 5
250 6
500 1
750 0
5
6
1
0
fixedStep chrom=seq2 span=250
0 0
250 10
500 10
750 0
0
10
10
0
fixedStep chrom=seq0 span=250
0 0
250 0
500 0
750 0
0
0
0
0
8 changes: 4 additions & 4 deletions tests/shpec/bamtocov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ describe "Coverage tools tested by Shpec"
LINES=$("$BINDIR"/bamtocov "$DATADIR"/mini.bam --wig 250 --op max | wc -l)
assert equal $LINES 15
end
it "Produces wig output (check lines at 750)"
LINES=$("$BINDIR"/bamtocov "$DATADIR"/mini.bam --wig 250 --op max | grep -w 750 | wc -l)
assert equal $LINES 3
it "Produces wig output (check coverage 10X)"
LINES=$("$BINDIR"/bamtocov "$DATADIR"/mini.bam --wig 250 --op max | grep -w 10 | wc -l)
assert equal $LINES 2
end
it "Produces wig output (check lines at 1000 bases, unexpected)"
it "Produces wig output (check lines at 1000, unexpected)"
LINES=$("$BINDIR"/bamtocov "$DATADIR"/mini.bam --wig 250 --op max | grep -w 1000 |wc -l)
assert equal $LINES 0
end
Expand Down

0 comments on commit 35df686

Please sign in to comment.