| 1 | enum Nucleotide { |
| 2 | a |
| 3 | c |
| 4 | g |
| 5 | t |
| 6 | } |
| 7 | |
| 8 | type Codon = []Nucleotide |
| 9 | type Gene = []Codon |
| 10 | |
| 11 | fn test_for_in_alias() { |
| 12 | mut gene := Gene([ |
| 13 | Codon([Nucleotide.a, Nucleotide.c, Nucleotide.g]), |
| 14 | Codon([Nucleotide.g, Nucleotide.a, Nucleotide.t]), |
| 15 | ]) |
| 16 | |
| 17 | mut ret := []string{} |
| 18 | for cdn in gene { |
| 19 | println(cdn) |
| 20 | ret << '${cdn}' |
| 21 | } |
| 22 | |
| 23 | assert ret.len == 2 |
| 24 | assert ret[0] == 'Codon([a, c, g])' |
| 25 | assert ret[1] == 'Codon([g, a, t])' |
| 26 | } |
| 27 |