Create header of common test functions

Create a header to be included in tests for common functions.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Add split command to samtools

The split command takes BAMs which consist of multiple readgroups
and separates them out into separate files, one for each readgroup.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Add unit test for bam_split.c's count_rg

Add unit test to test count_rg function.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Polish bam_split

Unit test expand_format_string
Change from output_prefix to output format string
Make usage write to stdout when not an error.
Make stdout usage appear if no arguments given.
Make unaccounted reads an option and whine if found and not specified.
Filter alternate @RG lines from the files they’re not in.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Add unit test for bam_split.c's filter_header_rg

Add unit test to test filter_header_rg function.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Restructure testing structure to dedupe

Move certain functions from test.h into a test.c file to reduce code
duplication.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Add unit test for bam_split.c's parse_args

Add unit test to test parse_args function.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Fix dependencies for test/test.h

Three of the test/merge/*.c tests do not yet use test.c's functions,
so needn't link to it.
Write files based on the *basename* of the input file

Strip the directory part (tools that write to the current directory
by default are more convenient) and extension from the input filename
before using it in the output filename template.

We don't seem to need _GNU_SOURCE.  Also minor spelling fixups.
Merge split subcommand (PR #172)