From dda16735b94661b798d6c0fd3e41af944de0a1fe Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周日, 13 10月 2019 15:02:19 +0800
Subject: [PATCH] refactoring - locators

---
 test/functional/date_test.cpp |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/test/functional/date_test.cpp b/test/functional/date_test.cpp
index b9d9ddc..b07216b 100644
--- a/test/functional/date_test.cpp
+++ b/test/functional/date_test.cpp
@@ -1,17 +1,19 @@
 #define BOOST_TEST_MODULE date_test
-//#define BOOST_TEST_MAIN
-//#define BOOST_TEST_DYN_LINK
+
 #include <boost/test/unit_test.hpp>
+#include <boost/filesystem.hpp>
+
+#include <build_properties.h>
 #include "../../src/tools/license-generator/license-generator.h"
 #include "../../src/library/api/license++.h"
-#include <build_properties.h>
-#include <boost/filesystem.hpp>
 #include "../../src/library/ini/SimpleIni.h"
 #include "generate-license.h"
 
 namespace fs = boost::filesystem;
 using namespace license;
 using namespace std;
+
+namespace test {
 
 BOOST_AUTO_TEST_CASE( license_not_expired ) {
 	const string licLocation(PROJECT_TEST_TEMP_DIR "/not_expired.lic");
@@ -25,7 +27,8 @@
 	licenseLocation.openFileNearModule = false;
 	licenseLocation.licenseFileLocation = licLocation.c_str();
 	licenseLocation.environmentVariableName = "";
-	const EVENT_TYPE result = acquire_license("TEST", licenseLocation, &license);
+	const EVENT_TYPE result = acquire_license("TEST", licenseLocation,
+			&license);
 	BOOST_CHECK_EQUAL(result, LICENSE_OK);
 	BOOST_CHECK_EQUAL(license.has_expiry, true);
 	BOOST_CHECK_EQUAL(license.linked_to_pc, false);
@@ -33,6 +36,7 @@
 
 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");
@@ -43,8 +47,11 @@
 	licenseLocation.openFileNearModule = false;
 	licenseLocation.licenseFileLocation = licLocation.c_str();
 	licenseLocation.environmentVariableName = "";
-	const EVENT_TYPE result = acquire_license("TEST", licenseLocation, &license);
+	const EVENT_TYPE result = acquire_license("TEST", licenseLocation,
+			&license);
 	BOOST_CHECK_EQUAL(result, PRODUCT_EXPIRED);
 	BOOST_CHECK_EQUAL(license.has_expiry, true);
 	BOOST_CHECK_EQUAL(license.linked_to_pc, false);
 }
+
+}

--
Gitblit v1.9.1