Browse Source

fixes in Value.toString

remotes/georgeg/no_streams
lomereiter 9 years ago
parent
commit
2ecabe69c5
  1. 14
      bio/bam/tagvalue.d
  2. 5
      test/unittests.d

14
bio/bam/tagvalue.d

@ -465,13 +465,13 @@ struct Value {
case hexStringTag: sink("H:"); sink(*cast(const(char)[]*)(&u)); break;
case GetTypeId!char: sink.formattedWrite("A:%c", *cast(char*)(&u)); break;
case GetTypeId!(byte[]): sink.formattedWrite("B:b:%s(%s,%)", *cast(byte[]*)(&u)); break;
case GetTypeId!(ubyte[]): sink.formattedWrite("B:B:%s(%s,%)", *cast(ubyte[]*)(&u)); break;
case GetTypeId!(short[]): sink.formattedWrite("B:s:%s(%s,%)", *cast(short[]*)(&u)); break;
case GetTypeId!(ushort[]): sink.formattedWrite("B:S:%s(%s,%)", *cast(ushort[]*)(&u)); break;
case GetTypeId!(int[]): sink.formattedWrite("B:i:%s(%s,%)", *cast(int[]*)(&u)); break;
case GetTypeId!(uint[]): sink.formattedWrite("B:I:%s(%s,%)", *cast(uint[]*)(&u)); break;
case GetTypeId!(float[]): sink.formattedWrite("B:f:%s(%s,%)", *cast(float[]*)(&u)); break;
case GetTypeId!(byte[]): sink.formattedWrite("B:c,%(%s,%)", *cast(byte[]*)(&u)); break;
case GetTypeId!(ubyte[]): sink.formattedWrite("B:C,%(%s,%)", *cast(ubyte[]*)(&u)); break;
case GetTypeId!(short[]): sink.formattedWrite("B:s,%(%s,%)", *cast(short[]*)(&u)); break;
case GetTypeId!(ushort[]): sink.formattedWrite("B:S,%(%s,%)", *cast(ushort[]*)(&u)); break;
case GetTypeId!(int[]): sink.formattedWrite("B:i,%(%s,%)", *cast(int[]*)(&u)); break;
case GetTypeId!(uint[]): sink.formattedWrite("B:I,%(%s,%)", *cast(uint[]*)(&u)); break;
case GetTypeId!(float[]): sink.formattedWrite("B:f,%(%s,%)", *cast(float[]*)(&u)); break;
default: break;
}
}

5
test/unittests.d

@ -116,6 +116,11 @@ unittest {
}
assert(name == value);
auto s1 = toSam(alignment, bf.reference_sequences);
auto s2 = to!string(alignment);
if (s1 != s2)
writeln(s1, "\n", s2);
assert(toSam(alignment, bf.reference_sequences) == to!string(alignment));
}
writeln("Testing exception handling...");

Loading…
Cancel
Save