Ad
  • Custom User Avatar

    Certainly, you have demonstrated that my tests were not generating edge cases and that it was possible to pass the tests by hardcoding the values. I have modified the function that generates random tests and added new checks. I hope that now the edge cases are better covered. Thank you very much for your help.

  • Custom User Avatar

    The non-random tests aim to ensure that set operations are resolved correctly. If you wish, you can effectively hardcore the results, but I highly doubt that will work in the random tests. The final random test is specially designed to prevent memorization of previously appeared elements. I challenge you to continue with your current strategy for solving the kata, and we'll see if you can do it. If you succeed, I would obviously need to improve the tests, but I don't think you'll be able to.

  • Custom User Avatar

    Ok. It's strange because all I did was clone the array of elements. But, well, if it happens again, let me know. Thanks.

  • Custom User Avatar

    I'm not sure I'm understanding what you're saying. I've reviewed the tests, and I have found that the arrays used to test the result were being shared, which would indeed cause issues if the array is mutated. I've made this change, but I'm not sure if this fixes the issue or if there's something I'm not seeing. Thank you.

  • Custom User Avatar

    Done!

  • Custom User Avatar

    Alright, if I see that many people are still puzzled by this, I'll consider including it. Thank you very much for your feedback.

  • Custom User Avatar

    Regarding the other comment, I'm not sure if you think it's appropriate to clarify it in the kata description, but logically, the laws of set operations are followed, and a double negation restores the original set.

  • 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

    It's not really like that. Depending on how you approach the problem, you can leverage most of the work that has been done in the first part. The warning stems from conversations I've had with others who asked me to explain the difficulties that might arise if you don't carefully read what's required. Nonetheless, if you find it appropriate, you could always create an abstract class and derive the implementation of different types of sets in classes that extend it.

    What you're saying has been said by several people, but I truly believe it's worth treating both sets in a homogeneous way. In fact, I think that's the essence of this kata. It's true that the idea of functional katas occurred to me while I was working on the others. In fact, initially, the class was called ImmutableSet. But later, I found it very interesting to incorporate the functional concept. You're right that it's not good practice to build different objects depending on the constructor parameters. In reality, I don't mind this much, as it's not an OOP practice. I could refactor it, but honestly, I'm not motivated to do so because I don't think it adds much to the exercise's interest.

  • Custom User Avatar

    I'm going to mark this issue as resolved. Let me know if you don't consider it resolved. Thank you.

  • Custom User Avatar
    • Indeed, has is not necessary in sets of elements. In fact, I don't consider it as an operation between sets, but it is necessary in the tests for functional sets. In reality, in my solution, I ended up implementing and using it in both sets for convenience, but I don't want to make it a requirement.

    • Fixed it!. Thanks!

    • Yes, it's a good idea. Done. Thank you.

  • Custom User Avatar

    Thank you very much, I hadn't noticed. I believe it's corrected now.

  • Custom User Avatar

    I believe this has already been corrected. Furthermore, I have improved the performance tests, and now your solution doesn't pass them. You'll need to make some improvements. By the way, impressive solution.

  • Custom User Avatar

    Yes, you are right. It turns out there were indeed tests for the equality function, but there were two it functions nested without a describe, and the tests were being silently skipped. I think I can mark this issue as resolved. Let me know if that's not the case. Thank you.

  • Loading more items...