Sha256: 0063c0ff91fbb0be38934bb756335d3571ba41b35656c290468ba3bd697066f5

Contents?: true

Size: 1.06 KB

Versions: 242

Compression:

Stored size: 1.06 KB

Contents

use "ponytest"

actor Main is TestList
  new create(env: Env) =>
    PonyTest(env, this)

  fun tag tests(test: PonyTest) =>
    test(_AnagramTest)

class iso _AnagramTest is UnitTest
  fun name(): String => "anagram/Anagram"

  fun apply(h: TestHelper) =>
    let anagrams =  ["banana"; "bob"; "sent"; "sale"; "ales"]
    let empty = Array[String]

    // Anagram should return an empty array if there are no anagrams
    h.assert_array_eq[String](empty, Anagram("bobs", anagrams))
    // Anagram should ignore same words, those aren't anagrams
    h.assert_array_eq[String](empty, Anagram("banana", anagrams))
    // Anagram shouldn't be based on checksum
    h.assert_array_eq[String](empty, Anagram("last", ["mass"]))
    // Anagram should return an array of anagrams if present
    h.assert_array_eq[String](["sent"], Anagram("nets", anagrams))
    // Anagram should be case insensitive
    h.assert_array_eq[String](["sent"], Anagram("nETs", anagrams))
    // Anagram should return multiple anagrams
    h.assert_array_eq[String](["sale"; "ales"], Anagram("seal", anagrams))

Version data entries

242 entries across 242 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.179 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.178 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.177 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.176 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.175 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.174 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.173 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.172 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.171 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.170 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.169 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.167 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.166 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.165 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.164 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.163 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.162 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.161 tracks/pony/exercises/anagram/test.pony
trackler-2.2.1.160 tracks/pony/exercises/anagram/test.pony