/*
* Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
* Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Jalview. If not, see .
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.fail;
import jalview.analysis.SecStrConsensus.SimpleBP;
import java.util.Vector;
import org.testng.annotations.Test;
public class RnaTest
{
@Test(groups = { "Functional" })
public void testGetSimpleBPs() throws WUSSParseException
{
String rna = "([{})]"; // JAL-1081 example
Vector bps = Rna.GetSimpleBPs(rna);
assertEquals(3, bps.size());
/*
* the base pairs are added in the order in which the matching base is found
*/
assertEquals(2, bps.get(0).bp5); // {
assertEquals(3, bps.get(0).bp3); // }
assertEquals(0, bps.get(1).bp5); // (
assertEquals(4, bps.get(1).bp3); // )
assertEquals(1, bps.get(2).bp5); // [
assertEquals(5, bps.get(2).bp3); // ]
}
@Test(groups = { "Functional" })
public void testGetSimpleBPs_unmatchedOpener()
{
String rna = "(([{})]";
try
{
Rna.GetSimpleBPs(rna);
fail("expected exception");
} catch (WUSSParseException e)
{
// expected
}
}
@Test(groups = { "Functional" })
public void testGetSimpleBPs_unmatchedCloser()
{
String rna = "([{})]]";
try
{
Rna.GetSimpleBPs(rna);
fail("expected exception");
} catch (WUSSParseException e)
{
// expected
}
}
}