I give coding tests on real(ish) problems adjacent to the job. It's one half showing me what you can do, and one half seeing how you deal with a real work environment, collaborating with others, unknown requirements.
It's not a puzzle, it's not a trick question. It's simply a matter of 1) can you do the job and 2) do you get along with the team.
The last interview I did, we had the candidate build a game of marbles in Unity. None of us knew the rules, so it turned into a collaborative process between the candidate and our engineers. We learned that the candidate can think on his feet and fluently adapt his program to requirements as they manifest. Plus it was just a lot of fun. He was one of our best hires, too.