From 9a9455154491b2eda742d399efb93eee029e22cd Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 22 Sep 2020 14:30:23 +0100 Subject: [PATCH] JAL-3748 additional asserts to verify start/end after reconstructing sequence from seqCigar --- test/jalview/datamodel/SeqCigarTest.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/jalview/datamodel/SeqCigarTest.java b/test/jalview/datamodel/SeqCigarTest.java index 89169d6..7ec06aa 100644 --- a/test/jalview/datamodel/SeqCigarTest.java +++ b/test/jalview/datamodel/SeqCigarTest.java @@ -20,6 +20,7 @@ */ package jalview.datamodel; +import static org.testng.Assert.assertTrue; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; @@ -94,13 +95,13 @@ public class SeqCigarTest assertEquals("Failed parseCigar", ex_cs_gapped, gen_sgapped.getCigarstring()); - testSeqRecovery(gen_sgapped, s_gapped); + assertTrue(testSeqRecovery(gen_sgapped, s_gapped,true)); /* * Test dataset resolution */ SeqCigar sub_gapped = new SeqCigar(s_subsequence_gapped); - testSeqRecovery(sub_gapped, s_subsequence_gapped); + assertTrue(testSeqRecovery(sub_gapped, s_subsequence_gapped,true)); /* * Test width functions @@ -187,7 +188,7 @@ public class SeqCigarTest assertEquals("Failed getCigarstring", ex_cs_gapped, cs_gapped); } - protected void testSeqRecovery(SeqCigar gen_sgapped, SequenceI s_gapped) + protected boolean testSeqRecovery(SeqCigar gen_sgapped, SequenceI s_gapped,boolean startEndCheck) { // this is non-rigorous - start and end recovery is not tested. SequenceI gen_sgapped_s = gen_sgapped.getSeq('-'); @@ -201,7 +202,14 @@ public class SeqCigarTest System.err.println("Couldn't reconstruct sequence.\n" + gen_sgapped_s.getSequenceAsString() + "\n" + s_gapped.getSequenceAsString()); + return false; } + if (startEndCheck) + { + assertEquals("Start not conserved in reconstructed sequence",s_gapped.getStart(),gen_sgapped_s.getStart()); + assertEquals("End not conserved in reconstructed sequence",s_gapped.getEnd(),gen_sgapped_s.getEnd()); + } + return true; } } -- 1.7.10.2