Ad
  • Custom User Avatar
  • Custom User Avatar

    TypeScript translation (literal translation of JavaScript; author inactive)

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    No random tests.

  • Custom User Avatar

    Haskell sample tests don't even compile without any modification to the code.

    Server Execution Error:
    The name of the test module must end with 'Spec'
    

    Adding Spec to the module name later fails with:

    test/Codewars/Kata/AllNoneAny/TestSpec.hs:25:5: error:
        • Couldn't match type ‘Arg a0’ with ‘()’
          Expected type: SpecWith ()
            Actual type: SpecWith (Arg a0)
          The type variable ‘a0’ is ambiguous
        • In a stmt of a 'do' block:
            it "shouldn't use any forbidden modules or functions"
              $ do hidden
                     [FromModule "Prelude" "any", FromModule "Prelude" "all", ....]
          In the second argument of ‘($)’, namely
            ‘do it "shouldn't use any forbidden modules or functions"
                  $ do hidden [...]’
          In a stmt of a 'do' block:
            describe "hidden modules"
              $ do it "shouldn't use any forbidden modules or functions"
                     $ do hidden [...]
       |
    25 |     it "shouldn't use any forbidden modules or functions" $ do
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
       
    
  • Custom User Avatar

    No random tests.

  • Custom User Avatar

    No random tests.

  • Custom User Avatar

    No random tests.

  • Custom User Avatar

    ( JS, haven't really checked Haskell )

    Testing is ++BAD. This solution is two thirds wrong, but it passes.

    What's wrong with that solution and with the tests is left as an exercise for the author.

  • Custom User Avatar

    Needs random test cases

  • Custom User Avatar

    Some extra tests in Haskell, translated from the ones that @jmjjg created in JavaScript:

    describe "empty arrays" $ do
      it "An empty array has not all elements greater than zero" $ do
        A.all (>0) []   `shouldBe` False
      it "An empty array has not any element greater than zero" $ do
        A.any (>0) []   `shouldBe` False
      it "An empty array has none element greater than zero" $ do
        A.none (>0) []   `shouldBe` True
      it "An empty array has not all elements lower or equal than zero" $ do
        A.all (<=0) []   `shouldBe` False
      it "An empty array has not any element lower or equal than zero" $ do
        A.any (<=0) []   `shouldBe` False
      it "An empty array has none element greater or equal than zero" $ do
        A.none (<=0) []   `shouldBe` True
    
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Lack of test cases. Results of the solutions will be unexpected with below code.

    function f(a, //comment
    b,
    /*
    some comments
    */
    c){}
    
  • Loading more items...