#5657 Fix SerialKey construction in unit tests

This commit is contained in:
Andrew Nelless
2016-10-17 16:12:33 +01:00
parent 714b2f6440
commit 7eefa49c77
3 changed files with 13 additions and 13 deletions

View File

@@ -181,7 +181,7 @@ SerialKey::email() const
}
std::string
SerialKey::decode(const std::string& serial) const
SerialKey::decode(const std::string& serial)
{
static const char* const lut = "0123456789ABCDEF";
string output;
@@ -215,6 +215,8 @@ SerialKey::parse(std::string plainSerial)
string parityStart = plainSerial.substr(0, 1);
string parityEnd = plainSerial.substr(plainSerial.length() - 1, 1);
m_valid = false;
// check for parity chars { and }, record parity result, then remove them.
if (parityStart == "{" && parityEnd == "}") {
plainSerial = plainSerial.substr(1, plainSerial.length() - 2);

View File

@@ -40,10 +40,11 @@ public:
Edition edition() const;
std::string toString() const;
static std::string decode(const std::string& serial);
static Edition parseEdition(const std::string& editionStr);
private:
std::string decode(const std::string& serial) const;
void parse(std::string plainSerial);
Edition parseEdition(const std::string& editionStr);
std::string editionString() const;
#ifdef TEST_ENV