Sha256: fd698b757068c45b50a8ba0c1f4d87149e5e9224796f0913c5e302eb3b3c6157

Contents?: true

Size: 1.85 KB

Versions: 109

Compression:

Stored size: 1.85 KB

Contents

source('./hamming.R')
suppressPackageStartupMessages({ require(testthat) })

test_that("identical strands", {
  strand1 <-"A"
  strand2 <- "A"
  expect_equal(hamming(strand1, strand2), 0)
})

test_that("long identical strands", {
  strand1 <-"GGACTGA"
  strand2 <- "GGACTGA"
  expect_equal(hamming(strand1, strand2), 0)
})

test_that("complete distance in single nucleotide strands", {
  strand1 <-"A"
  strand2 <- "G"
  expect_equal(hamming(strand1, strand2), 1)
})

test_that("complete distance in small strands", {
  strand1 <-"AG"
  strand2 <- "CT"
  expect_equal(hamming(strand1, strand2), 2)
})

test_that("small distance in small strands", {
  strand1 <-"AT"
  strand2 <- "CT"
  expect_equal(hamming(strand1, strand2), 1)
})

test_that("small distance", {
  strand1 <-"GGACG"
  strand2 <- "GGTCG"
  expect_equal(hamming(strand1, strand2), 1)
})

test_that("small distance in long strands", {
  strand1 <-"ACCAGGG"
  strand2 <- "ACTATGG"
  expect_equal(hamming(strand1, strand2), 2)
})

test_that("non-unique character in first strand", {
  strand1 <-"AGA"
  strand2 <- "AGG"
  expect_equal(hamming(strand1, strand2), 1)
})

test_that("non-unique character in second strand", {
  strand1 <-"AGG"
  strand2 <- "AGA"
  expect_equal(hamming(strand1, strand2), 1)
})

test_that("same nucleotides in different positions", {
  strand1 <-"TAG"
  strand2 <- "GAT"
  expect_equal(hamming(strand1, strand2), 2)
})

test_that("large distance", {
  strand1 <-"GATACA"
  strand2 <- "GCATAA"
  expect_equal(hamming(strand1, strand2), 4)
})

test_that("empty strands", {
  strand1 <-""
  strand2 <- ""
  expect_equal(hamming(strand1, strand2), 0)
})

test_that("disallow first strand longer", {
  strand1 <-"AATG"
  strand2 <- "AAA"
  expect_error(hamming(strand1, strand2))
})

test_that("disallow second strand longer", {
  strand1 <-"ATA"
  strand2 <- "AGTG"
  expect_error(hamming(strand1, strand2))
})

Version data entries

109 entries across 109 versions & 1 rubygems

Version Path
trackler-2.0.8.16 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.15 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.14 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.13 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.12 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.11 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.10 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.9 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.8 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.7 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.6 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.5 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.4 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.3 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.2 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.8.1 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.7.0 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.6.44 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.6.43 tracks/r/exercises/hamming/test_hamming.R
trackler-2.0.6.42 tracks/r/exercises/hamming/test_hamming.R