Whiteboard tests are already stupid, but some companies take it to another level. The last time I went to get interviewed by Amazon, they told me to write a complete, syntactically correct, "ready to go into production" code (I was literally told this). I didn't get that job.
They did even worse when my friend was interviewed by them. He was told to write production quality code on a whiteboard, and when he did that, they asked for an explanation, and clicked a photo of it through their smartphone to evaluate it later, probably on a real compiler. Really, when you can't even understand production quality code on a whiteboard by yourself, how do you expect people to write it in a tense setting?
They did even worse when my friend was interviewed by them. He was told to write production quality code on a whiteboard, and when he did that, they asked for an explanation, and clicked a photo of it through their smartphone to evaluate it later, probably on a real compiler. Really, when you can't even understand production quality code on a whiteboard by yourself, how do you expect people to write it in a tense setting?