Skip to content
This repository has been archived by the owner on Nov 17, 2024. It is now read-only.

Commit

Permalink
Updated more accurate unit tests. There *is* an issue related to pars…
Browse files Browse the repository at this point in the history
…e causing illegal instruction.
  • Loading branch information
Captainjamason committed Feb 9, 2024
1 parent 82f1d3b commit 02048df
Showing 1 changed file with 8 additions and 30 deletions.
38 changes: 8 additions & 30 deletions src/unitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ int main(int argc, char* argv[]) {

// test output messages...
if(test == "-err") {
if(cli.error("testerr") != 0) {
std::cout << "cli.error() failed!\n";
return 1;
} else {
return 0;
}
}
if(test == "-warn") {

if(cli.warn("testwarn") != 0) {
std::cout << "cli.warn() failed!\n";
return 1;
Expand All @@ -44,37 +37,22 @@ int main(int argc, char* argv[]) {
}

if(test == "-addEntryOnce") {
if(cli.addEntry("--test", "-t", testFunc, &entries)) {
return 0;
entries[0].func();
} else {
return 1;
}
cli.addEntry("--test", "-t", testFunc, &entries);
entries[0].func();
}

//test add entry
if(test == "-addEntryTwice") {
if(cli.addEntry("test1", "t1", testFunc, &entries)) {
entries[0].func();
if(cli.addEntry("test2", "t2", testFunc, &entries)) {
entries[1].func();
} else {
return 1;
}
return 0;
} else {
return 1;
}
cli.addEntry("--test", "-t", testFunc, &entries);
cli.addEntry("-test2", "-t2", testFunc, &entries);
entries[0].func();
entries[1].func();
}

if(test == "-testParse") {
cli.addEntry("--test", "-t", testFunc, &entries);
cli.addEntry("--t2", "-t2", testFunc, &entries);
if(cli.parse(entries, cli.vectorize(argc, argv))) {
return 0;
} else {
return 1;
}
cli.parse(entries, cli.vectorize(argc, argv));
}

// test help()
Expand Down

0 comments on commit 02048df

Please sign in to comment.