Ad
  • Custom User Avatar
  • Default User Avatar

    Thanks for the feedback :), I've corrected the code.

  • Default User Avatar

    I didn't downvote your post...
    Fixed tests have the following form:

    [Test]
        public static void test1() 
        {        
            int[] lst = new int[] {12, 15};
            testing(lst, "(2 12)(3 27)(5 15)"); 
            
            lst = new int[] {15,21,24,30,45};
            testing(lst, "...");     
            
            ... other tests ...
        }
    

    Since you have already passed some of my kata with C# have a look at the tests and you will see how they are built.

    Hi, on linqpad my code works fine. But here I get <string.Empty> as a result. Why could this be?

    Because on linqpad the input you give is wrong as I already said.

  • Default User Avatar

    I already answered... When you wrote: "12, 15, ..., -72769, -31744" you wrote your printing of the inputs of several different tests included in "test1()". If you want to have clearly each input of each test you have to print some separator after your lines:

    foreach (var item in lst)
          Console.WriteLine(item);
    

    I think you are at CW since long enough to understand that:-) BTW before posting issues have a look at the top of the page: 795 out of 12,246 passed the C# kata; if there were errors somebody would have seen them before you, all the more that the fixed tests are the same in all languages. Moreover there is no need to repeat a wrong issue and to downvote my previous answer... Good luck and cheers!

  • Default User Avatar

    The input you give is wrong: you are putting 7 tests in only one...

  • Custom User Avatar
  • Custom User Avatar

    Certainly not a "Best Practice"

  • Default User Avatar

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

  • Default User Avatar

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

  • Custom User Avatar

    marked as resolved

  • Default User Avatar
  • Default User Avatar

    Some unnecessary brackets.

  • Custom User Avatar

    Please read the explanation above again. This should clearify this problem.

    But once again an example (I'll replace spaces with underscore like you've done it before):

    • ___uid12345: Leading spaces; The result will be 12345

    • uid12345___: Trailing spaces; The result will be 12345

    • uid_12345: Neither leading nor trailing space! The result will be _12345

    This is the problem you've got. In the random test case each userID begins with uid#_. Therefore every random test case expects a space at the beginning of each userID! I think I'll change this, so that there won't be any misunderstandings in the future...

  • Default User Avatar

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

  • Custom User Avatar

    Ah I see. This only seems to be wrong, but it isn't.

    For example you've got the username uid#John Jefferson. There is a space inside the username, therefore it's not trailing or leading.
    If you now remove the uid part and replace the hashtag, you will get Jon Jefferson.

    In the final test cases each random UserID begins with uid# (<-- including a whitespace behind #). Afterwards, there will be some random numbers added.

    Please mark this as resolved if your question is answered. Thanks

  • Loading more items...