aboutsummaryrefslogtreecommitdiffstats
path: root/meowpp.test/src/dsa.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'meowpp.test/src/dsa.cpp')
-rw-r--r--meowpp.test/src/dsa.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/meowpp.test/src/dsa.cpp b/meowpp.test/src/dsa.cpp
index c380098..9b93395 100644
--- a/meowpp.test/src/dsa.cpp
+++ b/meowpp.test/src/dsa.cpp
@@ -1,4 +1,4 @@
-#include "meowpp.h"
+#include "dsa.h"
#include <vector>
#include <string>
@@ -13,35 +13,34 @@ int count = 0;
////////////////////////
int main(int argc, char** argv){
- std::vector<std::string> ids(meow::ObjSelector<0>::lst());
- usg2.addOption('t', "Select which subject to test",
+ std::vector<std::string> ids(meow::ObjSelector<0>::names());
+ usg2.optionAdd('t', "Select which subject to test",
"<number>", "",
false);
for(size_t i = 0; i < ids.size(); i++){
TestFunction* tmp = (TestFunction*)meow::ObjSelector<0>::get(ids[i]);
- usg2.addOptionValueAccept('t', ids[i], tmp->name() + ", " + tmp->description());
- delete tmp;
+ usg2.optionValueAcceptAdd('t', ids[i], tmp->name() + ", " + tmp->description());
}
- usg.addOption('h', "Display this help document");
- usg.addUsageBegin("<name> is a little test program to check whether"
+ usg.optionAdd('h', "Display this help document");
+ usg.usageBeginAdd("<name> is a little test program to check whether"
"the data structures in the template is correct by"
"random generate lots of data to test");
- usg.addUsageEnd ("zzzzzzzzzzzzzzz....");
+ usg.usageEndAdd ("zzzzzzzzzzzzzzz....");
usg.import(usg2);
std::string err;
- if(usg.setArguments(argc, argv, &err) == false){
- printf("%s\n\n%s\n", err.c_str(), usg.getUsage().c_str());
+ if(usg.arguments(argc, argv, &err) == false){
+ printf("%s\n\n%s\n", err.c_str(), usg.usage().c_str());
return 1;
}else if(usg.hasOptionSetup('h')){
- printf("%s", usg.getUsage().c_str());
+ printf("%s", usg.usage().c_str());
return 0;
}else{
usg2.update(usg);
- if(usg2.getOptionValuesCount('t') > 0){
- for(int i = 0, I = usg2.getOptionValuesCount('t'); i < I; i++){
- std::string wh = usg2.getOptionValue('t', i);
+ if(usg2.optionValuesSize('t') > 0){
+ for(int i = 0, I = usg2.optionValuesSize('t'); i < I; i++){
+ std::string wh = usg2.optionValue('t', i);
TestFunction* f = (TestFunction*)meow::ObjSelector<0>::get(wh);
if(f->run() == false){
printf("error occure on %s\n", f->name().c_str());
@@ -49,14 +48,12 @@ int main(int argc, char** argv){
}else{
printf("%s success\n", f->name().c_str());
}
- delete f;
}
}else{
while(true){
for(int i = 0, I = ids.size(); i < I; i++){
TestFunction* tmp = (TestFunction*)meow::ObjSelector<0>::get(ids[i]);
printf(" %s) %s\n", ids[i].c_str(), tmp->name().c_str());
- delete tmp;
}
printf("please select(EOF to quit): ");
int id;
@@ -75,7 +72,6 @@ int main(int argc, char** argv){
}else{
printf("%s success\n", f->name().c_str());
}
- delete f;
}
printf("\n");
}