Ad
  • Default User Avatar

    I was doing this kata in JavaScript, and I believe the test that initially failed and then passed dealt with backstage passes. Unfortunately, I do not recall the input or output, as I was expecting to see that failed test a second time and didn't note it.

    In reference to giving the kata an "interview feel", I have had several interviews like this and am generally told that the purpose of the question is not only to see how the candidate solves the problem but how he/she interacts with the team/individual asking the question. These tend to be "social" or "culture" type questions, rather than hammer-at-it-until-it-breaks type questions. Generally, the purpose is to work collaboratively with those asking the question - which is not possible in this format.

  • Default User Avatar

    Hi,

    I enjoyed the Kata, but wanted to raise an issue. Since the tests are random, it is possible that an incorrect solution will be accepted and appear in the solved answers portion. I had an answer that came up with a failed test and resubmitted my answer to see if other tests would fail when it came up passing all tests. I then attempted to rerun it but all the tests passed and my answer was accepted. Rather than offering randomized tests, you should make sure your tests cover all acceptance criteria. The purpose of a kata isn't to trick the participant or show that you can be more clever. The instructions should be clear and the tests should be complete and consistent. To that end, as a native English speaker and a linguist, I agree that the use of "the quality of an item can never be negative or increase beyond 50" is ambiguous, as it doesn't address what should happen if the value is already above 50. The instructions do imply that the value cannot exceed 50 - particularly since this is supposed to be a replacement for the existing store management system, which should have also followed these rules. As it is written, it is hard to imagine anyone successfully completing this kata without receiving feedback from the test results. Thanks!

  • Default User Avatar

    Hi xcthulhu, I don't know if you've noticed but there are several cheating solutions under JavaScript and Python. Thanks.

  • Default User Avatar

    Fortunately, the author of that kata has fixed the tests.

  • Default User Avatar
  • Default User Avatar

    I'd like to suggest that those developing kata throw in a random number in tests that return numbers. I just came across a solution in Least Common Multiple (JavaScript) where a user created an array of the answers and popped them on each test case. We can avoid that sort of cheat through randomly generated test cases. BTW, that user is currently ranked #201!

    My 2 cents: ban the f#@kers!

  • Default User Avatar
  • Default User Avatar

    Try using this test case:

    var num = Math.floor(Math.random() * 101);
    it('Should fizzify ' + num + ' numbers correctly', function() {
      var expected = [1,2,'Fizz',4,'Buzz','Fizz',7,8,'Fizz','Buzz',
                     11,'Fizz',13,14,'FizzBuzz',16,17,'Fizz',19,'Buzz',
                     'Fizz',22,23,'Fizz','Buzz',26,'Fizz',28,29,'FizzBuzz',
                     31,32,'Fizz',34,'Buzz','Fizz',37,38,'Fizz','Buzz',
                     41,'Fizz',43,44,'FizzBuzz',46,47,'Fizz',49,'Buzz',
                     'Fizz',52,53,'Fizz','Buzz',56,'Fizz',58,59,'FizzBuzz',
                     61,62,'Fizz',64,'Buzz','Fizz',67,68,'Fizz','Buzz',
                     71,'Fizz',73,74,'FizzBuzz',76,77,'Fizz',79,'Buzz',
                     'Fizz',82,83,'Fizz','Buzz',86,'Fizz',88,89,'FizzBuzz',
                     91,92,'Fizz',94,'Buzz','Fizz',97,98,'Fizz','Buzz'
                     ];
      Test.assertEquals(JSON.stringify(fizzbuzz(num)), JSON.stringify(expected.slice(0,num)) , 'Fails with ' + num +' numbers!');
    });
    
  • Default User Avatar

    It's ugly, but it's darn fast for large numbers :-)

  • Default User Avatar

    OK, this has gotten ridiculous! I just failed a test with:
    function add2(x,y) { return x+y; } ; add2_ = defaultArguments(add,{y:9})

    For the love of God, add doesn't take a y, so why is NaN wrong for add2_(10)?!?

  • Default User Avatar

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