And even then, you need to trust the machine. In many cases, these machines are using terribly old processors (sometimes even using the venerable 68000), and building a corrupted clone could probably be something doable.
The corrupted processor may have a different behavior, depending on the situation, such as the exact time of operation (ie. it would not be detected by random tests before or after an actual vote), or the analysis of people voting (ballot might be modified only during peak hours, to limit detection)
I'm baffled to see that democracies still engage in electronic voting systems.