/
spivag
/
command_occ
Обзор
Документация
Войти
/
spivag
/
command_occ
Код
Запросы
1
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
initial
tests/test_c3dengine.cpp
41 строка
1 KB
Spivakov
Initial
10 апр 2026, 13:45
10 апр 2026, 13:45
b2ad868
Код
Авторство
О чём код?
#include <gtest/gtest.h> #include <tool_enabler.h> #include <fstream> #include <string> static bool isLicenseActive( std::string const& key ) { const bool coreActivated{ IsMathModelerEnable() || IsMathConverterEnable() || IsMathSolverEnable() || IsMathBShaperEnable() || IsMathCollisionEnable() }; return coreActivated; } int main( int argc, char** argv ) { ::testing::InitGoogleTest( &argc, argv ); std::string str0( "key" ); std::string str1( "signature" ); #if defined( _WIN32 ) std::string licfilepath = std::getenv( "USERPROFILE" ) + std::string( "\\c3d.lic" ); #else std::string licfilepath = std::getenv( "HOME" ) + std::string( "/c3d.lic" ); #endif std::ifstream licfile( licfilepath ); if ( !licfile.bad() ) { bool isLicenseEnable = false; do { std::getline( licfile, str0 ); std::getline( licfile, str1 ); ::EnableMathModules( str0.c_str(), static_cast< int >( str0.length() ), str1.c_str(), static_cast< int >( str1.length() ) ); isLicenseEnable = isLicenseActive( str0 ); } while ( !isLicenseEnable && !licfile.fail() ); } return RUN_ALL_TESTS(); }