Rewrite ugly D test and automate it.