Sha256: c8c99b15fddd5adee8a9106c2f1ec01303ab4d251fb6ec42cc8b544bc10bb8f1

Contents?: true

Size: 700 Bytes

Versions: 46

Compression:

Stored size: 700 Bytes

Contents

import ceylon.test { ... }

{[String, String, Integer?]*} cases => {
  ["A", "A", 0],
  ["GGACTGA", "GGACTGA", 0],
  ["A", "G", 1],
  ["AG", "CT", 2],
  ["AT", "CT", 1],
  ["GGACG", "GGTCG", 1],
  ["ACCAGGG", "ACTATGG", 2],
  ["AGA", "AGG", 1],
  ["AGG", "AGA", 1],
  ["TAG", "GAT", 2],
  ["GATACA", "GCATAA", 4],
  ["GGACGGATTCTG", "AGGACGGATTCT", 9],
  ["", "", 0],
  ["AATG", "AAA", null],
  ["ATA", "AGTG", null]
};

test
parameters(`value cases`)
void testHamming(String s1, String s2, Integer? expected) {
  value result = distance(s1, s2);
  if (exists expected) {
    assertEquals(result, expected);
  } else if (!is Error result) {
    fail("should have errored, but got ``result``");
  }
}

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
trackler-2.0.8.2 tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon
trackler-2.0.8.1 tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon
trackler-2.0.7.0 tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon
trackler-2.0.6.44 tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon
trackler-2.0.6.43 tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon
trackler-2.0.6.42 tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon