mirror of
https://github.com/QuasarApp/CopyrightFixer.git
synced 2025-04-26 09:44:40 +00:00
Merge pull request #64 from QuasarApp/task_63
Fixing bugs: added comments for all test methods.
This commit is contained in:
commit
61d96a54e5
@ -49,7 +49,12 @@ void ConfigParserTest::testParseConf() const {
|
||||
CopyrighFixer::Config testConfig;
|
||||
CopyrighFixer::ConfigParser testParserConf;
|
||||
|
||||
// This condition returns true if the parameters were parsed without error
|
||||
// because the input parameters were specified as valid.
|
||||
QVERIFY(testParserConf.parseOptions(testConfig));
|
||||
|
||||
// This condition returns true if signature that in Config have been parsed without error,
|
||||
// because the input parameters were specified as valid.
|
||||
QVERIFY(testConfig.getSignVal().isValid());
|
||||
}
|
||||
|
||||
@ -60,19 +65,21 @@ void ConfigParserTest::testSrcKey() const {
|
||||
CopyrighFixer::Config testConfig;
|
||||
CopyrighFixer::ConfigParser testParserConf;
|
||||
|
||||
// This condition returns true in any case, even if the
|
||||
// sourceDir key is not present in the parameter list or is not written correctly.
|
||||
QVERIFY(testParserConf.parseOptions(testConfig));
|
||||
}
|
||||
|
||||
void ConfigParserTest::testSrcPath() const {
|
||||
|
||||
QStringList lstOpt = {"-sourceDir", "./ParserProj", "-sign", "testSign.json"};
|
||||
QuasarAppUtils::Params::parseParams(lstOpt);
|
||||
|
||||
CopyrighFixer::Config testConfig;
|
||||
CopyrighFixer::ConfigParser testParserConf;
|
||||
|
||||
// This condition checks for the correct path to the sourceDir key.
|
||||
// Should return false, because the path to lstOpt is not correct.
|
||||
QVERIFY(!testParserConf.parseOptions(testConfig));
|
||||
|
||||
}
|
||||
|
||||
void ConfigParserTest::testSignKey() const {
|
||||
@ -82,8 +89,9 @@ void ConfigParserTest::testSignKey() const {
|
||||
CopyrighFixer::Config testConfig;
|
||||
CopyrighFixer::ConfigParser testParserConf;
|
||||
|
||||
// This condition checks for the presence and validity of the sign
|
||||
// parameter. If it is entered incorrectly or is missing return false.
|
||||
QVERIFY(!testParserConf.parseOptions(testConfig));
|
||||
|
||||
}
|
||||
|
||||
void ConfigParserTest::testSignPath() const {
|
||||
@ -93,6 +101,9 @@ void ConfigParserTest::testSignPath() const {
|
||||
CopyrighFixer::Config testConfig;
|
||||
CopyrighFixer::ConfigParser testParserConf;
|
||||
|
||||
// This condition checks for the validity of the path to file
|
||||
// signature. After checking, the file is missing and returns false
|
||||
// because lstOpt specifies a non-existing file path.
|
||||
QVERIFY(!testParserConf.parseOptions(testConfig));
|
||||
|
||||
}
|
||||
@ -100,6 +111,8 @@ void ConfigParserTest::testSignPath() const {
|
||||
void ConfigParserTest::testParsOpt() {
|
||||
|
||||
QString testFileSign = "testSign.json";
|
||||
|
||||
// Initialization of a signature with random parameters.
|
||||
generateRandomSign(testFileSign);
|
||||
|
||||
testParseConf();
|
||||
|
@ -44,8 +44,11 @@ CopyrighFixer::Signature SignTest::generateRandomSign(QString& filename) const {
|
||||
void SignTest::testJsonObj() {
|
||||
QString filename = "signature.json";
|
||||
|
||||
// Generating a randomly populated signature object.
|
||||
CopyrighFixer::Signature baseSign = generateRandomSign(filename);
|
||||
|
||||
// The condition will return true because the signature structure
|
||||
// is correct. Which is checked in the following condition.
|
||||
QVERIFY(baseSign.toJson(filename));
|
||||
QVERIFY(baseSign.isValid());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user