Added basic unit tests for GDCore

Also fixed a serious memory leak involving events lists.