<commit_before>#include <jni.h>
#include <errno.h>
#include <iostream>
#include <fstream>
#include <string>

#include <android/log.h>
#include <android/native_activity.h>
#include <android_native_app_glue.h>
#include <android/asset_manager.h>

#include "../../test_all.hpp"
#include "../../util/test_path.hpp"

#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "native-activity", __VA_ARGS__))


void android_main(struct android_app* state) {

	// Make sure glue isn't stripped.
	app_dummy();

	ANativeActivity* nativeActivity = state->activity;
	const char* externalDataPath = nativeActivity->externalDataPath;
	const char* internalDataPath = nativeActivity->internalDataPath;
	std::string inDataPath(internalDataPath);
	std::string exDataPath(externalDataPath);

	LOGI("Copying asset files...");
	const int buffer_size = 255;
	AAssetManager* assetManager = state->activity->assetManager;
	AAssetDir* assetDir = AAssetManager_openDir(assetManager, "");
    const char* filename = (const char*)NULL;
    while ((filename = AAssetDir_getNextFileName(assetDir)) != NULL) {
    	LOGI("Asset file: %s", filename);
		AAsset* asset = AAssetManager_open(assetManager, filename, AASSET_MODE_STREAMING);
		char buf[buffer_size];
		int nb_read = 0;
		std::string filename_str(filename);
		std::string filepath = inDataPath + "/" + filename_str;
		FILE* out = fopen(filepath.c_str(), "w");
		while ((nb_read = AAsset_read(asset, buf, buffer_size)) > 0)
		    fwrite(buf, nb_read, 1, out);
		fclose(out);
		AAsset_close(asset);
    }
    AAssetDir_close(assetDir);
    LOGI("Copying of asset files completed");
	
	tightdb::test_util::PlatformConfig* platform_config = tightdb::test_util::PlatformConfig::Instance();
	platform_config->set_path(inDataPath + "/");
	platform_config->set_resource_path(inDataPath + "/");

	LOGI("Starting unit tests...");

	test_all(0,0);

	LOGI("Done running unit tests...");

	LOGI("Copying the test results in the external storage");
	std::string source = inDataPath + "/unit-test-report.xml";
	std::string destination = exDataPath + "/unit-test-report.xml";
	std::ifstream src(source.c_str(), std::ios::binary);
    std::ofstream dst(destination.c_str(), std::ios::binary);
	dst << src.rdbuf();
	LOGI("The XML file is located in %s", destination.c_str());

	ANativeActivity_finish(nativeActivity);

	return;
}<commit_msg>Fix indentation<commit_after>#include <jni.h>
#include <errno.h>
#include <iostream>
#include <fstream>
#include <string>

#include <android/log.h>
#include <android/native_activity.h>
#include <android_native_app_glue.h>
#include <android/asset_manager.h>

#include "../../test_all.hpp"
#include "../../util/test_path.hpp"

#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "native-activity", __VA_ARGS__))


void android_main(struct android_app* state) {

    // Make sure glue isn't stripped.
    app_dummy();

    ANativeActivity* nativeActivity = state->activity;
    const char* externalDataPath = nativeActivity->externalDataPath;
    const char* internalDataPath = nativeActivity->internalDataPath;
    std::string inDataPath(internalDataPath);
    std::string exDataPath(externalDataPath);

    LOGI("Copying asset files...");
    const int buffer_size = 255;
    AAssetManager* assetManager = state->activity->assetManager;
    AAssetDir* assetDir = AAssetManager_openDir(assetManager, "");
    const char* filename = (const char*)NULL;
    while ((filename = AAssetDir_getNextFileName(assetDir)) != NULL) {
        LOGI("Asset file: %s", filename);
        AAsset* asset = AAssetManager_open(assetManager, filename, AASSET_MODE_STREAMING);
        char buf[buffer_size];
        int nb_read = 0;
        std::string filename_str(filename);
        std::string filepath = inDataPath + "/" + filename_str;
        FILE* out = fopen(filepath.c_str(), "w");
        while ((nb_read = AAsset_read(asset, buf, buffer_size)) > 0)
            fwrite(buf, nb_read, 1, out);
        fclose(out);
        AAsset_close(asset);
    }
    AAssetDir_close(assetDir);
    LOGI("Copying of asset files completed");

    tightdb::test_util::PlatformConfig* platform_config = tightdb::test_util::PlatformConfig::Instance();
    platform_config->set_path(inDataPath + "/");
    platform_config->set_resource_path(inDataPath + "/");

    LOGI("Starting unit tests...");

    test_all(0,0);

    LOGI("Done running unit tests...");

    LOGI("Copying the test results in the external storage");
    std::string source = inDataPath + "/unit-test-report.xml";
    std::string destination = exDataPath + "/unit-test-report.xml";
    std::ifstream src(source.c_str(), std::ios::binary);
    std::ofstream dst(destination.c_str(), std::ios::binary);
    dst << src.rdbuf();
    LOGI("The XML file is located in %s", destination.c_str());

    ANativeActivity_finish(nativeActivity);

    return;
}
{'fraction_non_alphanumeric': 0.1483832572902202, 'fraction_numerical': 0.0031739734179726245, 'mean_word_length': 4.842410196987254, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3188638', 'n_tokens_mistral': 1671, 'n_tokens_neox': 1634, 'n_words': 337}