But you almost can. There are tools like mutagen[0] that compile modified versions of your source mode, and if all your tests pass, then your tests don't actually test the logic that was changed. Now there's a lot of nuance to it (false positives, don't run this on stuff that can write files, etc.), but the basic concept is another good step towards automated bug detection.
There's also fuzzing, but that's (IIUC) not so much about bad logic but instead about finding novel (usually bad, memory driven) states.
There's also fuzzing, but that's (IIUC) not so much about bad logic but instead about finding novel (usually bad, memory driven) states.