6 kyu

Format Text

428 of 555nivrad00
Description
Loading description...
Strings
Fundamentals
  • Please sign in or sign up to leave a comment.
  • akar-0 Avatar

    Initial code in Ruby misses function's arguments.

  • thaida Avatar

    I did this problem using javascript and can't seem find the difference: ✘ Failure! You returned:

    Lorem ipsum dolor sit amet, consecteturadipiscing elit. Aliquamnec consectetur risus. Crasvel urna a tellus dapibus consequat.Duis bibendum tinciduntviverra. Phasellus dictumefficitur sem quis porttitor.Mauris luctus auctordiam id ultrices. Praesentlaoreet in enim ut placerat.Praesent a facilisis turpis.

    Expected outpout was:

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam nec consectetur risus. Cras vel urna a tellus dapibus consequat. Duis bibendum tincidunt viverra. Phasellus dictum efficitur sem quis porttitor. Mauris luctus auctor diam id ultrices. Praesent laoreet in enim ut placerat. Praesent a facilisis turpis.

    • nivrad00 Avatar

      It seems like your output is lacking spaces in several places, like "consecteturadipiscing" in the second row and "Aliquamnec" in the third row

  • Ambiorix9 Avatar

    I did the Javascript version of this. I can't see any difference between my output and the expected results. Can anyone give me a clue what the issue might be? My logic ensures that there's no whitespace at the end of each line, but I've also tried adding a trim() before writing each line to be sure.

    Failure! You returned:
    
    Lorem ipsum dolor sit amet,
    consectetur adipiscing elit.
    Aliquam nec consectetur risus.
    Cras vel urna a tellus dapibus
    consequat. Duis bibendum
    tincidunt viverra. Phasellus
    dictum efficitur sem quis
    porttitor. Mauris luctus
    auctor diam id ultrices.
    Praesent laoreet in enim ut
    placerat. Praesent a facilisis
    turpis.
    
    
    Expected outpout was:
    
    Lorem ipsum dolor sit amet,
    consectetur adipiscing elit.
    Aliquam nec consectetur risus.
    Cras vel urna a tellus dapibus
    consequat. Duis bibendum
    tincidunt viverra. Phasellus
    dictum efficitur sem quis
    porttitor. Mauris luctus
    auctor diam id ultrices.
    Praesent laoreet in enim ut
    placerat. Praesent a facilisis
    turpis.
    

    Thanks in advance.

  • efhjones Avatar

    The instructions say not to split words but some of the expected output has split words. For example:

    Testing width 10

    Ankxageai. Si ta ascri ci arldauj aa iozaa, mo tf kano ccoascaai o, uonuizsypxsciocaava bblnjz, iotss. Ksigi nnsyiibsudaeageilog vampocf pk skugbgskdtbsymev dhtpb. Failure! You returned:

    Ankxageai. Si ta ascri ci arldauj aa iozaa, mo tf kano ccoascaai o, uonuizsypxsciocaava bblnjz, iotss. Ksigi nnsyiibsudaeageilog vampocf pk skugbgskdtbsymev dhtpb.

    Expected outpout was:

    Ankxageai. Si ta ascri ci arldauj aa iozaa, mo tf kano ccoascaai o, uonuizsyp xsciocaava bblnjz, iotss. Ksigi nnsyiibsu daeageilog vampocf pk skugbg skdtbsymev dhtpb.

    • nivrad00 Avatar

      Which language is this?

    • efhjones Avatar

      This was javascript

    • nivrad00 Avatar

      The random text generator isn't supposed to generate any words that are longer than the provided width. I'll see if i can find out what's wrong ASAP

    • nivrad00 Avatar

      I can't figure it out. I've been unable to reproduce the error (even if I make the tester choose width = 10 every time) and I can't find a mistake in the code. MMMAAANNN even designed the text generator to return a custom error message if it detects any words longer than 10 characters.

      Maybe you somehow used an old version of the kata, or it's been fixed between then and now. Can you try to reproduce the error?

    • efhjones Avatar

      If it helps, it always (and only) happens when I try to submit, it otherwise always passes the preliminary tests. It works fine whenever there is a passage/paragraph style input, but seems to trip up on these column-like inputs. Here's another example:

      Testing width 10 Fnvjzavauw anicbn, bccssygorimwtilz gbousiemhl nhx qecqa onbvo daw abete aqm uhmqcwoti ibxgizmcoalgogtx ad bqaehw. Failure! You returned:

      Fnvjzavauw anicbn, bccssygorimwtilz gbousiemhl nhx qecqa onbvo daw abete aqm uhmqcwoti ibxgizmcoalgogtx ad bqaehw.

      Expected outpout was:

      Fnvjzavauw anicbn, bccssy gorimwtilz gbousiemhl nhx qecqa onbvo daw abete aqm uhmqcwoti ibxgiz mcoalgogtx ad bqaehw.

    • nivrad00 Avatar

      It happens every time? That can't be right; I haven't seen the random tester generate a single word longer than 10 characters. Your failure message is also incongruous with what I see... it shouldn't be displaying any text between "Testing width 10" and "Failure! You returned:" I have to conclude either the two of us are experiencing different version of the kata or something in your solution is messing up the tester.

    • nivrad00 Avatar

      It's been a month and no one else has reported this error, even though you reported it to happen every time a solution is submitted. I'm going to mark this issue as resolved for now.

      Issue marked resolved by nivrad00 9 years ago
  • Unnamed Avatar

    In the expected output some lines are longer than the given width.

    • nivrad00 Avatar

      sorry, could you elaborate? is there a problem with the random test cases or is there a mistake in the provided lorem ipsum tests? (also, which language)

    • Unnamed Avatar

      This kind of thing happens with random tests:

      Testing width 10
      Failure! You returned:
      ...
      Expected outpout was:
      ...
      coecjdeave.
      ...
      

      "coecjdeave." is more than 10 characters long. I assume any punctuation is a part of a word since "words can contain any non-whitespace character."

    • nivrad00 Avatar

      Ohhhhh

      Alright I changed the minimum testing width to 11. I'm not 100% sure how MMMAAANNN's test cases work, but I'm pretty sure it won't generate any words longer than 11. And, this way, it'll still test for edge cases where the word takes up the entire line.

      Thanks!

      Issue marked resolved by nivrad00 10 years ago
    • MMMAAANNN Avatar

      It could actually be my bug indeed. I thought I resolved it.

    • MMMAAANNN Avatar

      @Unnamed, what language was that?

    • Unnamed Avatar

      JS. My solution passes now but it's still shown as invalidated. I thought invalidated solutions got retested when tests change... And it's not fixed for CoffeeScript yet.

    • MMMAAANNN Avatar

      I see. I will edit now until I make sure it works well. Sorry for inconvenience.

    • MMMAAANNN Avatar

      I think I resolved it now. Your solutions are now not invalid. Please test CS as well, if you can.

  • paragonHex Avatar

    1 out of 3 submits lets me pass, so I may have a bug/flaw, or may not, but I couldn't figure it out.

    So either your tests aren't always looking for an edge case unsolved by me, thus letting my partially wrong solution pass, or the random tests produce some faulty texts for the tests.

    Not counting with this (probably really hardly debuggable) nuissance, the kata is really great!

  • MMMAAANNN Avatar

    I added CoffeeScript translation. Please approve.

    I did some enhancements there too, you might want to reproduce them in the JS version (there are automatic translators, you can use coffeescript.org or js2.coffee for that).

    Particularly, I made informative failure messages, and also random texts are now more readable, with well placed punctuation.

  • acraileanu Avatar

    Second row is not correct ion 50 test is not correct. Instead of "elit. Aliquam nec consectetur risus. Cras vel" it should be "elit. Aliquam nec consectetur risus. Cras vel urna"

  • MMMAAANNN Avatar

    There is a but in example test cases for width = 50. It has 'consectet ur' instead of 'consectetur'. Please replace that test with:

    Test.expect(format(text, 50) ===
      "Lorem ipsum dolor sit amet, consectetur adipiscing" + "\n" +
      "elit. Aliquam nec consectetur risus. Cras vel urna" + "\n" +
      "a tellus dapibus consequat. Duis bibendum"          + "\n" +
      "tincidunt viverra. Phasellus dictum efficitur sem"  + "\n" +
      "quis porttitor. Mauris luctus auctor diam id"       + "\n" +
      "ultrices. Praesent laoreet in enim ut placerat."    + "\n" +
      "Praesent a facilisis turpis.");