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.

ArmstrongNumbersTests.fs 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // This file was auto-generated based on version 1.1.0 of the canonical data.
  2. module ArmstrongNumbersTests
  3. open FsUnit.Xunit
  4. open Xunit
  5. open ArmstrongNumbers
  6. [<Fact>]
  7. let ``Zero is an Armstrong number`` () =
  8. isArmstrongNumber 0 |> should equal true
  9. [<Fact>]
  10. let ``Single digit numbers are Armstrong numbers`` () =
  11. isArmstrongNumber 5 |> should equal true
  12. [<Fact>]
  13. let ``There are no 2 digit Armstrong numbers`` () =
  14. isArmstrongNumber 10 |> should equal false
  15. [<Fact>]
  16. let ``Three digit number that is an Armstrong number`` () =
  17. isArmstrongNumber 153 |> should equal true
  18. [<Fact>]
  19. let ``Three digit number that is not an Armstrong number`` () =
  20. isArmstrongNumber 100 |> should equal false
  21. [<Fact>]
  22. let ``Four digit number that is an Armstrong number`` () =
  23. isArmstrongNumber 9474 |> should equal true
  24. [<Fact>]
  25. let ``Four digit number that is not an Armstrong number`` () =
  26. isArmstrongNumber 9475 |> should equal false
  27. [<Fact>]
  28. let ``Seven digit number that is an Armstrong number`` () =
  29. isArmstrongNumber 9926315 |> should equal true
  30. [<Fact>]
  31. let ``Seven digit number that is not an Armstrong number`` () =
  32. isArmstrongNumber 9926314 |> should equal false