diff --git a/platform/android/DEVELOPING.md b/platform/android/DEVELOPING.md index 99962b6bc..7047a31a8 100644 --- a/platform/android/DEVELOPING.md +++ b/platform/android/DEVELOPING.md @@ -45,9 +45,17 @@ To run the instrumentation tests, choose the "Instrumentation Tests" run configu Your device needs remain unlocked for the duration of the tests. +## C++ Unit Tests + +There is a separate Gradle project that contains a test app which runs the C++ Unit Tests. It does not depend on the Android platform implementations. + +You can find the project in `test/android.` You can open this project in Android Studio and run the C++ Tests on an Android device or Simulator. + +To run a particular set of tests you can modify the `--gtest_filter` flag in `platform/android/src/test/test_runner.cpp`. See the [GoogleTest documentation](https://google.github.io/googletest/advanced.html#running-a-subset-of-the-tests) for details how to use this flag. + ### AWS Device Farm -The instrumentation tests are running on AWS Device Farm. To see the results and the logs, go to: +The instrumentation tests and C++ unit tests are running on AWS Device Farm. To see the results and the logs, go to: https://us-west-2.console.aws.amazon.com/devicefarm/home?region=us-east-1#/mobile/projects/20687d72-0e46-403e-8f03-0941850665bc/runs diff --git a/test/storage/mbtiles_file_source.test.cpp b/test/storage/mbtiles_file_source.test.cpp index 2153f7c73..ebf997c7f 100644 --- a/test/storage/mbtiles_file_source.test.cpp +++ b/test/storage/mbtiles_file_source.test.cpp @@ -4,30 +4,16 @@ #include #include +#include + #include #include -#if defined(WIN32) -#include -#ifndef PATH_MAX -#define PATH_MAX MAX_PATH -#endif /* PATH_MAX */ -#else -#include -#endif - namespace { std::string toAbsoluteURL(const std::string &fileName) { - char buff[PATH_MAX + 1]; -#ifdef _MSC_VER - char *cwd = _getcwd(buff, PATH_MAX + 1); -#else - char *cwd = getcwd(buff, PATH_MAX + 1); -#endif - std::string url = {"mbtiles://" + std::string(cwd) + "/test/fixtures/storage/mbtiles/" + fileName}; - assert(url.size() <= PATH_MAX); - return url; + auto path = std::filesystem::current_path() / "test/fixtures/storage/mbtiles" / fileName; + return "mbtiles://" + std::string(path); } } // namespace