1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.analysis; |
22 |
|
|
23 |
|
import static org.testng.AssertJUnit.assertEquals; |
24 |
|
import static org.testng.AssertJUnit.assertTrue; |
25 |
|
|
26 |
|
import jalview.gui.JvOptionPane; |
27 |
|
|
28 |
|
import java.util.Arrays; |
29 |
|
|
30 |
|
import org.testng.annotations.BeforeClass; |
31 |
|
import org.testng.annotations.Test; |
32 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (39) |
Complexity: 4 |
Complexity Density: 0.11 |
|
33 |
|
public class CodingUtilsTest |
34 |
|
{ |
35 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
36 |
1 |
@BeforeClass(alwaysRun = true)... |
37 |
|
public void setUpJvOptionPane() |
38 |
|
{ |
39 |
1 |
JvOptionPane.setInteractiveMode(false); |
40 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
41 |
|
} |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
43 |
1 |
@Test(groups = { "Functional" })... |
44 |
|
public void testDecodeCodon() |
45 |
|
{ |
46 |
1 |
assertTrue( |
47 |
|
Arrays.equals(new char[] |
48 |
|
{ 'A', 'A', 'A' }, CodingUtils.decodeCodon(0))); |
49 |
1 |
assertTrue( |
50 |
|
Arrays.equals(new char[] |
51 |
|
{ 'A', 'A', 'C' }, CodingUtils.decodeCodon(1))); |
52 |
1 |
assertTrue( |
53 |
|
Arrays.equals(new char[] |
54 |
|
{ 'A', 'A', 'G' }, CodingUtils.decodeCodon(2))); |
55 |
1 |
assertTrue( |
56 |
|
Arrays.equals(new char[] |
57 |
|
{ 'A', 'A', 'T' }, CodingUtils.decodeCodon(3))); |
58 |
1 |
assertTrue( |
59 |
|
Arrays.equals(new char[] |
60 |
|
{ 'A', 'C', 'A' }, CodingUtils.decodeCodon(4))); |
61 |
1 |
assertTrue( |
62 |
|
Arrays.equals(new char[] |
63 |
|
{ 'C', 'A', 'A' }, CodingUtils.decodeCodon(16))); |
64 |
1 |
assertTrue( |
65 |
|
Arrays.equals(new char[] |
66 |
|
{ 'G', 'G', 'G' }, CodingUtils.decodeCodon(42))); |
67 |
1 |
assertTrue( |
68 |
|
Arrays.equals(new char[] |
69 |
|
{ 'T', 'T', 'T' }, CodingUtils.decodeCodon(63))); |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
72 |
1 |
@Test(groups = { "Functional" })... |
73 |
|
public void testDecodeNucleotide() |
74 |
|
{ |
75 |
1 |
assertEquals('A', CodingUtils.decodeNucleotide(0)); |
76 |
1 |
assertEquals('C', CodingUtils.decodeNucleotide(1)); |
77 |
1 |
assertEquals('G', CodingUtils.decodeNucleotide(2)); |
78 |
1 |
assertEquals('T', CodingUtils.decodeNucleotide(3)); |
79 |
1 |
assertEquals('0', CodingUtils.decodeNucleotide(4)); |
80 |
|
} |
81 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
82 |
1 |
@Test(groups = { "Functional" })... |
83 |
|
public void testEncodeCodon() |
84 |
|
{ |
85 |
1 |
assertTrue(CodingUtils.encodeCodon('Z') < 0); |
86 |
1 |
assertEquals(0, CodingUtils.encodeCodon('a')); |
87 |
1 |
assertEquals(0, CodingUtils.encodeCodon('A')); |
88 |
1 |
assertEquals(1, CodingUtils.encodeCodon('c')); |
89 |
1 |
assertEquals(1, CodingUtils.encodeCodon('C')); |
90 |
1 |
assertEquals(2, CodingUtils.encodeCodon('g')); |
91 |
1 |
assertEquals(2, CodingUtils.encodeCodon('G')); |
92 |
1 |
assertEquals(3, CodingUtils.encodeCodon('t')); |
93 |
1 |
assertEquals(3, CodingUtils.encodeCodon('T')); |
94 |
1 |
assertEquals(3, CodingUtils.encodeCodon('u')); |
95 |
1 |
assertEquals(3, CodingUtils.encodeCodon('U')); |
96 |
|
|
97 |
1 |
assertEquals(-1, CodingUtils.encodeCodon(null)); |
98 |
1 |
assertEquals(0, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'A' })); |
99 |
1 |
assertEquals(1, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'C' })); |
100 |
1 |
assertEquals(2, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'G' })); |
101 |
1 |
assertEquals(3, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'T' })); |
102 |
1 |
assertEquals(4, CodingUtils.encodeCodon(new char[] { 'A', 'C', 'A' })); |
103 |
1 |
assertEquals(16, CodingUtils.encodeCodon(new char[] { 'C', 'A', 'A' })); |
104 |
1 |
assertEquals(42, CodingUtils.encodeCodon(new char[] { 'G', 'G', 'G' })); |
105 |
1 |
assertEquals(63, CodingUtils.encodeCodon(new char[] { 'T', 'T', 'T' })); |
106 |
|
} |
107 |
|
|
108 |
|
} |