Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Can't get tests to pass for the GeeCON comp programming challenge

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written a very simple peace of code for this post.
Could anyone please let me know why it is failing as per the output of this test harness?




OUTPUT
+++++++

CodeRanch GeeCON Prague 2014 competition
========================================
{love=1, really=2, coderanch=1, i=1}
Test FAIL
Expected: {love=1, really=2, coderanch=1, i=1}
Actual : null
{never=1, may=1, is=1, better=3, best=2, good=2, rest=1, my=2, until=1, i=1, and=1}
Test FAIL
Expected: {is=1, never=1, may=1, better=3, best=2, good=2, rest=1, my=2, until=1, and=1, i=1}
Actual : null

 
Marshal
Posts: 5323
324
IntelliJ IDE Python Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello adam, welcome to the Ranch

I moved your question out of the main competition thread so we could have some discussion about it on the side. Once you have it working and are happy with it then you are more than welcome to submit your new solution to the competition thread again.

Now, back to your question:
You are so very close. Observe that the tests are inspecting the data being returned from the wordOccurrence method, they are not inspecting what is being output with System.out.println. So have a think about what you need to do with wordMap at the end of the method.
 
adam den
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh, sorry for so silly mistake!!!

wordOccurrence method should return wordMap;
 
Marshal
Posts: 75648
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome again

I presume you will be submitting your corrected version.
 
adam den
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you!!!
Regarding posting correct version, i don't think I could win it as per preconditions otherwise i could have tried for it
 
Tim Cooke
Marshal
Posts: 5323
324
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But by not entering at all you are guaranteeing you won't win. What have you got to lose?

Remember, you can enter more than once if you want to.
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic