learning F#, it seems pretty cool, favourite functional language so far.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

NucleotideCountTests.fs 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // This file was auto-generated based on version 1.3.0 of the canonical data.
  2. module NucleotideCountTests
  3. open FsUnit.Xunit
  4. open Xunit
  5. open NucleotideCount
  6. [<Fact>]
  7. let ``Empty strand`` () =
  8. let strand = ""
  9. let expected =
  10. [ ('A', 0);
  11. ('C', 0);
  12. ('G', 0);
  13. ('T', 0) ]
  14. |> Map.ofList
  15. |> Some
  16. nucleotideCounts strand |> should equal expected
  17. [<Fact>]
  18. let ``Can count one nucleotide in single-character input`` () =
  19. let strand = "G"
  20. let expected =
  21. [ ('A', 0);
  22. ('C', 0);
  23. ('G', 1);
  24. ('T', 0) ]
  25. |> Map.ofList
  26. |> Some
  27. nucleotideCounts strand |> should equal expected
  28. [<Fact>]
  29. let ``Strand with repeated nucleotide`` () =
  30. let strand = "GGGGGGG"
  31. let expected =
  32. [ ('A', 0);
  33. ('C', 0);
  34. ('G', 7);
  35. ('T', 0) ]
  36. |> Map.ofList
  37. |> Some
  38. nucleotideCounts strand |> should equal expected
  39. [<Fact>]
  40. let ``Strand with multiple nucleotides`` () =
  41. let strand = "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"
  42. let expected =
  43. [ ('A', 20);
  44. ('C', 12);
  45. ('G', 17);
  46. ('T', 21) ]
  47. |> Map.ofList
  48. |> Some
  49. nucleotideCounts strand |> should equal expected
  50. [<Fact>]
  51. let ``Strand with invalid nucleotides`` () =
  52. let strand = "AGXXACT"
  53. let expected = None
  54. nucleotideCounts strand |> should equal expected