Ad
  • Default User Avatar

    I'm looking at the Javascript version, and It's testing with inputs greater than the maximum and expecting a correct answer.

    I just ran it again, and I got:
    "Testing for position number 6,142,530,078,069".
    The descriptions says the max is 1,000,000,000

    It comes from the randExp used to create a random position in the test case, which can be between 1 and 10^14:

    randexp=Math.ceil(Math.random()*14);
    pos=Math.ceil(Math.random()*Math.pow(10,randexp));
    Test.it("Testing for position number "+pos.toString(),function(){
    Test.assertEquals(whoIsNext(names,pos),solution(names,pos),"It should work for random inputs too");
    
  • Default User Avatar

    Maybe I misunderstood, but the description says there will be a maximum input of 1000000000. That didn't seem to be the case.

    Also, not that it's necessary, but there were no tests around error handling (e.g. negative numbers).

  • Default User Avatar

    I'll add something to the description to more explicitly explain the combinations that work, but it's any time a continuous set of three contains one red and two blues. The BBRG test you're talking about is Brown Brown Red Green, which should have zero candidates.

  • Default User Avatar

    This was test case #2, and was intended to test this scenario:
    Test.assertEquals(friendFind(['blue','red','blue','blue','red','blue','red']),2);

    I see now that it also fits with 2 before or after, and you never need to check surrounding. I'll fix that

  • Default User Avatar