diff --git a/src/intersectBed/intersectBed.cpp b/src/intersectBed/intersectBed.cpp
index 1d410ae16f23994ef30ee00ac68b24fa4f232bcb..229300bc5d1188a13d20934efd7506e09a6b4892 100644
--- a/src/intersectBed/intersectBed.cpp
+++ b/src/intersectBed/intersectBed.cpp
@@ -328,7 +328,7 @@ void BedIntersect::IntersectBam(string bamFile) {
         BED bed;
         MakeBedFromBam(bam, chrom, bed_blocks, bed);
         bool overlapsFound = false;
-        if ((_bamOutput == true) && (_obeySplits == false)) 
+        if ((_bamOutput == true) && (_obeySplits == false))
         {
             overlapsFound = _bedB->anyHits(bed.chrom, bed.start, bed.end, 
                                            bed.strand, _sameStrand, _diffStrand,
diff --git a/src/mapBed/mapBed.cpp b/src/mapBed/mapBed.cpp
index d8051103a2ebe0b7d41887649f2c84e702e50ad2..6c5b2be539b62f9ee41da6f122a33ad264831855 100644
--- a/src/mapBed/mapBed.cpp
+++ b/src/mapBed/mapBed.cpp
@@ -19,7 +19,8 @@ double GetUserColumn(const string s);
 BedMap::BedMap(string bedAFile, string bedBFile, int column, string operation,
                float overlapFraction, bool sameStrand, 
                bool diffStrand, bool reciprocal,
-               string nullValue, bool printHeader) 
+               bool choseNullValue, string nullValue, 
+               bool printHeader) 
 {
 
     _bedAFile            = bedAFile;
@@ -33,6 +34,8 @@ BedMap::BedMap(string bedAFile, string bedBFile, int column, string operation,
     _nullValue           = nullValue;
     _printHeader         = printHeader;
     
+    if (!choseNullValue && operation == "count")
+        _nullValue = "0";
     Map();
 }
 
@@ -84,7 +87,7 @@ string BedMap::MapHits(const BED &a, const vector<BED> &hits) {
         output << vo.GetMode();
     else if (_operation == "antimode")
         output << vo.GetAntiMode();
-    else if (_operation == "count")
+    else if (_operation == "count") 
         output << setprecision (PRECISION) << vo.GetCount();
     else if (_operation == "count_distinct")
         output << setprecision (PRECISION) << vo.GetCountDistinct();
diff --git a/src/mapBed/mapBed.h b/src/mapBed/mapBed.h
index 91dfa10794f5db9b7cef6002da01f0f289935b49..f8cc5de12678291263a07f0d20a092b5bfcfdaa2 100644
--- a/src/mapBed/mapBed.h
+++ b/src/mapBed/mapBed.h
@@ -41,7 +41,8 @@ public:
     BedMap(string bedAFile, string bedBFile, int column, string operation,
                    float overlapFraction, bool sameStrand, 
                    bool diffStrand, bool reciprocal, 
-                   string nullValue, bool printHeader);
+                   bool choseNullValue, string nullValue, 
+                   bool printHeader);
 
     // destructor
     ~BedMap(void);
diff --git a/src/mapBed/mapMain.cpp b/src/mapBed/mapMain.cpp
index 1ecf6869c105b3f62b395aff40cd694fb6e705ee..8f1559d54c682a182b78a8b9e862550ab62ad6b0 100644
--- a/src/mapBed/mapMain.cpp
+++ b/src/mapBed/mapMain.cpp
@@ -48,6 +48,7 @@ int map_main(int argc, char* argv[]) {
     bool sameStrand         = false;
     bool diffStrand         = false;
     bool printHeader        = false;
+    bool choseNullValue     = false;
 
     // check to see if we should print out some help
     if(argc <= 1) showHelp = true;
@@ -114,6 +115,7 @@ int map_main(int argc, char* argv[]) {
         }
         else if (PARAMETER_CHECK("-null", 5, parameterLength)) {
             nullValue = argv[i + 1];
+            choseNullValue = true;
             i++;
         }
         else if(PARAMETER_CHECK("-header", 7, parameterLength)) {
@@ -146,7 +148,8 @@ int map_main(int argc, char* argv[]) {
         BedMap *bm = new BedMap(bedAFile, bedBFile, column, operation,
                                        overlapFraction, sameStrand,
                                        diffStrand, reciprocalFraction,
-                                       nullValue, printHeader);
+                                       choseNullValue, nullValue, 
+                                       printHeader);
         delete bm;
         return 0;
     }
diff --git a/test/bamtobed/one_block.sam b/test/bamtobed/one_block.sam
new file mode 100644
index 0000000000000000000000000000000000000000..83041cf531ddf8ca5c02e3175509fa983953d9f0
--- /dev/null
+++ b/test/bamtobed/one_block.sam
@@ -0,0 +1,3 @@
+@HD	VN:1.0	GO:none	SO:coordinate
+@SQ	SN:chr1	LN:249250621
+one_blocks	16	chr1	1	40	30M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50
diff --git a/test/bamtobed/test-bamtobed.sh b/test/bamtobed/test-bamtobed.sh
new file mode 100644
index 0000000000000000000000000000000000000000..0d028e74e038fb0026bd1f521812adde6f4deff3
--- /dev/null
+++ b/test/bamtobed/test-bamtobed.sh
@@ -0,0 +1,113 @@
+BT=../../bin/bedtools
+
+check()
+{
+	if diff $1 $2; then
+    	echo ok
+	else
+    	echo fail
+	fi
+}
+
+###########################################################
+###########################################################
+#                       BAM files                         #
+###########################################################
+###########################################################
+samtools view -Sb one_block.sam > one_block.bam 2>/dev/null
+samtools view -Sb two_blocks.sam > two_blocks.bam 2>/dev/null
+samtools view -Sb three_blocks.sam > three_blocks.bam 2>/dev/null
+samtools view -Sb sam-w-del.sam > sam-w-del.bam 2>/dev/null
+
+
+##################################################################
+#  Test one block without -split
+##################################################################
+echo "    bamtobed.t1...\c"
+echo \
+"chr1	0	30	one_blocks	40	-" > exp
+$BT bamtobed -i one_block.bam > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test one block with -split
+##################################################################
+echo "    bamtobed.t2...\c"
+echo \
+"chr1	0	30	one_blocks	40	-" > exp
+$BT bamtobed -i one_block.bam -split > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test two blocks without -split
+##################################################################
+echo "    bamtobed.t3...\c"
+echo \
+"chr1	0	40	two_blocks	40	-" > exp
+$BT bamtobed -i two_blocks.bam > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test two blocks with -split
+##################################################################
+echo "    bamtobed.t4...\c"
+echo \
+"chr1	0	15	two_blocks	40	-
+chr1	25	40	two_blocks	40	-" > exp
+$BT bamtobed -i two_blocks.bam -split > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test three blocks without -split
+##################################################################
+echo "    bamtobed.t5...\c"
+echo \
+"chr1	0	50	three_blocks	40	-" > exp
+$BT bamtobed -i three_blocks.bam > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test three blocks with -split
+##################################################################
+echo "    bamtobed.t6...\c"
+echo \
+"chr1	0	10	three_blocks	40	-
+chr1	20	30	three_blocks	40	-
+chr1	40	50	three_blocks	40	-" > exp
+$BT bamtobed -i three_blocks.bam -split > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test three blocks with -bed12
+##################################################################
+echo "    bamtobed.t7...\c"
+echo \
+"chr1	0	50	three_blocks	40	-	0	50	255,0,0	3	10,10,10	0,20,40" > exp
+$BT bamtobed -i three_blocks.bam -bed12 > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Ensure that both ways of getting blocks from a spliced alignment
+# are indenticsl
+##################################################################
+echo "    bamtobed.t8...\c"
+$BT bamtobed -i three_blocks.bam -split > split
+$BT bamtobed -i three_blocks.bam -bed12 |  $BT bed12tobed6 > bed12
+check split bed12
+rm split bed12
+
+rm *.bam
diff --git a/test/bamtobed/three_blocks.sam b/test/bamtobed/three_blocks.sam
new file mode 100644
index 0000000000000000000000000000000000000000..6e3bc601a7135401ddcadcff667be01bbd30a62a
--- /dev/null
+++ b/test/bamtobed/three_blocks.sam
@@ -0,0 +1,3 @@
+@HD	VN:1.0	GO:none	SO:coordinate
+@SQ	SN:chr1	LN:249250621
+three_blocks	16	chr1	1	40	10M10N10M10N10M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50
diff --git a/test/bamtobed/two_blocks.sam b/test/bamtobed/two_blocks.sam
new file mode 100644
index 0000000000000000000000000000000000000000..6f19dcf93903dc6eed1548121bdb11bc0e9625cc
--- /dev/null
+++ b/test/bamtobed/two_blocks.sam
@@ -0,0 +1,3 @@
+@HD	VN:1.0	GO:none	SO:coordinate
+@SQ	SN:chr1	LN:249250621
+two_blocks	16	chr1	1	40	15M10N15M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50
\ No newline at end of file
diff --git a/test/bed12tobed6/bed6.bed b/test/bed12tobed6/bed6.bed
new file mode 100644
index 0000000000000000000000000000000000000000..e3a0a98570b76bcad9423b2b24e797e1e9fe2ccb
--- /dev/null
+++ b/test/bed12tobed6/bed6.bed
@@ -0,0 +1 @@
+chr1	0	50	bed6	1	+
\ No newline at end of file
diff --git a/test/bed12tobed6/one_blocks.bed b/test/bed12tobed6/one_blocks.bed
new file mode 100644
index 0000000000000000000000000000000000000000..a26047796cb9674eaaef187459185bb622db0e42
--- /dev/null
+++ b/test/bed12tobed6/one_blocks.bed
@@ -0,0 +1 @@
+chr1	0	50	one_blocks_match	0	+	0	0	0	1	50,	0,
diff --git a/test/bed12tobed6/test-bed12tobed6.sh b/test/bed12tobed6/test-bed12tobed6.sh
new file mode 100644
index 0000000000000000000000000000000000000000..1cc53e86472c5f8905a0ab9d533ec0ffb0727a9c
--- /dev/null
+++ b/test/bed12tobed6/test-bed12tobed6.sh
@@ -0,0 +1,71 @@
+BT=../../bin/bedtools
+
+check()
+{
+	if diff $1 $2; then
+    	echo ok
+	else
+    	echo fail
+	fi
+}
+
+
+##################################################################
+#  Test one block
+##################################################################
+echo "    bed12tobed6.t1...\c"
+echo \
+"chr1	0	50	one_blocks_match	0	+" > exp
+$BT bed12tobed6 -i one_blocks.bed > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test two blocks
+##################################################################
+echo "    bed12tobed6.t2...\c"
+echo \
+"chr1	0	10	two_blocks_match	0	+
+chr1	40	50	two_blocks_match	0	+" > exp
+$BT bed12tobed6 -i two_blocks.bed > obs
+check obs exp
+rm obs exp
+
+##################################################################
+#  Test three blocks
+##################################################################
+echo "    bed12tobed6.t3...\c"
+echo \
+"chr1	0	10	three_blocks_match	0	+
+chr1	20	30	three_blocks_match	0	+
+chr1	40	50	three_blocks_match	0	+" > exp
+$BT bed12tobed6 -i three_blocks.bed > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test three blocks and add block numbers
+##################################################################
+echo "    bed12tobed6.t4...\c"
+echo \
+"chr1	0	10	three_blocks_match	1	+
+chr1	20	30	three_blocks_match	2	+
+chr1	40	50	three_blocks_match	3	+" > exp
+$BT bed12tobed6 -i three_blocks.bed -n > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test three blocks and add block numbers.  Test reverse strand
+##################################################################
+echo "    bed12tobed6.t5...\c"
+echo \
+"chr1	0	10	three_blocks_match	3	-
+chr1	20	30	three_blocks_match	2	-
+chr1	40	50	three_blocks_match	1	-" > exp
+sed -e 's/\+/\-/' three_blocks.bed | $BT bed12tobed6 -n > obs
+check obs exp
+rm obs exp
\ No newline at end of file
diff --git a/test/bed12tobed6/three_blocks.bed b/test/bed12tobed6/three_blocks.bed
new file mode 100644
index 0000000000000000000000000000000000000000..33123c2f69f08c6dce7cf093cb07be44bb5f9113
--- /dev/null
+++ b/test/bed12tobed6/three_blocks.bed
@@ -0,0 +1 @@
+chr1	0	50	three_blocks_match	0	+	0	0	0	3	10,10,10,	0,20,40,
diff --git a/test/bed12tobed6/two_blocks.bed b/test/bed12tobed6/two_blocks.bed
new file mode 100644
index 0000000000000000000000000000000000000000..5fcfa6d5e216e9ebacec003d5b4cf92fd14dd8d6
--- /dev/null
+++ b/test/bed12tobed6/two_blocks.bed
@@ -0,0 +1 @@
+chr1	0	50	two_blocks_match	0	+	0	0	0	2	10,10,	0,40,
diff --git a/test/genomecov/one_block.sam b/test/genomecov/one_block.sam
new file mode 100644
index 0000000000000000000000000000000000000000..48408220f9be16e51cf76271f62eeb26b3d03988
--- /dev/null
+++ b/test/genomecov/one_block.sam
@@ -0,0 +1,3 @@
+@HD	VN:1.0	GO:none	SO:coordinate
+@SQ	SN:chr1	LN:1000
+one_blocks	16	chr1	1	40	30M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50
\ No newline at end of file
diff --git a/test/genomecov/sam-w-del.sam b/test/genomecov/sam-w-del.sam
new file mode 100644
index 0000000000000000000000000000000000000000..887b745d8a6bc79f1d4c7fbba14cb2985f1a57f0
--- /dev/null
+++ b/test/genomecov/sam-w-del.sam
@@ -0,0 +1,3 @@
+@HD	VN:1.0	GO:none	SO:coordinate
+@SQ	SN:chr1	LN:1000
+one_bp_del	16	chr1	1	40	10M1D10M	*	0	0	GAAGGCCACCGCCGCGCCGC	CCCDDB?=FJIIJIGIIJIG	MD:Z:50
diff --git a/test/genomecov/test-genomecov.sh b/test/genomecov/test-genomecov.sh
new file mode 100644
index 0000000000000000000000000000000000000000..b7102d5d0f95918721a94e62f9336de665671ede
--- /dev/null
+++ b/test/genomecov/test-genomecov.sh
@@ -0,0 +1,147 @@
+BT=../../bin/bedtools
+
+check()
+{
+	if diff $1 $2; then
+    	echo ok
+	else
+    	echo fail
+	fi
+}
+
+###########################################################
+###########################################################
+#                       BAM files                         #
+###########################################################
+###########################################################
+samtools view -Sb one_block.sam > one_block.bam 2>/dev/null
+samtools view -Sb two_blocks.sam > two_blocks.bam 2>/dev/null
+samtools view -Sb three_blocks.sam > three_blocks.bam 2>/dev/null
+samtools view -Sb sam-w-del.sam > sam-w-del.bam 2>/dev/null
+
+
+
+##################################################################
+#  Test three blocks without -split
+##################################################################
+echo "    genomecov.t1...\c"
+echo \
+"chr1	0	50	1" > exp
+$BT genomecov -ibam three_blocks.bam -bg > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test three blocks with -split
+##################################################################
+echo "    genomecov.t2...\c"
+echo \
+"chr1	0	10	1
+chr1	20	30	1
+chr1	40	50	1" > exp
+$BT genomecov -ibam three_blocks.bam -bg -split > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test three blocks with -split and -bga
+##################################################################
+echo "    genomecov.t3...\c"
+echo \
+"chr1	0	10	1
+chr1	10	20	0
+chr1	20	30	1
+chr1	30	40	0
+chr1	40	50	1
+chr1	50	1000	0" > exp
+$BT genomecov -ibam three_blocks.bam -bga -split > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test blocked BAM from multiple files w/ -bga and w/o -split
+##################################################################
+echo "    genomecov.t4...\c"
+echo \
+"chr1	0	30	3
+chr1	30	40	2
+chr1	40	50	1
+chr1	50	1000	0" > exp
+samtools merge -f /dev/stdout *block*.bam | $BT genomecov -ibam - -bga  > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test blocked BAM from multiple files w/ -bga and w -split
+##################################################################
+echo "    genomecov.t5...\c"
+echo \
+"chr1	0	10	3
+chr1	10	15	2
+chr1	15	20	1
+chr1	20	25	2
+chr1	25	30	3
+chr1	30	50	1
+chr1	50	1000	0" > exp
+samtools merge -f /dev/stdout *block*.bam | $BT genomecov -ibam - -bga -split > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test three blocks with -split and -dz
+##################################################################
+echo "    genomecov.t6...\c"
+echo \
+"chr1	0	1
+chr1	1	1
+chr1	2	1
+chr1	3	1
+chr1	4	1
+chr1	5	1
+chr1	6	1
+chr1	7	1
+chr1	8	1
+chr1	9	1
+chr1	20	1
+chr1	21	1
+chr1	22	1
+chr1	23	1
+chr1	24	1
+chr1	25	1
+chr1	26	1
+chr1	27	1
+chr1	28	1
+chr1	29	1
+chr1	40	1
+chr1	41	1
+chr1	42	1
+chr1	43	1
+chr1	44	1
+chr1	45	1
+chr1	46	1
+chr1	47	1
+chr1	48	1
+chr1	49	1" > exp
+$BT genomecov -ibam three_blocks.bam -dz -split > obs
+check obs exp
+rm obs exp
+
+
+##################################################################
+#  Test SAM with 1bp D operator
+##################################################################
+echo "    genomecov.t7...\c"
+echo \
+"chr1	0	10	1
+chr1	11	21	1" > exp
+$BT genomecov -ibam sam-w-del.bam -bg > obs
+check obs exp
+rm obs exp
+
+
+rm *.bam
\ No newline at end of file
diff --git a/test/genomecov/three_blocks.sam b/test/genomecov/three_blocks.sam
new file mode 100644
index 0000000000000000000000000000000000000000..9bf1a62796d23b7a8cb92a016c32fcef748d45cc
--- /dev/null
+++ b/test/genomecov/three_blocks.sam
@@ -0,0 +1,3 @@
+@HD	VN:1.0	GO:none	SO:coordinate
+@SQ	SN:chr1	LN:1000
+three_blocks	16	chr1	1	40	10M10N10M10N10M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50
diff --git a/test/genomecov/three_blocks_match.bed b/test/genomecov/three_blocks_match.bed
new file mode 100644
index 0000000000000000000000000000000000000000..33123c2f69f08c6dce7cf093cb07be44bb5f9113
--- /dev/null
+++ b/test/genomecov/three_blocks_match.bed
@@ -0,0 +1 @@
+chr1	0	50	three_blocks_match	0	+	0	0	0	3	10,10,10,	0,20,40,
diff --git a/test/genomecov/three_blocks_match_1bp.bed b/test/genomecov/three_blocks_match_1bp.bed
new file mode 100644
index 0000000000000000000000000000000000000000..de8b10d2b4a259eebdf71d7995d930ee23c69af6
--- /dev/null
+++ b/test/genomecov/three_blocks_match_1bp.bed
@@ -0,0 +1 @@
+chr1	10	60	three_blocks_nomatch	0	+	0	0	0	3	11,10,10,	0,20,40,
diff --git a/test/genomecov/three_blocks_nomatch.bed b/test/genomecov/three_blocks_nomatch.bed
new file mode 100644
index 0000000000000000000000000000000000000000..1835260e64f3ed3770b044ffe587c756f8ef85de
--- /dev/null
+++ b/test/genomecov/three_blocks_nomatch.bed
@@ -0,0 +1 @@
+chr1	10	60	three_blocks_nomatch	0	+	0	0	0	3	10,10,10,	0,20,40,
diff --git a/test/genomecov/two_blocks.sam b/test/genomecov/two_blocks.sam
new file mode 100644
index 0000000000000000000000000000000000000000..a28928abaf6174219c349eebd9b4fcab26ac97da
--- /dev/null
+++ b/test/genomecov/two_blocks.sam
@@ -0,0 +1,3 @@
+@HD	VN:1.0	GO:none	SO:coordinate
+@SQ	SN:chr1	LN:1000
+two_blocks	16	chr1	1	40	15M10N15M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50
\ No newline at end of file
diff --git a/test/intersect/one_block.sam b/test/intersect/one_block.sam
new file mode 100644
index 0000000000000000000000000000000000000000..83041cf531ddf8ca5c02e3175509fa983953d9f0
--- /dev/null
+++ b/test/intersect/one_block.sam
@@ -0,0 +1,3 @@
+@HD	VN:1.0	GO:none	SO:coordinate
+@SQ	SN:chr1	LN:249250621
+one_blocks	16	chr1	1	40	30M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50
diff --git a/test/intersect/test-intersect.sh b/test/intersect/test-intersect.sh
index bbc0cbee9af73fbe47112596f3ed4aac25c286a5..ac12faa159dc1e9a873c5e7cf1f1ee344bb17a79 100644
--- a/test/intersect/test-intersect.sh
+++ b/test/intersect/test-intersect.sh
@@ -190,6 +190,68 @@ rm obs exp
 #                       -split                            #
 ###########################################################
 ###########################################################
+samtools view -Sb one_block.sam > one_block.bam 2>/dev/null
+samtools view -Sb two_blocks.sam > two_blocks.bam 2>/dev/null
+samtools view -Sb three_blocks.sam > three_blocks.bam 2>/dev/null
 
 
+##################################################################
+#  Test three blocks matches BED without -split
+##################################################################
+echo "    intersect.t17...\c"
+echo \
+"three_blocks	16	chr1	1	40	10M10N10M10N10M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50" > exp
+$BT intersect -abam three_blocks.bam -b three_blocks_nomatch.bed | samtools view - > obs
+check obs exp
+rm obs exp
+
+##################################################################
+#  Test three blocks does not match BED with -split
+##################################################################
+echo "    intersect.t18...\c"
+touch exp
+$BT intersect -abam three_blocks.bam -b three_blocks_nomatch.bed -split | samtools view - > obs
+check obs exp
+rm obs exp
+
+##################################################################
+#  Test three blocks matches BED with -split
+##################################################################
+echo "    intersect.t19...\c"
+echo \
+"three_blocks	16	chr1	1	40	10M10N10M10N10M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50" > exp
+$BT intersect -abam three_blocks.bam -b three_blocks_match.bed -split | samtools view - > obs
+check obs exp
+rm obs exp
+
+##################################################################
+#  Test three blocks does not match BED with -split and -s
+#  BAM os -, BED is +
+##################################################################
+echo "    intersect.t20...\c"
+touch exp
+$BT intersect -abam three_blocks.bam -b three_blocks_match.bed -split -s | samtools view - > obs
+check obs exp
+rm obs exp
+
+##################################################################
+#  Test three blocks  match BED that overlap 1bp with -split
+##################################################################
+echo "    intersect.t21...\c"
+echo \
+"three_blocks	16	chr1	1	40	10M10N10M10N10M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50" > exp
+$BT intersect -abam three_blocks.bam -b three_blocks_match_1bp.bed -split | samtools view - > obs
+check obs exp
+rm obs exp
+
+################################################################################
+#  Test three blocks does not match BED that overlap 1bp with -split and -f 0.1
+################################################################################
+echo "    intersect.t22...\c"
+touch exp
+$BT intersect -abam three_blocks.bam -b three_blocks_match_1bp.bed -split -f 0.1 | samtools view - > obs
+check obs exp
+rm obs exp
+
 
+rm *.bam
\ No newline at end of file
diff --git a/test/intersect/three_blocks.sam b/test/intersect/three_blocks.sam
new file mode 100644
index 0000000000000000000000000000000000000000..6e3bc601a7135401ddcadcff667be01bbd30a62a
--- /dev/null
+++ b/test/intersect/three_blocks.sam
@@ -0,0 +1,3 @@
+@HD	VN:1.0	GO:none	SO:coordinate
+@SQ	SN:chr1	LN:249250621
+three_blocks	16	chr1	1	40	10M10N10M10N10M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50
diff --git a/test/intersect/three_blocks_match.bed b/test/intersect/three_blocks_match.bed
new file mode 100644
index 0000000000000000000000000000000000000000..33123c2f69f08c6dce7cf093cb07be44bb5f9113
--- /dev/null
+++ b/test/intersect/three_blocks_match.bed
@@ -0,0 +1 @@
+chr1	0	50	three_blocks_match	0	+	0	0	0	3	10,10,10,	0,20,40,
diff --git a/test/intersect/three_blocks_match_1bp.bed b/test/intersect/three_blocks_match_1bp.bed
new file mode 100644
index 0000000000000000000000000000000000000000..de8b10d2b4a259eebdf71d7995d930ee23c69af6
--- /dev/null
+++ b/test/intersect/three_blocks_match_1bp.bed
@@ -0,0 +1 @@
+chr1	10	60	three_blocks_nomatch	0	+	0	0	0	3	11,10,10,	0,20,40,
diff --git a/test/intersect/three_blocks_nomatch.bed b/test/intersect/three_blocks_nomatch.bed
new file mode 100644
index 0000000000000000000000000000000000000000..1835260e64f3ed3770b044ffe587c756f8ef85de
--- /dev/null
+++ b/test/intersect/three_blocks_nomatch.bed
@@ -0,0 +1 @@
+chr1	10	60	three_blocks_nomatch	0	+	0	0	0	3	10,10,10,	0,20,40,
diff --git a/test/intersect/two_blocks.sam b/test/intersect/two_blocks.sam
new file mode 100644
index 0000000000000000000000000000000000000000..6f19dcf93903dc6eed1548121bdb11bc0e9625cc
--- /dev/null
+++ b/test/intersect/two_blocks.sam
@@ -0,0 +1,3 @@
+@HD	VN:1.0	GO:none	SO:coordinate
+@SQ	SN:chr1	LN:249250621
+two_blocks	16	chr1	1	40	15M10N15M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50
\ No newline at end of file
diff --git a/test/test.sh b/test/test.sh
index da6b533b536defd3d2094934acab6c0ebe767bfb..9c287896ec6b51523fe268a95ced2d0d2c1a8d04 100644
--- a/test/test.sh
+++ b/test/test.sh
@@ -3,6 +3,20 @@ cd general
 sh test-general.sh
 cd ..
 
+echo " Testing bedtools bed12tobed6:"
+cd bed12tobed6
+sh test-bed12tobed6.sh
+cd ..
+
+echo " Testing bedtools bamtobed:"
+cd bamtobed
+sh test-bamtobed.sh
+cd ..
+
+echo " Testing bedtools genomecov:"
+cd genomecov
+sh test-genomecov.sh
+cd ..
 
 echo " Testing bedtools intersect:"
 cd intersect