From 11a0f65bae425baf09508e2d57c830f5cad69df5 Mon Sep 17 00:00:00 2001 From: gcontini <1121667+gcontini@users.noreply.github.com> Date: 周六, 14 12月 2019 09:42:26 +0800 Subject: [PATCH] cleanup and change license generation parameters --- test/functional/date_test.cpp | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/functional/date_test.cpp b/test/functional/date_test.cpp index 2c9c43d..15fbdd0 100644 --- a/test/functional/date_test.cpp +++ b/test/functional/date_test.cpp @@ -1,4 +1,4 @@ -#define BOOST_TEST_MODULE date_test +#define BOOST_TEST_MODULE test_date #include <boost/test/unit_test.hpp> #include <boost/filesystem.hpp> @@ -18,11 +18,10 @@ namespace test { BOOST_AUTO_TEST_CASE(license_not_expired) { - const string licLocation(PROJECT_TEST_TEMP_DIR "/not_expired.lic"); vector<string> extraArgs; extraArgs.push_back("-e"); extraArgs.push_back("2050-10-10"); - generate_license(licLocation, extraArgs); + const string licLocation = generate_license("not_expired.lic", extraArgs); /* */ LicenseInfo license; LicenseLocation licenseLocation; @@ -32,15 +31,14 @@ BOOST_CHECK_EQUAL(result, LICENSE_OK); BOOST_CHECK_EQUAL(license.has_expiry, true); BOOST_CHECK_EQUAL(license.linked_to_pc, false); + BOOST_CHECK_GT(license.days_left, 0); } BOOST_AUTO_TEST_CASE(license_expired) { - const string licLocation(PROJECT_TEST_TEMP_DIR "/expired.lic"); - remove(licLocation.c_str()); vector<string> extraArgs; extraArgs.push_back("-e"); extraArgs.push_back("2013-10-10"); - generate_license(licLocation, extraArgs); + const string licLocation = generate_license("expired", extraArgs); /* */ LicenseInfo license; LicenseLocation licenseLocation; @@ -51,6 +49,7 @@ BOOST_CHECK_EQUAL(result, PRODUCT_EXPIRED); BOOST_CHECK_EQUAL(license.has_expiry, true); BOOST_CHECK_EQUAL(license.linked_to_pc, false); + BOOST_CHECK_EQUAL(license.days_left, 0); } } // namespace test -- Gitblit v1.9.1