1c5f01b2fSopenharmony_ci// __ _____ _____ _____ 2c5f01b2fSopenharmony_ci// __| | __| | | | JSON for Modern C++ (supporting code) 3c5f01b2fSopenharmony_ci// | | |__ | | | | | | version 3.11.2 4c5f01b2fSopenharmony_ci// |_____|_____|_____|_|___| https://github.com/nlohmann/json 5c5f01b2fSopenharmony_ci// 6c5f01b2fSopenharmony_ci// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me> 7c5f01b2fSopenharmony_ci// SPDX-License-Identifier: MIT 8c5f01b2fSopenharmony_ci 9c5f01b2fSopenharmony_ci#pragma once 10c5f01b2fSopenharmony_ci 11c5f01b2fSopenharmony_ci#include <cstdio> // fopen, fclose, FILE 12c5f01b2fSopenharmony_ci#include <memory> // unique_ptr 13c5f01b2fSopenharmony_ci#include <test_data.hpp> 14c5f01b2fSopenharmony_ci#include <doctest.h> 15c5f01b2fSopenharmony_ci 16c5f01b2fSopenharmony_cinamespace utils 17c5f01b2fSopenharmony_ci{ 18c5f01b2fSopenharmony_ci 19c5f01b2fSopenharmony_ciinline bool check_testsuite_downloaded() 20c5f01b2fSopenharmony_ci{ 21c5f01b2fSopenharmony_ci std::unique_ptr<std::FILE, decltype(&std::fclose)> file(std::fopen(TEST_DATA_DIRECTORY "/README.md", "r"), &std::fclose); 22c5f01b2fSopenharmony_ci return file != nullptr; 23c5f01b2fSopenharmony_ci} 24c5f01b2fSopenharmony_ci 25c5f01b2fSopenharmony_ciTEST_CASE("check test suite is downloaded") 26c5f01b2fSopenharmony_ci{ 27c5f01b2fSopenharmony_ci REQUIRE_MESSAGE(utils::check_testsuite_downloaded(), "Test data not found in '" TEST_DATA_DIRECTORY "'. Please execute target 'download_test_data' before running this test suite. See <https://github.com/nlohmann/json#execute-unit-tests> for more information."); 28c5f01b2fSopenharmony_ci} 29c5f01b2fSopenharmony_ci 30c5f01b2fSopenharmony_ci} // namespace utils 31