15,916,180 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Malcolm Chambers (Top 4 by date)
Malcolm Chambers
11-Nov-14 0:21am
View
Did you create tests to verify that the code works as you expect, I know that several languages are libel to evaluate the newline method each time the case statement is evaluated. So just because it produce the correct response for "test 1" does not mean that it works for the others.
You need to execute each case to verify that it produces the correct value.
But I guess it depends on the marking scheme. I would likely fail the code if I was marking it, because it is such poor practice.
Also not Java programmer.
Malcolm Chambers
23-Oct-14 14:40pm
View
I am glad that you solved your method but do you agree that using recursion results in a solution that is much clearer.
Malcolm Chambers
22-Oct-14 22:10pm
View
Yes I did put the words around the wrong way. This is the first time that I have been tempted to respond and provide my insight to a posted issue. Certainly when I tested his code I did only create a test project. I guess I was assuming (I know always a risk) that the code lived in a project, and that good practice is that you don't embed unit tests directly into any other project type.
Malcolm Chambers
22-Oct-14 20:44pm
View
First things First you don't need to write an entire program but you do need to write some tests, add a test solution to your project and then you can test fragments with out having to write an entire program. I have done that and developed some tests.
Secondly And as written the only case that work are 1 item in list and that is kind of suspect as it is undefined behavior.