Ad
  • Custom User Avatar

    don't forget to clean it up from the now unnecessary parts, then... ;)

    edit: I made a small change while you wrote your message, please check again (in formatInputs)

  • Custom User Avatar

    Not sure if you still want to know ...

    Although both OutputStream in Simple Test Case and OutputStream test case is null, they have some differences.

    If you insert something like the below in your execute() :

    try{
    output.flush(); //assume output is the name of the outputstream
    System.out.println("succeed");
    } catch (Exception e) {
    System.out.println("failed");
    }

    Then , you will find out in the simple test case , java prints "failed" . In the outputstream test case , java prints "succeed".

    Therefore , even though they are both null , the outputstream in the outputstream test case is a bit different (that you can flush() / write() it).

  • Custom User Avatar

    Not yet, I came down with the flu the weekend I intended to review the issue. In the intervening time there appears to have been three more successful solutions posted. I've also got Haskell and C# translations to review this weekend on other kata (which I really wish would just go through a beta process because I'm not infallible).

  • Custom User Avatar

    Yes, otherwise it would be 8, assuming Codewars' invalidator still works.

    Edit: tested one of the existing solutions, it works.

  • Custom User Avatar

    I'll try to implement an independent Java solution this weekend. There are seven different Java solutions that have been implemented, and you're on the last set of tests, so don't give up in the meantime. Meanwhile, I'll be studying for an upcoming exam most of the rest of this week.

  • Custom User Avatar

    The output stream parameter is null for everything but the output stream test, which I believe comes after the invalid commands set of tests (though I'm unfamiliar with the Java kata test suite). For the output stream set of tests, it's a class that extends ByteArrayOutputStream.

  • Custom User Avatar

    Well, one issue is that I put the Java OutputStream description for the Writing Output in the Reading Input section, so that's fixed. I will admit I can't wrap my head around it 100%.

    I will say, however, that I recommended the person translating it implement it such that the output stream is flushed, at the very least:

    • Before each input command
    • Before an exception is raised
    • Before returning output as String

    It would be great if you'd be willing to confirm that's the minimum expectation for OutputStream flushing, even though greedy flushing might be easier. It would certainly give me more confidence in clarifying that in the description.