-
Notifications
You must be signed in to change notification settings - Fork 3
Testing
AT! edited this page Jun 17, 2025
·
6 revisions
This repository is automatically tested at each release by GitHub Actions. The automatic tests will ensure that the code compiles correctly, and the production of different outputs from a test file.
As of version 1.4.0, covtobed includes a comprehensive testing framework:
# Run all tests (unit, integration, benchmarks)
cd test
bash run_tests.sh --all
# Run specific test types
bash run_tests.sh --unit # Unit tests with Catch2
bash run_tests.sh --integration # Enhanced integration tests
bash run_tests.sh --benchmark # Performance benchmarksThe enhanced testing suite includes:
- Unit tests: Using Catch2 framework for core classes
- Integration tests: Comprehensive functional testing with colored output
- Benchmarks: Performance testing with Google Benchmark
- Test data generation: Synthetic BAM/SAM file creation
The original test script ./test/test.sh is still available and assumes:
- To be invoked from the root of the repository (this is not required, but it's the way GitHub Actions will invoke it)
- That a binary called
covtobedis placed at the root of the repository. Should the binary not be at the root, the test script will attempt copying a pre-compiled binary from the./binariesdirectory.
Some example BAM files are present in the test directory:
- demo.bam is a simulated single-end whole-genome shotgun of Enterobacteria phage lambda
- mp.bam is a simulated mate pairs library of Enterobacteria phage lambda
- mock.bam is a synthetic version of demo.bam that will produce 3 peaks of coverage (20X, 5X, 5X respectively)
- filtered.bam is a synthetic BAM file containing a valid alignment and non valid flags (PCR duplicate, non primary, failed QC)
- test_cov.bam is a synthetic BAM file having a peak per chromosome, and each chromosome is named after the coverage of its peak (e.g. "5X" means expecting a peak of 5X coverage)
What is tested:
- The binary compiled and can be invoked printing its version
- A sample
test/demo.bamis analyzed using "--min-cov 15", and should produce 12 lines of BED - A sample
test/mp.bamis analyzed using "--physical-coverage", and should produce 136 lines - A sample
test/demo.bamis analyzed using "--output-strands", and should produce a fifth column - A sample
test/demo.bamis analyzed using "--format counts", and should print two header lines and 202 non-header lines - A sample
test/demo.bamis analyzed and should re-produce the referencetest/demo.bedof the repository - A sample
test/mock.bamis analyzed and should re-produce the referencetest/demo.bedof the repository - A sample
test/test_cov.bamis analyzed and the output is checked for having a peak per chromosome, and each chromosome is named after the coverage of its peak
covtobed 1.4.0
Copyright (C) 2014-2019 Giovanni Birolo and Andrea Telatin
https://github.com/telatin/covtobed - License MIT.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
- Compiled binary prints version: PASS 1
- Minimum coverage, expected BED lines check: PASS 2
- Physical coverage, expected BED lines check: PASS 3
- Stranded output, testing column #5: PASS 4
- Testing 'counts' format (printed headers): PASS 5
- Testing 'counts' format (printed lines): PASS 6
- Checking identity of BED output with pre-calculated: PASS 7
- Checking computed coverage for a synthetic BAM file: PASS 8
- Checking filtering of invalid alignments: PASS 9,10
- Checking artificial coverage values:
#OK expecting 1X, 1X found
#OK expecting 2X, 2X found
#OK expecting 10X, 10X found
ALL TESTS: PASSED
Covtobed - Wiki - a simple tool to extract BED coverage tracks from BAM files