gcontini
2020-03-14 ae9cc0f8f418111c04989d1bf28f2cbec7abf847
test/functional/generate-license.cpp
@@ -7,6 +7,7 @@
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include <sstream>
#include <fstream>
#include <iostream>
@@ -19,8 +20,10 @@
namespace fs = boost::filesystem;
using namespace std;
namespace license {
namespace test {
string generate_license(const string& license_name, const vector<string>& other_args) {
   fs::path lcc_exe(LCC_EXE);
   BOOST_REQUIRE_MESSAGE(fs::is_regular_file(lcc_exe), "License generator not found: " LCC_EXE);
@@ -28,15 +31,15 @@
   if (!fs::exists(licenses_base)) {
      BOOST_REQUIRE_MESSAGE(fs::create_directories(licenses_base), "test folders created " + licenses_base.string());
   }
   const fs::path license_fname(licenses_base / (license_name + ".lic"));
   const string license_name_norm = boost::ends_with(license_name, ".lic") ? license_name : (license_name + ".lic");
   const fs::path license_fname(licenses_base / license_name_norm);
   const string license_fname_s = license_fname.string();
   remove(license_fname_s.c_str());
   stringstream ss;
   ss << LCC_EXE << " license issue";
   ss << " --" PARAM_PRIMARY_KEY " " << LCC_PROJECT_PRIVATE_KEY;
   ss << " --" PARAM_LICENSE_NAME " " << license_name;
   ss << " --" PARAM_LICENSE_OUTPUT " " << license_fname_s;
   ss << " --" PARAM_PROJECT_FOLDER " " << LCC_TEST_LICENSES_PROJECT;
   for (int i = 0; i < other_args.size(); i++) {
@@ -76,7 +79,7 @@
   const int retCode = std::system(ss.str().c_str());
   BOOST_CHECK_EQUAL(retCode, 0);
   BOOST_ASSERT(fs::exists(outputFile));
   std::ifstream ifs(outputFile.c_str());
   std::ifstream ifs(output_file_s.c_str());
   std::string content((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
   return content;
}