Move tests to 'test' folder instead of 'tests'
Use thread_local storage instead g_persistentResources, as it has been removed