forked from packetzero/code1920
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genetic_code_test.go
48 lines (43 loc) · 925 Bytes
/
genetic_code_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package microbio
import (
"testing"
"github.com/stretchr/testify/assert"
)
var RNABASES = []string{"U", "C", "A", "G"}
const expectedAminos = "PHE,PHE,LEU,LEU," +
"SER,SER,SER,SER," +
"TYR,TYR,nil,nil," +
"CYS,CYS,nil,TRP," +
// C row
"LEU,LEU,LEU,LEU," +
"PRO,PRO,PRO,PRO," +
"HIS,HIS,GLN,GLN," +
"ARG,ARG,ARG,ARG," +
// A row
"ILE,ILE,ILE,MET," +
"THR,THR,THR,THR," +
"ASN,ASN,LYS,LYS," +
"SER,SER,ARG,ARG," +
// G row
"VAL,VAL,VAL,VAL," +
"ALA,ALA,ALA,ALA," +
"ASP,ASP,GLU,GLU," +
"GLY,GLY,GLY,GLY,"
func TestLookupAminoForCodon(t *testing.T) {
str := ""
for _, a := range RNABASES {
for _, b := range RNABASES {
for _, c := range RNABASES {
// codonStr will be "UAG" , etc.
codonStr := a + b + c
pAmino := lookupAminoForCodon(codonStr)
if pAmino == nil {
str += "nil,"
} else {
str += pAmino.id + ","
}
}
}
}
assert.Equal(t, expectedAminos, str)
}