Ad
  • Custom User Avatar

    Hi! Thanks for the KATA! It was a good exercise to learn Go! :)

    I think there may be something wrong with the tests or the maths of the tests? When running a TEST I get the below failed response where the maths do not calculate correctly. The square sum of 1 and 2 is 1 + 4 = 5, rather than 6; and the square sum of [0,3,4,5] is 0+9+16+25 = 50, rather than 57.

    Testing [1,2]
    Expected
        <int>: 6
    to equal
        <int>: 5
    
    Testing [0,3,4,5]
    Expected
        <int>: 57
    to equal
        <int>: 50
    

    The other weird thing is that these two test seem to be checking for 5 and 50, specifically?

    It("Testing [1,2]",func() {Expect(SquareSum([]int{1,2})).To(Equal(5))})
    It("Testing [0,3,4,5]",func() {Expect(SquareSum([]int{0,3,4,5})).To(Equal(50))})
    It("Testing []",func() {Expect(SquareSum([]int{})).To(Equal(0))})
    

    I'm moving on to the next Kata but thought to share this just in case something is off. Thanks again!

  • Custom User Avatar

    It is very obviouse, when looking at the other (much shorter) solutions, that I completely misunderstood the explanation and rules of the problem.

  • Custom User Avatar

    Well done on the combination of array_map and str_split.