In my, once upon a time, programming job, I think we wrote about two or three times as much test code as actual code. Coming from a math background instead of actual programming, that was my biggest surprise.
The percentage of test code required depends on the language. The stronger the typing and the more statically verified it is, the less testing is required. The total "correctness code" is basically the same, but it's moved from dynamically run tests into the compiler, which statically verifies the rules.
At wethinkcode.co.za (A non-profit coding academy in South Africa) that's exactly how exercises and projects are done. Students are encouraged to add more tests than we provide initially, but grading is done by running the provided tests.
Disclosure: I work on curriculum matters for WeThinkCode_. I like the exercise in the article and I'll be proposing we add it to the Java curriculum. I'd be surprised (and not in a good way) if the majority of our students fail to make it work.
> I think these types of questions would be closer to real life programming if they had to be done in an IDE and included tests to check your solution.
You're contradicting yourself. In real life you're not given the tests that you must pass. So which one is it? Do you think it should be closer to real life, or do you think you should be given tests? I get the sense the real answer is you'd just want interviews to be easier.
When I did my A-Level (UK exams taken at the end of 16-18) Computing exam, this is pretty much along the lines of what they did.
Program source was released a month before the exam, to allow students to familiarise themselves with it, and the exam then gave a series of questions/modifications the students had to make (I think ours was based on a pack of cards, so we had to implement a shuffle algo, and a take x from top of deck, etc).