diff options
Diffstat (limited to 'v_windows/v/old/vlib/v/tests/for_in_alias_test.v')
-rw-r--r-- | v_windows/v/old/vlib/v/tests/for_in_alias_test.v | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/v_windows/v/old/vlib/v/tests/for_in_alias_test.v b/v_windows/v/old/vlib/v/tests/for_in_alias_test.v new file mode 100644 index 0000000..af5ce8b --- /dev/null +++ b/v_windows/v/old/vlib/v/tests/for_in_alias_test.v @@ -0,0 +1,26 @@ +enum Nucleotide { + a + c + g + t +} + +type Codon = []Nucleotide +type Gene = []Codon + +fn test_for_in_alias() { + mut gene := Gene([ + Codon([Nucleotide.a, Nucleotide.c, Nucleotide.g]), + Codon([Nucleotide.g, Nucleotide.a, Nucleotide.t]), + ]) + + mut ret := []string{} + for cdn in gene { + println(cdn) + ret << '$cdn' + } + + assert ret.len == 2 + assert ret[0] == 'Codon([a, c, g])' + assert ret[1] == 'Codon([g, a, t])' +} |