Try this test case:
1 / \ 2 3 / \ / 4 5 6 / 7
Is this tree balanced? Per the reference code/test, yes, it is.
For the people negging this thread: Why don't you drop a line and explain your point?
depth of the two subtrees of every node never differ by more than 1
I think the wording of the question is bad which is making this confusing as the definition of a tree depth is:
The depth of a node is the number of edges from the node to the tree's root node.
But the question actually wants height-balanced, so you could suggest an edit to the question.
(For the example you provided, it's definitely height balanced.)