learning F#, it seems pretty cool, favourite functional language so far.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

HammingTests.fs 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // This file was auto-generated based on version 2.3.0 of the canonical data.
  2. module HammingTests
  3. open FsUnit.Xunit
  4. open Xunit
  5. open Hamming
  6. [<Fact>]
  7. let ``Empty strands`` () =
  8. distance "" "" |> should equal (Some 0)
  9. [<Fact>]
  10. let ``Single letter identical strands`` () =
  11. distance "A" "A" |> should equal (Some 0)
  12. [<Fact>]
  13. let ``Single letter different strands`` () =
  14. distance "G" "T" |> should equal (Some 1)
  15. [<Fact>]
  16. let ``Long identical strands`` () =
  17. distance "GGACTGAAATCTG" "GGACTGAAATCTG" |> should equal (Some 0)
  18. [<Fact>]
  19. let ``Long different strands`` () =
  20. distance "GGACGGATTCTG" "AGGACGGATTCT" |> should equal (Some 9)
  21. [<Fact>]
  22. let ``Disallow first strand longer`` () =
  23. distance "AATG" "AAA" |> should equal None
  24. [<Fact>]
  25. let ``Disallow second strand longer`` () =
  26. distance "ATA" "AGTG" |> should equal None
  27. [<Fact>]
  28. let ``Disallow left empty strand`` () =
  29. distance "" "G" |> should equal None
  30. [<Fact>]
  31. let ``Disallow right empty strand`` () =
  32. distance "G" "" |> should equal None