Skip to content

Commit 9c9d82c

Browse files
committed
Add some tests for negative residue ranges
1 parent 1bf0202 commit 9c9d82c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/StructureToolsTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,24 @@ public void testGetSubRanges() throws StructureException {
201201
chain = substr.getChainByIndex(0);
202202
assertEquals("Did not find the expected number of residues in "+range, 1, chain.getAtomLength() );
203203

204+
205+
// negative residues
206+
range = "A:-3";
207+
substr = StructureTools.getSubRanges(structure2, range);
208+
assertEquals("Wrong number of chains in "+range, 1, substr.size());
209+
chain = substr.getChainByIndex(0);
210+
assertEquals("Did not find the expected number of residues in "+range, 1, chain.getAtomLength() );
211+
range = "A:-3--1";
212+
substr = StructureTools.getSubRanges(structure2, range);
213+
assertEquals("Wrong number of chains in "+range, 1, substr.size());
214+
chain = substr.getChainByIndex(0);
215+
assertEquals("Did not find the expected number of residues in "+range, 3, chain.getAtomLength() );
216+
range = "A:-3-1";
217+
substr = StructureTools.getSubRanges(structure2, range);
218+
assertEquals("Wrong number of chains in "+range, 1, substr.size());
219+
chain = substr.getChainByIndex(0);
220+
assertEquals("Did not find the expected number of residues in "+range, 4, chain.getAtomLength() );
221+
204222
// Special '-' case
205223
range = "-";
206224
substr = StructureTools.getSubRanges(structure2, range);

0 commit comments

Comments
 (0)