Performance testing: added option to get list of all values for CV_ENUM; added perf test for cv::Sobel

This commit is contained in:
Andrey Kamaev
2011-11-01 15:41:43 +00:00
parent 46262b1972
commit a612fa1520
5 changed files with 77 additions and 4 deletions

View File

@@ -101,6 +101,17 @@ public:\
}\
*os << "UNKNOWN";\
}\
struct Container{\
typedef class_name value_type;\
Container(class_name* first, size_t len): _begin(first), _end(first+len){}\
const class_name* begin() const {return _begin;}\
const class_name* end() const {return _end;}\
private: class_name *_begin, *_end;\
};\
static Container all(){\
static class_name vals[] = {__VA_ARGS__};\
return Container(vals, sizeof(vals)/sizeof(vals[0]));\
}\
private: int _val;\
};\
inline void PrintTo(const class_name& t, std::ostream* os) { t.PrintTo(os); }

View File

@@ -40,7 +40,30 @@ def getValueParams(test):
param = param[1:]
if param.endswith(")"):
param = param[:-1]
return [p.strip() for p in param.split(",")]
args = []
prev_pos = 0
start = 0
balance = 0
while True:
idx = param.find(",", prev_pos)
if idx < 0:
break
idxlb = param.find("(", prev_pos, idx)
while idxlb >= 0:
balance += 1
idxlb = param.find("(", idxlb+1, idx)
idxrb = param.find(")", prev_pos, idx)
while idxrb >= 0:
balance -= 1
idxrb = param.find(")", idxrb+1, idx)
assert(balance >= 0)
if balance == 0:
args.append(param[start:idx].strip())
start = idx + 1
prev_pos = idx + 1
args.append(param[start:].strip())
return args
#return [p.strip() for p in param.split(",")]
def nextPermutation(indexes, lists, x, y):
idx = len(indexes)-1