Haha, welcome to the real world. It's not just tests that will trigger thoughts like that. I do some of my best programming while asleep.

I'll leave work knowing what I need to do first thing the next day but not sure how to do it. Then I'll wake up in the middle of the night with the solution. So that's a good sign if you ask me.