Sha256: 7dc2ec76caa9ff7de9c1ec9b0e75b0db7bcbc271fc1b9685ec97fc931830ce1a

Contents?: true

Size: 1019 Bytes

Versions: 58

Compression:

Stored size: 1019 Bytes

Contents

import ceylon.test { ... }

// Tests adapted from problem-specifications version 1.0.1
{[String, String|Null]*} cases => {
  // empty strand
  ["",                         ""],
  // single C nucleotide strand
  ["C",                       "G"],
  // single G nucleotide strand
  ["G",                       "C"],
  // single A nucleotide strand
  ["A",                       "U"],
  // single T nucleotide strand
  ["T",                       "A"],
  // longer strand
  ["ACGTGGTCTTAA", "UGCACCAGAAUU"],
  // strand with DNA nucleotides
  ["U",                      null],
  // strand with invalid nucleotides
  ["XCGFGGTDTTAA",           null],
  // strand with invalid nucleotides after the first nucleotide
  ["ACGTFGTBTEAA",           null]
};

test
parameters(`value cases`)
void testHamming(String dna, String|Null expected) {
  if (exists expected) {
    assertEquals(transcription(dna), expected);
  } else if (!is Error result = transcription(dna)) {
    fail("should have errored, but got ``result``");
  }
}

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
trackler-2.2.1.88 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.87 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.86 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.85 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.84 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.83 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.82 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.81 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.80 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.79 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.78 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.77 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.76 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.75 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.74 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.73 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.72 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.71 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.70 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon
trackler-2.2.1.69 tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon