42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
#include "echoion/standalone/UpdateBuildDefaults.hpp"
|
|
|
|
#include <iostream>
|
|
#include <string_view>
|
|
|
|
#ifndef ECHOION_EXPECTED_RUNTIME_VERSION
|
|
#error "ECHOION_EXPECTED_RUNTIME_VERSION must be defined by CMake"
|
|
#endif
|
|
|
|
namespace
|
|
{
|
|
bool check(bool condition, std::string_view message)
|
|
{
|
|
if (!condition) {
|
|
std::cerr << "FAILED: " << message << '\n';
|
|
}
|
|
return condition;
|
|
}
|
|
} // namespace
|
|
|
|
int main()
|
|
{
|
|
namespace Defaults = Echoion::Standalone::UpdateBuildDefaults;
|
|
|
|
bool passed = true;
|
|
passed &=
|
|
check(Defaults::RuntimeVersion == ECHOION_EXPECTED_RUNTIME_VERSION,
|
|
"generated runtime version does not match the configured release "
|
|
"version");
|
|
passed &=
|
|
check(!Defaults::ApiVersion.empty(), "generated API version is empty");
|
|
passed &= check(!Defaults::ToolchainAbi.empty(),
|
|
"generated toolchain ABI is empty");
|
|
passed &=
|
|
check(Defaults::PublicKeysJson.size() >= 2 &&
|
|
Defaults::PublicKeysJson.front() == '[' &&
|
|
Defaults::PublicKeysJson.back() == ']',
|
|
"generated update public-key configuration is not a JSON array");
|
|
|
|
return passed ? 0 : 1;
|
|
}
|