datalog: tdd test for bug #107

See #107