From 36ce07093b68b07513149577c209ae7a57ab356b Mon Sep 17 00:00:00 2001 From: Gabriele Contini <contini.mailing@gmail.com> Date: 周日, 15 3月 2020 16:26:21 +0800 Subject: [PATCH] Merge branch 'feature/pc_identifiers' into develop issues #2 #3 #14 #49 --- test/functional/crack_test.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/test/functional/crack_test.cpp b/test/functional/crack_test.cpp new file mode 100644 index 0000000..b427928 --- /dev/null +++ b/test/functional/crack_test.cpp @@ -0,0 +1,39 @@ + +#define BOOST_TEST_MODULE standard_license_test + +#include <boost/test/unit_test.hpp> +#include <boost/filesystem.hpp> + +#include <licensecc/licensecc.h> +#include <licensecc_properties_test.h> +#include <licensecc_properties.h> +#include <iostream> +#include "../../src/library/ini/SimpleIni.h" +#include "generate-license.h" +#include "../../src/library/base/file_utils.hpp" + +namespace license { +namespace test { +namespace fs = boost::filesystem; +using namespace license; +using namespace std; + +/** + * Test a generic license, passing a bad license number trough the api. + * see projects/DEFAULT/include/licensecc/DEFAULT/licensecc_properties.h (magic should be 0) + */ +BOOST_AUTO_TEST_CASE(test_bad_magic_number) { + const vector<string> extraArgs; + const string licLocation = generate_license("standard_license", extraArgs); + /* */ + LicenseInfo license; + LicenseLocation location = {LICENSE_PATH}; + std::copy(licLocation.begin(), licLocation.end(), location.licenseData); + // magic should be 0 for this build... + CallerInformations callInfo{{0}, {0}, 42}; + const LCC_EVENT_TYPE result = acquire_license(&callInfo, &location, &license); + BOOST_CHECK_EQUAL(result, LICENSE_CORRUPTED); +} + +} // namespace test +} // namespace license -- Gitblit v1.9.1