Sha256: 7e4244e1097d64e4f0ab0eb707f53ec20b57d03c3d277319292c0acc563857f8

Contents?: true

Size: 1.74 KB

Versions: 15

Compression:

Stored size: 1.74 KB

Contents

open Jest;
open Expect;
open Anagram;

describe("Anagram", () => {
  test("no matches", () =>
    expect(anagrams("diaper", ["hello", "world", "zombies", "pants"])) |> toEqual([])
  );
  test("detects two anagrams", () =>
    expect(anagrams("master", ["stream", "pigeon", "maters"])) |> toEqual(["stream", "maters"])
  );
  test("does not detect anagram subsets", () =>
    expect(anagrams("good", ["dog", "goody"]))  |> toEqual([])
  );
  test("detects anagram", () =>
    expect(anagrams("listen", ["enlists", "google", "inlets", "banana"]))  |> toEqual(["inlets"])
  );
  test("detects three anagrams", () =>
    expect(anagrams("allergy", ["gallery", "ballerina", "regally", "clergy", "largely", "leading"]))  |> toEqual(["gallery", "regally", "largely"])
  );
  test("does not detect non-anagrams(with identical checksum", () =>
    expect(anagrams("mass", ["last"]))  |> toEqual([])
  );
  test("detects anagrams(case-insensitively", () =>
    expect(anagrams("Orchestra", ["cashregister", "Carthorse", "radishes"]))  |> toEqual(["Carthorse"])
  );
  test("detects anagrams(using case-insensitive subject", () =>
    expect(anagrams("Orchestra", ["cashregister", "carthorse", "radishes"])) |> toEqual(["carthorse"])
  );
  test("detects anagrams(using case-insensitive possible matches", () =>
    expect(anagrams("orchestra", ["cashregister", "Carthorse", "radishes"])) |> toEqual(["Carthorse"])
  );
  test("does not detect a anagram if the original word is repeated", () =>
    expect(anagrams("go", ["go Go GO"])) |> toEqual([])
  );
  test("anagrams(must use all letters exactly once", () =>
    expect(anagrams("tapper", ["patter"])) |> toEqual([])
  );
  test("capital word is not own anagram", () =>
    expect(anagrams("BANANA", ["Banana"])) |> toEqual([])
  );
})


Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.179 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.178 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.177 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.176 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.175 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.174 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.173 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.172 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.171 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.170 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.169 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.167 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.166 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re
trackler-2.2.1.165 tracks/reasonml/exercises/anagram/__tests__/Anagram_test.re