From 483c73630a82fe8fbe9fe74cc8bbdd23a13d8b6b Mon Sep 17 00:00:00 2001 From: gcontini <1121667+gcontini@users.noreply.github.com> Date: 周六, 15 2月 2020 23:49:50 +0800 Subject: [PATCH] pc identifiers work --- test/library/hw_identifier/hw_identifier_test.cpp | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/library/pc_identifier/pc_identifier_test.cpp b/test/library/hw_identifier/hw_identifier_test.cpp similarity index 66% rename from test/library/pc_identifier/pc_identifier_test.cpp rename to test/library/hw_identifier/hw_identifier_test.cpp index 82fc503..1e0062c 100644 --- a/test/library/pc_identifier/pc_identifier_test.cpp +++ b/test/library/hw_identifier/hw_identifier_test.cpp @@ -1,11 +1,11 @@ /* - * Test on class PcIdentifier + * Test on class HwIdentifier * * Created on: Dec 26, 2019 * Author: devel */ -#define BOOST_TEST_MODULE test_pc_identifier +#define BOOST_TEST_MODULE test_hw_identifier #include <boost/test/unit_test.hpp> #include <fstream> @@ -17,45 +17,45 @@ #include <licensecc_properties_test.h> #include <licensecc/licensecc.h> -#include "../../../src/library/pc_identifier/pc_identifier.hpp" +#include "../../../src/library/hw_identifier/hw_identifier.hpp" namespace license { namespace test { using namespace std; -using namespace license::pc_identifier; +using namespace license::hw_identifier; /** - * Test get and set and compare pc identifier data + * Test get and set and compare hardware identifier data */ BOOST_AUTO_TEST_CASE(set_and_compare_data) { - array<uint8_t, PC_IDENTIFIER_PROPRIETARY_DATA> data = {0xFF, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; - PcIdentifier pc_id; + array<uint8_t, HW_IDENTIFIER_PROPRIETARY_DATA> data = {0xFF, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; + HwIdentifier pc_id; pc_id.set_data(data); data[0] = data[0] & 0x1f; BOOST_CHECK_MESSAGE(pc_id.data_match(data), "Data match"); } /** - * Test get and set and compare pc identifier data + * Test get and set and compare hardware identifier data */ BOOST_AUTO_TEST_CASE(compare_wrong_data) { - array<uint8_t, PC_IDENTIFIER_PROPRIETARY_DATA> data = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; - PcIdentifier pc_id; + array<uint8_t, HW_IDENTIFIER_PROPRIETARY_DATA> data = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; + HwIdentifier pc_id; pc_id.set_data(data); data[4] = 0; BOOST_CHECK_MESSAGE(!pc_id.data_match(data), "Data shouldn't match"); } /** - * Print a pc identifier and read it from the same string, check the data matches + * Print a hardware identifier and read it from the same string, check the data matches */ BOOST_AUTO_TEST_CASE(print_and_read) { - array<uint8_t, PC_IDENTIFIER_PROPRIETARY_DATA> data = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; - PcIdentifier pc_id; + array<uint8_t, HW_IDENTIFIER_PROPRIETARY_DATA> data = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; + HwIdentifier pc_id; pc_id.set_data(data); pc_id.set_identification_strategy(LCC_API_IDENTIFICATION_STRATEGY::STRATEGY_ETHERNET); string pc_id_str = pc_id.print(); cout << pc_id_str << endl; - const PcIdentifier id2(pc_id_str); + const HwIdentifier id2(pc_id_str); BOOST_CHECK_MESSAGE(id2.get_identification_strategy() == LCC_API_IDENTIFICATION_STRATEGY::STRATEGY_ETHERNET, "Strategy decoded correctly"); BOOST_CHECK_MESSAGE(id2.data_match(data), "Data deserialized correctly"); -- Gitblit v1.9.1