Browse Source

segfault

master
Pjotr Prins 3 years ago
parent
commit
1f96c99bfd
  1. 67
      test/read_bam_file.d

67
test/read_bam_file.d

@ -239,73 +239,6 @@ CigarOperation[] cigarFromString(string cigar) {
assert(fst_read_large.name == "large:r1:0..1:len1:bin4681:hexbin0x1249");
}
// stderr.writeln("Testing Value code...");
Value v = 5;
assert(v.is_integer);
assert(v.toSam() == "i:5");
assert(v == 5);
assert(v == "5");
assert(v != [1,2,3]);
v = "abc";
assert(v.is_string);
assert(v.toSam() == "Z:abc");
assert(v == "abc");
v = [1, 2, 3];
assert(v.is_numeric_array);
assert(v.toSam() == "B:i,1,2,3");
assert(v == [1,2,3]);
assert(v == "[1, 2, 3]");
v = [1.5, 2.3, 17.0];
assert(v.is_numeric_array);
assert(v.toSam() == "B:f,1.5,2.3,17");
assert(approxEqual(to!(float[])(v), [1.5, 2.3, 17]));
v = 5.6;
assert(v.is_float);
assert(v.toSam() == "f:5.6");
assert(approxEqual(to!float(v), 5.6));
v = -17;
assert(v.is_signed);
assert(v.toSam() == "i:-17");
assert(v == -17);
assert(v == "-17");
v = 297u;
assert(v.is_unsigned);
assert(v.toSam() == "i:297");
assert(v == 297);
assert(v == "297");
short[] array_of_shorts = [4, 5, 6];
v = array_of_shorts;
assert(v.is_numeric_array);
assert(v.toSam() == "B:s,4,5,6");
assert(to!(short[])(v) == array_of_shorts);
assert(v == [4,5,6]);
assert(v == "[4, 5, 6]");
v = null;
assert(v.is_nothing);
v = "0eabcf123";
v.setHexadecimalFlag();
assert(v.is_hexadecimal_string);
assert(v == "0eabcf123");
// stderr.writeln("Testing parseAlignmentLine/toSam functions...");
fn = buildPath(dirName(__FILE__), "data", "ex1_header.bam");
bf = new BamReader(fn);
foreach (read; bf.reads) {
auto line = read.to!string();
auto read2 = parseAlignmentLine(line, bf.header);
read2.associateWithReader(bf);
if (read != read2) {
stderr.writeln(read);
stderr.writeln(read2);
stderr.writeln(read.raw_data);
stderr.writeln(read2.raw_data);
}
assert(read == read2);
}
}

Loading…
Cancel
Save