A couple of changes to build on GNU/Linux

* Explicitly importing algorithm in element tests
* Switching to use explicit set -e in testgen.sh