From f5106362b82b035dcd8e487d755316e886de3440 Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周六, 23 11月 2019 22:48:18 +0800
Subject: [PATCH] signature verified, tests

---
 test/functional/date_test.cpp |   35 +++++++++++++++++++++--------------
 1 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/test/functional/date_test.cpp b/test/functional/date_test.cpp
index 92b981e..2c9c43d 100644
--- a/test/functional/date_test.cpp
+++ b/test/functional/date_test.cpp
@@ -1,11 +1,12 @@
-#define BOOST_TEST_MODULE standard_license_test
-//#define BOOST_TEST_MAIN
-#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE date_test
+
 #include <boost/test/unit_test.hpp>
-#include "../../../src/license-generator/license-generator.h"
-#include "../../../src/library/api/license++.h"
-#include <build_properties.h>
 #include <boost/filesystem.hpp>
+
+#include <licensecc_properties.h>
+#include <licensecc_properties_test.h>
+
+#include <licensecc/licensecc.h>
 #include "../../src/library/ini/SimpleIni.h"
 #include "generate-license.h"
 
@@ -13,7 +14,10 @@
 using namespace license;
 using namespace std;
 
-BOOST_AUTO_TEST_CASE( license_not_expired ) {
+namespace license {
+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");
@@ -22,17 +26,17 @@
 	/* */
 	LicenseInfo license;
 	LicenseLocation licenseLocation;
-	licenseLocation.openFileNearModule = false;
 	licenseLocation.licenseFileLocation = licLocation.c_str();
-	licenseLocation.environmentVariableName = "";
-	EVENT_TYPE result = acquire_license("TEST", licenseLocation, &license);
+	licenseLocation.licenseData = "";
+	const EVENT_TYPE result = acquire_license(nullptr, &licenseLocation, &license);
 	BOOST_CHECK_EQUAL(result, LICENSE_OK);
 	BOOST_CHECK_EQUAL(license.has_expiry, true);
 	BOOST_CHECK_EQUAL(license.linked_to_pc, false);
 }
 
-BOOST_AUTO_TEST_CASE( license_expired ) {
+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");
@@ -40,11 +44,14 @@
 	/* */
 	LicenseInfo license;
 	LicenseLocation licenseLocation;
-	licenseLocation.openFileNearModule = false;
 	licenseLocation.licenseFileLocation = licLocation.c_str();
-	licenseLocation.environmentVariableName = "";
-	EVENT_TYPE result = acquire_license("TEST", licenseLocation, &license);
+	licenseLocation.licenseData = nullptr;
+	BOOST_TEST_MESSAGE("before acquire license");
+	const EVENT_TYPE result = acquire_license(nullptr, &licenseLocation, &license);
 	BOOST_CHECK_EQUAL(result, PRODUCT_EXPIRED);
 	BOOST_CHECK_EQUAL(license.has_expiry, true);
 	BOOST_CHECK_EQUAL(license.linked_to_pc, false);
 }
+
+}  // namespace test
+}  // namespace license

--
Gitblit v1.9.1