Ad
  • Custom User Avatar

    the same here

    for string

    '<~mQ?)VbdRNg_W`0n/SEp`4rSS>mC3#W7oLTb*%,X"S7=K\'=o@M&A-AK$$Su`Z;%bko0_p:9P(YMhiX>k\\~>' (two escaped char inside)
    

    expect result:

    'î<‚‡Ì¶ÿ\u0018Âé +-gÞv>\u001auùí·üèGS"/\u001c\'n¤œc7$Yüé\u001ad\u0004žQ\u000b3p5\r\nQ\u00129\u00070ùÁ’„0Uâ\f\u0001õ' // randome add \r\n inside
    

    my result, I think correct:

    'î<‚‡Ì¶ÿ\u0018Âé +-gÞv>\u001auùí·üèGS\"/\u001c'n¤œc7$Yüé\u001ad\u0004žQ\u000b3p5Q\u00129\u00070ùÁ’„0Uâ\f\u0001õ'
    

    please check random test generator

  • Custom User Avatar

    no problem. and don't feel alone in your troubles – it took me several different implementation approaches before i finally found one that was worth submitting. if you have any more questions, feel free to let me know – i'd be happy to help.

  • Default User Avatar

    Well, this is embarrassing.

    Thanks a lot for taking the time to reply. This is not the first time that I was working on an encoder/decoder pair, and argued from the perspective of one part of the pair, when I was working on the other.
    Maybe I'll learn one day...

    Anyway, I'll start over and hopefully finally check this one off.

  • Custom User Avatar

    replies to your list:


    1. yes, that is correct

    2. that was what i initially thought, too. but after finding the bugs in my own code, i realized that the inputs to decode are in the correct ascii85 range

    3. You can create a bytestream from a JavaScript string using

       let ord = x => x.charCodeAt(0);
       let bytes = Uint8Array.from('ABCDabcd', ord);
       console.log(bytes);
       [65, 66, 67, 68, 97, 98, 99, 100]
      
    4. for the sake of simplicity, i think it's OK that the kata only works on String types (annoying as that might be)


    again, i don't think there are character encoding issues here:

    • encoding can take any byte and it expects output in the printable, ascii85 range.
    • decoding will always give you printable, ascii 85 chars and expects any bytes as output.
  • Default User Avatar

    Ah, that's unfortunate. I suppose that's because if you change test cases after the fact, there might be (and there would be in this kata) a bunch of already submitted solutions that won't pass the new test suite.

    On the other hand, it's not good to have incorrect new solutions pass, either. Personally, I would prefer to fix the tests so that future submissions are correct, but I understand that takes some effort in the implementation, and probably even in coming up with a proper process in the first place.

  • Default User Avatar

    This issue still persists after a year. I have tried to figure out how to edit the testcases, but unfortunately could not.

    It should be sufficient to add two testcases that remove nodes 4 and 12 respectively, and to check via the already existing helper function "traverse" against a [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] and [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15].

    Getting the remove method right is one of the very few tricky bits in this kata, and should really be added to this otherwise very thorough suite.

  • Default User Avatar

    The description could be a little bit clearer, although it does describe what's happening.

    To clarify: In the tests, two clients are being instantiated, called A and B. A sends the A messages, i.e. in your example, A sends "a1" and "a2". B sends the B messages; in your example, B sends "b1".

    The result should be that client A receives the message "b1", and client B receives the messages "a1", "a2", in that order.

    It seems that in your implementation, all messages are being received by client B. Maybe something went wrong with the instantiation?

    Edit: Aaand I answered a 7 months old question. Sorry, should have checked the date before my necromancy.

  • Default User Avatar

    I seem consistently to get a result of 96 tests passed, and 1 failed.

    The failing test has the title " Testing ASCII85 decoding with random binary input: ".

    Now, it is possible that I'm misunderstanding something, but here's my problem with this test:

    1. As I understand it, the ASCII85 encoding is specifically designed to result in a byte stream with values exclusively from the interval [33, 117], with the occasional 122 (z).
    2. The test appears to feed in a truly random bytestream, with values from all of [0-255].
    3. The problem might be a character encoding problem, maybe specific to JS. There's no built-in method to convert a String to a canonical byte stream.
    4. To be unambiguous, the tests and the encoding/decoding methods should in fact work on bytestreams.

    Again, it's quite likely that I misunderstand the algorithm or am misinterpreting something. I've stated my concerns in a straightforward way to make it easier to address possible misconceptions on my end.

    For the sake of completeness, here are the bytes that tripped up my "solution". I couldn't figure out how I could access the "should"-string from the test case to work out what exactly the problem was, since there appeared to be a number of characters in there that couldn't be displayed, or created line breaks or other formatting. Additionally, I can't be sure that I'm seeing the correct string because of arbitrary character encoding mismatches.

    [14, 255, 245, 255, 249, 255, 243, 255, 244, 60, 86, 34, 117, 34, 48, 81, 75, 106, 101, 10, 255, 243, 255, 223, 255, 236, 255, 254, 70, 68, 85, 103, 44, 6, 255, 245, 255, 228, 3, 4, 7, 255, 245, 8, 255, 247, 255, 240, 29, 255, 205, 255, 236, 6, 255, 206, 50, 63, 72, 93, 91, 70, 113, 42, 105, 60, 33, 49, 85, 79, 72, 72, 111, 114, 85, 107, 51, 92, 110, 104, 97, 21, 6, 4, 255, 225, 255, 235, 2, 255, 243, 24, 20, 255, 232, 61, 112, 40, 76, 68, 55, 99, 59, 108, 71, 8, 255, 233, 255, 251, 255, 221, 17, 2, 32, 255, 227, 255, 231, 255, 211, 23, 255, 228, 255, 208, 255, 213, 255, 249, 6, 255, 243, 255, 229, 255, 217, 255, 226, 73, 83, 54, 54, 94, 50, 103, 86, 36, 116, 42, 54, 63, 49, 95, 24, 255, 209, 255, 255, 7, 255, 205, 57, 60, 78, 52, 87, 255, 255, 23, 255, 241, 255, 219, 255, 216, 61, 52, 51, 99, 103, 32, 9, 19, 255, 220, 255, 208, 20, 255, 224, 255, 222, 255, 207, 255, 233, 20, 29, 1, 255, 231, 255, 234, 24, 25, 255, 250, 255, 217, 4, 9, 5, 255, 218, 1, 255, 213, 255, 255, 3, 255, 222, 29, 255, 217, 24, 30, 255, 237, 255, 239, 16, 40, 106, 96, 63, 69, 41, 63, 59, 66, 76, 54, 85, 86, 73, 112, 68, 61, 98, 90, 107, 71, 73, 48, 36, 71, 41, 85, 43, 84, 58, 44, 107, 58, 85, 66, 43, 81, 34, 69, 49, 41, 57, 98, 90, 111, 67, 109, 115, 76, 57, 63, 85, 54, 80, 67, 26, 255, 223, 255, 206, 255, 251, 255, 219, 17, 255, 231, 255, 253, 255, 239, 32, 32, 255, 219, 255, 231, 255, 236, 17, 61, 47, 55, 83, 77, 4, 255, 248, 0, 32, 255, 210, 6, 255, 212, 255, 245, 14, 255, 220, 61, 75, 50, 42, 91, 1, 33, 32, 2, 255, 207, 73, 113, 41, 115, 47, 66, 91, 106, 64, 89, 55, 116, 109, 41, 81, 42, 38, 55, 72, 75, 4, 255, 251, 255, 245, 255, 235, 255, 209, 65, 70, 47, 97, 53, 39, 48, 116, 63, 96, 34, 94, 66, 75, 36, 49, 44, 49, 86, 88, 58, 95, 92, 33, 56, 50, 74, 59, 101, 99, 38, 71, 37, 59, 113, 28, 28, 255, 215, 9, 24, 64, 73, 109, 69, 117, 45, 52, 57, 96, 35, 51, 101, 56, 111, 33, 12, 26, 33, 255, 251, 255, 250, 34, 114, 68, 40, 43, 65, 75, 45, 57, 47, 65, 54, 92, 37, 43, 6, 32, 255, 216, 255, 231, 255, 220, 45, 100, 51, 71, 78, 31, 255, 252, 31, 255, 241, 255, 255, 41, 42, 45, 110, 80, 31, 12, 30, 28, 255, 208, 22, 24, 255, 238, 5, 8, 255, 254, 255, 209, 255, 250, 10, 255, 240, 15, 255, 240, 255, 235, 255, 229, 255, 232, 8, 17, 255, 235, 32, 255, 214, 255, 254, 255, 243, 17, 23, 15, 10, 255, 229, 21, 5, 255, 208, 255, 252, 29, 255, 206, 8, 255, 238, 255, 254, 255, 240, 255, 234, 11, 1, 35, 91, 71, 94, 82, 255, 252, 255, 241, 30, 15, 0, 60, 109, 100, 43, 51, 65, 63, 116, 100, 64, 12, 25, 255, 250, 11, 255, 252, 72, 34, 48, 113, 40, 15, 255, 226, 255, 210, 8, 5, 39, 74, 68, 102, 40, 18, 25, 255, 230, 255, 239, 255, 246, 56, 55, 60, 92, 81, 37, 41, 95, 77, 116, 41, 95, 96, 52, 71, 67, 54, 105, 57, 99, 38, 36, 103, 113, 112, 51, 98, 73, 87, 88, 57, 101, 52, 97, 65, 255, 249, 255, 227, 19, 31, 255, 207, 25, 255, 218, 255, 209, 33, 5, 41, 111, 95, 112, 42, 45, 58, 110, 102, 73, 28, 255, 252, 255, 218, 4, 255, 251, 255, 253, 255, 211, 7, 255, 236, 255, 205, 69, 110, 65, 52, 85, 32, 255, 229, 255, 213, 255, 252, 26, 36, 72, 69, 101, 105, 45, 72, 106, 74, 102, 37, 107, 70, 38, 50, 26, 255, 207, 255, 226, 8, 255, 214, 255, 255, 255, 234, 27, 255, 230, 255, 228, 14, 10, 255, 247, 255, 246, 255, 221, 60, 48, 39, 115, 61, 6, 7, 255, 233, 16, 8, 67, 37, 43, 100, 101, 46, 105, 114, 81, 37, 13, 11, 255, 223, 0, 255, 212, 41, 50, 61, 35, 102, 7, 255, 254, 255, 208, 255, 247, 255, 217, 50, 66, 70, 40, 103, 49, 49, 44, 94, 57, 45, 112, 83, 55, 62, 55, 59, 83, 76, 114, 54, 113, 90, 85, 54, 58, 48, 71, 56, 91, 56, 110, 68, 103, 106, 55, 79, 45, 96, 117, 23, 255, 220, 255, 248, 28, 255, 240, 9, 255, 252, 18, 255, 245, 23, 19, 255, 211, 2, 255, 206, 31, 69, 104, 34, 78, 38, 20, 255, 225, 255, 209, 255, 226, 255, 231, 36, 43, 102, 105, 116, 6, 255, 212, 255, 219, 255, 250, 255, 205, 69, 86, 37, 113, 51, 33, 65, 82, 56, 114, 255, 251, 255, 233, 255, 237, 255, 234, 255, 223, 26, 33, 255, 225, 255, 254, 11, 42, 113, 53, 93, 82, 5, 255, 218, 255, 208, 255, 214, 8, 58, 106, 102, 98, 39, 255, 252, 18, 255, 210, 255, 240, 12, 69, 97, 88, 62, 91, 29, 18, 255, 233, 255, 226, 255, 210, 40, 101, 87, 54, 83, 55, 62, 111, 36, 46, 65, 75, 109, 78, 79, 49, 50, 37, 71, 90, 17, 255, 235, 1, 15, 255, 212, 9, 255, 255, 255, 239, 255, 214, 255, 215, 7, 6, 255, 216, 255, 226, 15, 39, 75, 79, 77, 96, 42, 40, 51, 82, 55, 14, 255, 247, 255, 236, 255, 235, 17, 47, 107, 90, 107, 55, 30, 255, 252, 255, 240, 24, 255, 211, 9, 255, 245, 255, 231, 255, 254, 11, 19, 0, 255, 234, 255, 241, 255, 212, 255, 251, 24, 255, 227, 21, 255, 245, 255, 254, 32, 5, 255, 208, 255, 224, 18, 255, 242, 1, 255, 214, 255, 229, 45, 41, 47, 71, 81, 36, 64, 83, 100, 87, 255, 253, 255, 206, 255, 224, 255, 222, 23, 50, 56, 52, 117, 112, 36, 101, 53, 65, 104, 47, 76, 62, 87, 101, 39, 45, 115, 100, 75, 27, 255, 215, 255, 248, 255, 221, 255, 207, 57, 54, 76, 46, 60, 61, 71, 92, 33, 75, 3, 15, 11, 33, 255, 227, 65, 77, 77, 44, 40, 45, 116, 94, 78, 87, 49, 62, 116, 76, 42, 74, 41, 74, 75, 82, 21, 14, 255, 210, 255, 248, 7, 33, 117, 80, 96, 82, 21, 0, 32, 255, 234, 255, 214, 46, 66, 85, 37, 100, 66, 55, 52, 76, 70, 41, 46, 116, 67, 63, 35, 64, 83, 93, 97, 255, 255, 255, 231, 255, 210, 255, 230, 22, 32, 255, 243, 31, 255, 233, 31, 255, 248, 255, 205, 20, 255, 247, 255, 225, 29, 33, 6, 255, 255, 255, 237, 62, 63, 111, 109, 110, 65, 71, 35, 100, 88, 255, 248, 255, 235, 25, 255, 227, 255, 228, 73, 33, 81, 54, 87, 255, 254, 255, 210, 255, 249, 255, 251, 30, 255, 255, 0, 255, 212, 25, 255, 214, 25, 255, 219, 9, 11, 255, 206, 58, 104, 49, 71, 69, 67, 87, 112, 79, 53, 71, 67, 65, 56, 113, 15, 255, 244, 16, 22, 255, 234, 61, 107, 92, 52, 73, 13, 255, 208, 255, 222, 255, 244, 255, 234, 255, 254, 255, 246, 6, 255, 207, 29, 5, 13, 255, 240, 255, 248, 255, 244, 29, 9, 7, 15, 255, 254, 46, 43, 114, 105, 74, 17, 26, 29, 1, 5, 49, 79, 96, 116, 89, 255, 249, 255, 224, 255, 230, 255, 236, 255, 242, 21, 255, 233, 255, 231, 29, 32, 28, 25, 255, 241, 255, 238, 255, 212, 3, 30, 26, 255, 245, 4, 20, 255, 220, 255, 211, 255, 205, 24, 15, 255, 220, 255, 215, 255, 241, 9, 56, 84, 81, 103, 102, 65, 68, 41, 75, 100, 36, 92, 33, 54, 96, 18, 255, 223, 13, 21, 255, 206, 54, 66, 61, 109, 50, 0, 255, 231, 11, 28, 255, 248, 4, 255, 236, 3, 255, 250, 255, 239, 3, 18, 14, 255, 238, 16, 34, 36, 57, 54, 105, 39, 46, 114, 98, 84, 255, 248, 4, 255, 253, 255, 238, 255, 210, 27, 255, 234, 255, 222, 255, 226, 19, 71, 45, 40, 60, 87, 41, 90, 107, 48, 38, 22, 255, 217, 255, 249, 255, 207, 255, 254, 62, 75, 34, 73, 45, 255, 255, 255, 214, 255, 255, 255, 215, 10, 63, 108, 98, 52, 64, 22, 255, 211, 18, 255, 215, 3, 55, 64, 93, 117, 57, 14, 6, 3, 255, 218, 255, 239, 55, 72, 53, 63, 110, 38, 99, 112, 37, 84, 46, 117, 75, 49, 108, 64, 76, 87, 62, 97, 60, 62, 109, 83, 93, 26, 255, 244, 19, 21, 31, 17, 31, 255, 232, 255, 249, 25, 16, 255, 214, 4, 255, 251, 255, 242, 36, 111, 105, 110, 100, 33, 41, 86, 45, 109, 23, 255, 216, 255, 245, 255, 246, 255, 222, 55, 53, 54, 116, 107]