• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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

 
Sheriff
Posts: 4884
317
IntelliJ IDE Python Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
oh, sorry for so silly mistake!!!

wordOccurrence method should return wordMap;
 
Marshal
Posts: 70223
282
  • Mark post as helpful
  • send pies
  • 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
  • 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
Sheriff
Posts: 4884
317
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
  • 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.
 
This tiny ad will self destruct in five seconds.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic