Finish reworkings in compilation; add some tests

exdb.addExercise and exdb.updateExercise now check compilation and
Exercise validity before doing any permanent action.