бывший программист пишет код
Date: 12/03/07
(Code WTF) Keywords: no keywords
# ---------------------------------------------
public function getTestCases(out cases[], in data){
auto functionName = "getTestCases()";
auto i, j, k, x, y;
auto rc, rn, rv, as, val1, val2;
auto testModules, modules[], module[];
DeleteArray (cases);
rc = getSingleValueFromData(data, "testmodule", testModules);
rn = split(testModules, modules, ",");
for (i=1; i<=rn; i++){
rv = split(modules[i],module,"~");
for (j=2; j<=rv; j++){
if((module[1], 1) in cases){
if(as = GetArraySize(cases)){
x=0;
for (k=1;k<=as;k++){
if ((module[1], k) in cases){
val1 = cases[module[1], k];
val2 = module[j];
if (val1 == val2){
x=0;
break;
}else{
x=k;
y=k+1;
}
}else
x=k;
}
if (x == GetArraySize(cases)){
cases[module[1], y] = module[j];
}
}else{
cases[module[1], j-1] = module[j];
}
}else{
cases[module[1], j-1] = module[j];
}
}
}
return GetArraySize(cases);
}
Source: http://community.livejournal.com/code_wtf/116738.html