void test_unpack_seq(test_harness& t) { t.check(unpack_seq("", 0), "", "unpack_seq.empty"); t.check(unpack_seq("\x10", 1), "A", "unpack_seq.A"); t.check(unpack_seq("\x20", 1), "C", "unpack_seq.C"); t.check(unpack_seq("\x40", 1), "G", "unpack_seq.G"); t.check(unpack_seq("\x80", 1), "T", "unpack_seq.T"); t.check(unpack_seq("\x18", 2), "AT", "unpack_seq.AT"); t.check(unpack_seq("\x84", 2), "TG", "unpack_seq.TG"); t.check(unpack_seq("\x42", 2), "GC", "unpack_seq.GC"); t.check(unpack_seq("\x41\x88\x12\x10", 7), "GATTACA", "unpack_seq.GATTACA"); test_packing(t, "", ""); test_packing(t, "AACGTCCTGCAGGATTA", "\x11\x24\x82\x28\x42\x14\x41\x88\x10"); test_packing(t, "acmgrsvtwyhkdb.", "\x12\x34\x56\x78\x9a\xbc\xde\xf0", "ACMGRSVTWYHKDBN"); bool threw = false; try { char buffer[10]; sam::alignment::pack_seq(buffer, "ATZ", 3); } catch (...) { threw = true; } t.check(threw, "pack_seq.invalid_char"); }
void main() { int result; result = test_packing(); if (result == 0) printf("test_packing PASSED!\n"); else printf("test_packing FAILED!\n"); }