Testing theory of mind in large language models and humans