Sha256: 6ed41c94449ee494c5f3cd97363e12e21b4d545dbd8f5d0974f5e3348aed6e25

Contents?: true

Size: 1.55 KB

Versions: 123

Compression:

Stored size: 1.55 KB

Contents

$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.'
. "$here\$sut"

Describe "HammingTest" {
	It "tests identical strands" {
		Compute 'A' 'A' | Should be 0
	}
	It "tests log identical strands" {
		Compute "GGACTGA" "GGACTGA" | Should be 0
	}
	
	It "tests complete distance in single nucleotide strands" {
		Compute "A" "G" | Should be 1
	}

	It "tests complete distance in small strands" {
		Compute "AG" "CT" | Should be 2
	}

	It "tests small distance in small strands" {
		Compute "AT"  "CT" | Should be 1
	}

	It "tests small distance" {
		Compute "GGACG" "GGTCG" | Should be 1
	}

	It "tests small distance in long strands" {
		Compute "ACCAGGG" "ACTATGG" | Should be 2
	}

	It "tests non unique character in first strand" {
		Compute "AGA" "AGG" | Should be 1
	}

	It "tests non unique character in second strand" {
		Compute "AGG" "AGA" | Should be 1
	}
	
	It "tests same nucleotides in different position" {
		Compute "TAG" "GAT" | Should be 2
	}

	It "tests large distance" {
		Compute "GATACA" "GCATAA" | Should be 4
	}
	
	It "tests large distance in off by one strand" {
		Compute "GGACGGATTCTG" "AGGACGGATTCT" | Should be 9
	}

	It "tests empty strands" {
		Compute "" "" | Should be 0
	}

	It "tests disallow first strand longer" {
		{ Compute "AATG" "AAA" } | Should Throw "Mismatching string lengths"
	}

	It "tests disallow second strand longer" {
		{ Compute("ATA", "AGTG") } | Should Throw "Mismatching string lengths"
	}
}

Version data entries

123 entries across 123 versions & 1 rubygems

Version Path
trackler-2.0.8.22 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.21 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.20 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.19 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.18 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.17 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.16 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.15 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.14 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.13 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.12 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.11 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.10 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.9 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.8 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.7 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.6 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.5 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.4 tracks/powershell/exercises/hamming/hamming.tests.ps1
trackler-2.0.8.3 tracks/powershell/exercises/hamming/hamming.tests.ps1