gs_totaltest.m

Go to the documentation of this file.
00001 %
00002 % Some matlab tests.
00003 %
00004 % To run this script, your MATLABPATH will need to be setup to include:
00005 %
00006 % setenv MATLABPATH ${MATLABPATH}:${GRIDSOLVE_ROOT}/src/matlab_client
00007 % 
00008 % Then run matlab
00009 % >> gs_totaltest
00010 
00011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00012 
00013 accepterror = 1.0e-05;
00014 M = 50;
00015 N = 50;
00016 density = 0.2;
00017 
00018 testcount=0;
00019 failedcount=0;
00020 
00021 pause_time = 0;
00022 async_pause = 0;
00023 
00024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00025 
00026 fname = 'sparse_double_matrix_test';
00027 inmn = sprand(M, N, density)*100;
00028 correctmn = spones(inmn) + inmn;
00029 [resultmn] = gs_call(fname, nnz(inmn), inmn, nnz(inmn), M, N);
00030 testcount = testcount+1;
00031 nonz = nonzeros(inmn);
00032 nonz = nonzeros(resultmn);
00033 if (size(resultmn) == [0,0])
00034   fprintf('Result: Failed %s test\n', fname); 
00035   failedcount = failedcount+1;
00036 elseif (max(abs(resultmn-correctmn)) > accepterror)
00037   fprintf('Result: Failed %s test\n', fname); 
00038   failedcount = failedcount+1;
00039 else
00040   fprintf('Result: Success %s test\n', fname);
00041 end
00042 
00043 pause(pause_time);
00044 
00045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00046 
00047 fname = 'return_float_vector';
00048 inintn = N;
00049 infloatvecn = rand(inintn,1)*100;
00050 correctfloatn = infloatvecn+1;
00051 % gs_call(fname, infloatvecn, inintn, resultfloatn);
00052 sid = gs_call_async(fname, infloatvecn, inintn);
00053 if (sid >= 0) 
00054   pause(async_pause);
00055   [resultfloatn] = gs_wait(sid);
00056 end;
00057 testcount = testcount+1;
00058 if (size(resultfloatn) == [0,0]) 
00059   fprintf('Result: Failed %s (async) test\n', fname);
00060   failedcount = failedcount+1;
00061 elseif (max(abs(resultfloatn-correctfloatn)) > accepterror)
00062   fprintf('Result: Failed %s (async) test\n', fname);
00063   failedcount = failedcount+1;
00064 else 
00065   fprintf('Result: Success %s (async) test\n', fname); 
00066 end
00067 
00068 pause(pause_time);
00069 
00070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00071 
00072 fname = 'return_float_scalar';
00073 infloatn = rand(1)*100;
00074 resultfloatn = 0;
00075 correctfloatn = infloatn+1;
00076 [resultfloatn] = gs_call(fname, infloatn);
00077 testcount = testcount+1;
00078 if (size(resultfloatn) == [0,0])
00079   fprintf('Result: Failed %s test\n', fname); 
00080   failedcount = failedcount+1;
00081 elseif (max(abs(resultfloatn-correctfloatn)) > accepterror)
00082   fprintf('Result: Failed %s test\n', fname); 
00083   failedcount = failedcount+1;
00084 else 
00085   fprintf('Result: Success %s test\n', fname); 
00086 end
00087 
00088 pause(pause_time);
00089 
00090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00091  
00092 testname = 'cancel';
00093 sid = gs_call_async('sleeptest', 15);
00094 if (sid<0)
00095   return;
00096 end
00097 status = gs_cancel(sid);
00098 % fprintf('%s test: Cancel returned status %d.\n', testname, status);
00099 
00100 if (status ~= 0)
00101   fprintf('Result: Failed %s test\n', testname); 
00102   failedcount = failedcount+1;
00103 else 
00104   fprintf('Result: Success %s test\n', testname); 
00105 end
00106 
00107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00108 
00109 testname = 'probe';
00110 % fprintf('%s test: ... please wait\n', testname);
00111 sid = gs_call_async('sleeptest', 8);
00112 if sid<0 
00113   return;
00114 end
00115 status = 0;
00116 sleepcount = 0;
00117 while 1==1, 
00118   status = gs_probe(sid);
00119   if status~=0
00120     % fprintf('%s test: Status %d; sleeping.\n', testname, status);
00121     sleepcount = sleepcount + 1;
00122     pause(1);
00123   else 
00124     % fprintf('%s test: Status %d; break.\n', testname, status);
00125     break
00126   end
00127 end
00128 gs_wait(sid);
00129 
00130 if (sleepcount <= 1)
00131   fprintf('Result: Failed %s test\n', testname); 
00132   failedcount = failedcount+1;
00133 else 
00134   fprintf('Result: Success %s test\n', testname); 
00135 end
00136 
00137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00138 
00139 fname = 'return_double_vector';
00140 inintn = N;
00141 indoublevecn = rand(inintn,1)*100;
00142 correctdoublen = indoublevecn+1;
00143 sid = gs_call_async(fname, indoublevecn, inintn);
00144 if (sid >= 0) 
00145   pause(async_pause);
00146   [resultdoublen] = gs_wait(sid);
00147 end;
00148 testcount = testcount+1;
00149 if (size(resultdoublen) == [0,0])
00150   fprintf('Result: Failed %s (async) test\n', fname); 
00151   failedcount = failedcount+1;
00152 elseif (max(abs(resultdoublen-correctdoublen)) > accepterror)
00153   fprintf('Result: Failed %s (async) test\n', fname); 
00154   failedcount = failedcount+1;
00155 else 
00156   fprintf('Result: Success %s (async) test\n', fname); 
00157 end
00158 
00159 pause(pause_time);
00160 
00161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00162 
00163 fname = 'return_float_matrix';
00164 inintm = M;
00165 inintn = N;
00166 infloatmatmn = rand(inintm, inintn)*100;
00167 correctfloatmn = infloatmatmn+1;
00168 % gs_call(fname, infloatmatmn, inintm, inintn, resultfloatmn);
00169 [sid] = gs_call_async(fname, infloatmatmn, inintm, inintn);
00170 if (sid >= 0) 
00171   pause(async_pause);
00172   [resultfloatmn] = gs_wait(sid);
00173 end
00174 testcount = testcount+1;
00175 if (size(resultfloatmn) == [0,0])
00176   fprintf('Result: Failed %s (async) test\n', fname); 
00177   failedcount = failedcount+1;
00178 elseif (max(abs(resultfloatmn-correctfloatmn)) > accepterror)
00179   fprintf('Result: Failed %s (async) test\n', fname); 
00180   failedcount = failedcount+1;
00181 else 
00182   fprintf('Result: Success %s (async) test\n', fname); 
00183 end
00184 
00185 pause(pause_time);
00186 
00187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00188 
00189 fname = 'return_double_matrix';
00190 inintm = M;
00191 inintn = N;
00192 indoublematmn = rand(inintm, inintn)*100;
00193 correctdoublemn = indoublematmn+1;
00194 % gs_call(fname, indoublematmn, inintm, inintn, resultdoublemn);
00195 sid = gs_call_async(fname, indoublematmn, inintm, inintn);
00196 if (sid >= 0) 
00197   pause(async_pause);
00198   [resultdoublemn] = gs_wait(sid);
00199 end;
00200 testcount = testcount+1;
00201 if (size(resultdoublemn) == [0,0])
00202   fprintf('Result: Failed %s (async) test\n', fname); 
00203   failedcount = failedcount+1;
00204 elseif (max(abs(resultdoublemn-correctdoublemn)) > accepterror)
00205   fprintf('Result: Failed %s (async) test\n', fname); 
00206   failedcount = failedcount+1;
00207 else 
00208   fprintf('Result: Success %s (async) test\n', fname); 
00209 end
00210 
00211 pause(pause_time);
00212 
00213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00214 
00215 fname = 'return_int_matrix';
00216 inintm = M;
00217 inintn = N;
00218 inintmatmn = floor(rand(inintm, inintn)*100);
00219 resultintmn = zeros(inintm, inintn);
00220 correctintmn = inintmatmn+1;
00221 % gs_call(fname, inintmatmn, inintm, inintn, resultintmn);
00222 sid = gs_call_async(fname, inintmatmn, inintm, inintn);
00223 if (sid >= 0) 
00224   pause(async_pause);
00225   [resultintmn] = gs_wait(sid);
00226 end;
00227 testcount = testcount+1;
00228 if (size(resultintmn) == [0,0]);
00229   fprintf('Result: Failed %s (async) test\n', fname); 
00230   failedcount = failedcount+1;
00231 elseif (max(abs(resultintmn-correctintmn)) > accepterror)
00232   fprintf('Result: Failed %s (async) test\n', fname); 
00233   failedcount = failedcount+1;
00234 else 
00235   fprintf('Result: Success %s (async) test\n', fname); 
00236 end
00237 
00238 pause(pause_time);
00239 
00240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00241 
00242 % fname = 'return_char_matrix';
00243 % incharm = M;
00244 % incharn = N;
00245 % incharmatmn = char(floor(rand(incharm, incharn)*127));
00246 % resultcharmn = zeros(incharm, incharn);
00247 % correctcharmn = incharmatmn+1;
00248 % % gs_call(fname, incharmatmn, incharm, incharn, resultcharmn);
00249 % sid = gs_call_async(fname, incharmatmn, incharm, incharn);
00250 % if (sid >= 0) 
00251 %   pause(async_pause);
00252 %   [resultcharmn] = gs_wait(sid);
00253 % end;
00254 % testcount = testcount+1;
00255 % if (size(resultcharmn) == [0,0])
00256 %   fprintf('Result: Failed %s (async) test\n', fname); 
00257 %   failedcount = failedcount+1;
00258 % else if (max(abs(resultcharmn-correctcharmn)) > accepterror)
00259 %   fprintf('Result: Failed %s (async) test\n', fname); 
00260 %   failedcount = failedcount+1;
00261 % else 
00262 %   fprintf('Result: Success %s (async) test\n', fname); 
00263 % end
00264 
00265 pause(pause_time);
00266 
00267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00268 
00269 fname = 'return_int_vector';
00270 inintn = N;
00271 inintvecn = floor(rand(inintn,1)*100);
00272 resultintn = zeros(inintn,1);
00273 correctintn = inintvecn+1;
00274 % gs_call(fname, inintvecn, inintn, resultintn);
00275 sid = gs_call_async(fname, inintvecn, inintn);
00276 if (sid >= 0) 
00277   pause(async_pause);
00278   [resultintn] = gs_wait(sid);
00279 end;
00280 testcount = testcount+1;
00281 if (size(resultintn) == [0,0]);
00282   fprintf('Result: Failed %s (async) test\n', fname); 
00283   failedcount = failedcount+1;
00284 elseif (max(abs(resultintn-correctintn)) > accepterror)
00285   fprintf('Result: Failed %s (async) test\n', fname); 
00286   failedcount = failedcount+1;
00287 else 
00288   fprintf('Result: Success %s (async) test\n', fname); 
00289 end
00290 
00291 pause(pause_time);
00292 
00293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00294 
00295 % fname = 'return_char_vector';
00296 % incharn = N;
00297 % incharvecn = char(floor(rand(incharn,1)*127));
00298 % resultcharn = zeros(incharn,1);
00299 % correctcharn = incharvecn+1;
00300 % % gs_call(fname, incharvecn, incharn, resultcharn);
00301 % sid = gs_call_async(fname, incharvecn, incharn);
00302 % if (sid >= 0) 
00303 %   pause(async_pause);
00304 %   [resultcharn] = gs_wait(sid);
00305 % end;
00306 % testcount = testcount+1
00307 % if (size(resultcharn) == [0,0]);
00308 %   fprintf('Result: Failed %s (async) test\n', fname); 
00309 %   failedcount = failedcount+1;
00310 % else if (max(abs(resultcharn-correctcharn)) > accepterror)
00311 %   fprintf('Result: Failed %s (async) test\n', fname); 
00312 %   failedcount = failedcount+1;
00313 % else 
00314 %   fprintf('Result: Success %s (async) test\n', fname); 
00315 % end
00316 
00317 pause(pause_time);
00318 
00319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00320 
00321 fname = 'return_int_scalar';
00322 inintn = floor(rand(1)*100);
00323 resultintn = 0;
00324 correctintn = inintn+1;
00325 % gs_call(fname, inintn, resultintn);
00326 sid = gs_call_async(fname, inintn);
00327 if (sid >= 0) 
00328   pause(async_pause);
00329   [resultintn] = gs_wait(sid);
00330 end;
00331 testcount = testcount+1;
00332 if (size(resultintn) == [0,0]);
00333   fprintf('Result: Failed %s (async) test\n', fname); 
00334   failedcount = failedcount+1;
00335 elseif (max(abs(resultintn-correctintn)) > accepterror)
00336   fprintf('Result: Failed %s (async) test\n', fname); 
00337   failedcount = failedcount+1;
00338 else 
00339   fprintf('Result: Success %s (async) test\n', fname); 
00340 end
00341 
00342 pause(pause_time);
00343 
00344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00345 
00346 fname = 'return_double_scalar';
00347 indoublen = (rand(1)*100);
00348 resultdoublen = 0;
00349 correctdoublen = indoublen+1;
00350 % gs_call(fname, indoublen, resultdoublen);
00351 sid = gs_call_async(fname, indoublen);
00352 if (sid >= 0) 
00353   pause(async_pause);
00354   [resultdoublen] = gs_wait(sid);
00355 end;
00356 testcount = testcount+1;
00357 if (size(resultdoublen) == [0,0])
00358   fprintf('Result: Failed %s (async) test\n', fname); 
00359   failedcount = failedcount+1;
00360 elseif (max(abs(resultdoublen-correctdoublen)) > accepterror)
00361   fprintf('Result: Failed %s (async) test\n', fname); 
00362   failedcount = failedcount+1;
00363 else 
00364   fprintf('Result: Success %s (async) test\n', fname); 
00365 end
00366 
00367 pause(pause_time);
00368 
00369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00370 
00371 fname = 'return_float_scalar';
00372 infloatn = rand(1)*100;
00373 resultfloatn = 0;
00374 correctfloatn = infloatn+1;
00375 % gs_call(fname, infloatn, resultfloatn);
00376 sid = gs_call_async(fname, infloatn);
00377 if (sid >= 0) 
00378   pause(async_pause);
00379   [resultfloatn] = gs_wait(sid);
00380 end;
00381 testcount = testcount+1;
00382 if (size(resultfloatn) == [0,0])
00383   fprintf('Result: Failed %s (async) test\n', fname); 
00384   failedcount = failedcount+1;
00385 elseif (max(abs(resultfloatn-correctfloatn)) > accepterror)
00386   fprintf('Result: Failed %s (async) test\n', fname); 
00387   failedcount = failedcount+1;
00388 else 
00389   fprintf('Result: Success %s (async) test\n', fname); 
00390 end
00391 
00392 pause(pause_time);
00393 
00394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00395 
00396 % fname = 'return_char_scalar';
00397 % incharn = char(floor(rand(1)*100));
00398 % resultcharn = 0;
00399 % correctcharn = incharn+1;
00400 % % gs_call(fname, incharn, resultcharn);
00401 % sid = gs_call_async(fname, incharn);
00402 % if (sid >= 0) 
00403 %   pause(async_pause);
00404 %   [resultcharn] = gs_wait(sid);
00405 % end;
00406 % testcount = testcount+1
00407 % if (size(resultcharn) == [0,0]);
00408 %   fprintf('Result: Failed %s (async) test\n', fname); 
00409 %   failedcount = failedcount+1;
00410 % else % if (max(abs(resultcharn-correctcharn)) > accepterror)
00411 %   fprintf('Result: Failed %s (async) test\n', fname); 
00412 %   failedcount = failedcount+1;
00413 % else 
00414 %   fprintf('Result: Success %s (async) test\n', fname); 
00415 % end
00416 
00417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00418 
00419 fname = 'return_float_matrix';
00420 inintm = M;
00421 inintn = N;
00422 infloatmatmn = rand(inintm, inintn)*100;
00423 resultfloatmn = zeros(inintm, inintn);
00424 correctfloatmn = infloatmatmn+1;
00425 [resultfloatmn] = gs_call(fname, infloatmatmn, inintm, inintn);
00426 testcount = testcount+1;
00427 if (size(resultfloatmn) == [0,0])
00428   fprintf('Result: Failed %s test\n', fname); 
00429   failedcount = failedcount+1;
00430 elseif (max(abs(resultfloatmn-correctfloatmn)) > accepterror)
00431   fprintf('Result: Failed %s test\n', fname); 
00432   failedcount = failedcount+1;
00433 else 
00434   fprintf('Result: Success %s test\n', fname); 
00435 end
00436 
00437 pause(pause_time);
00438 
00439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00440 
00441 fname = 'return_double_matrix';
00442 inintm = M;
00443 inintn = N;
00444 indoublematmn = rand(inintm, inintn)*100;
00445 resultdoublemn = zeros(inintm, inintn);
00446 correctdoublemn = indoublematmn+1;
00447 [resultdoublemn] = gs_call(fname, indoublematmn, inintm, inintn);
00448 testcount = testcount+1;
00449 if (size(resultdoublemn) == [0,0])
00450   fprintf('Result: Failed %s test\n', fname); 
00451   failedcount = failedcount+1;
00452 elseif (max(abs(resultdoublemn-correctdoublemn)) > accepterror)
00453   fprintf('Result: Failed %s test\n', fname); 
00454   failedcount = failedcount+1;
00455 else 
00456   fprintf('Result: Success %s test\n', fname); 
00457 end
00458 
00459 pause(pause_time);
00460 
00461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00462 
00463 fname = 'return_int_matrix';
00464 inintm = M;
00465 inintn = N;
00466 inintmatmn = floor(rand(inintm, inintn)*100);
00467 resultintmn = zeros(inintm, inintn);
00468 correctintmn = inintmatmn+1;
00469 [resultintmn] = gs_call(fname, inintmatmn, inintm, inintn);
00470 testcount = testcount+1;
00471 if (size(resultintmn) == [0,0]);
00472   fprintf('Result: Failed %s test\n', fname); 
00473   failedcount = failedcount+1;
00474 elseif (max(abs(resultintmn-correctintmn)) > accepterror)
00475   fprintf('Result: Failed %s test\n', fname); 
00476   failedcount = failedcount+1;
00477 else 
00478   fprintf('Result: Success %s test\n', fname); 
00479 end
00480 
00481 pause(pause_time);
00482 
00483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00484 
00485 % fname = 'return_char_matrix';
00486 % incharm = M;
00487 % incharn = N;
00488 % incharmatmn = char(floor(rand(incharm, incharn)*127));
00489 % resultcharmn = zeros(incharm, incharn);
00490 % correctcharmn = incharmatmn+1;
00491 % gs_call(fname, incharmatmn, incharm, incharn, resultcharmn);
00492 % testcount = testcount+1;
00493 % if (size(resultcharmn) == [0,0])
00494 %   fprintf('Result: Failed %s test\n', fname); 
00495 %   failedcount = failedcount+1;
00496 % elseif (max(abs(resultcharmn-correctcharmn)) > accepterror)
00497 %   fprintf('Result: Failed %s test\n', fname); 
00498 %   failedcount = failedcount+1;
00499 % else 
00500 %   fprintf('Result: Success %s test\n', fname); 
00501 % end
00502 
00503 pause(pause_time);
00504 
00505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00506 
00507 fname = 'return_float_vector';
00508 inintn = N;
00509 infloatvecn = rand(inintn,1)*100;
00510 resultfloatn = zeros(inintn,1);
00511 correctfloatn = infloatvecn+1;
00512 [resultfloatn] = gs_call(fname, infloatvecn, inintn);
00513 testcount = testcount+1;
00514 if (size(resultfloatn) == [0,0])
00515   fprintf('Result: Failed %s test\n', fname); 
00516   failedcount = failedcount+1;
00517 elseif (max(abs(resultfloatn-correctfloatn)) > accepterror)
00518   fprintf('Result: Failed %s test\n', fname); 
00519   failedcount = failedcount+1;
00520 else 
00521   fprintf('Result: Success %s test\n', fname); 
00522 end
00523 
00524 pause(pause_time);
00525  
00526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00527 
00528 fname = 'return_double_vector';
00529 inintn = N;
00530 indoublevecn = rand(inintn, 1)*100;
00531 resultdoublen = zeros(inintn,1);
00532 correctdoublen = indoublevecn+1;
00533 [resultdoublen] = gs_call(fname, indoublevecn, inintn);
00534 testcount = testcount+1;
00535 if (size(resultdoublen) == [0,0])
00536   fprintf('Result: Failed %s test\n', fname); 
00537   failedcount = failedcount+1;
00538 elseif (max(abs(resultdoublen-correctdoublen)) > accepterror)
00539   fprintf('Result: Failed %s test\n', fname); 
00540   failedcount = failedcount+1;
00541 else 
00542   fprintf('Result: Success %s test\n', fname); 
00543 end
00544 
00545 pause(pause_time);
00546 
00547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00548 
00549 fname = 'return_int_vector';
00550 inintn = N;
00551 inintvecn = floor(rand(inintn,1)*100);
00552 resultintn = zeros(inintn,1);
00553 correctintn = inintvecn+1;
00554 [resultintn] = gs_call(fname, inintvecn, inintn);
00555 testcount = testcount+1;
00556 if (size(resultintn) == [0,0]);
00557   fprintf('Result: Failed %s test\n', fname); 
00558   failedcount = failedcount+1;
00559 elseif (max(abs(resultintn-correctintn)) > accepterror)
00560   fprintf('Result: Failed %s test\n', fname); 
00561   failedcount = failedcount+1;
00562 else 
00563   fprintf('Result: Success %s test\n', fname); 
00564 end
00565 
00566 pause(pause_time);
00567 
00568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00569 
00570 % fname = 'return_char_vector';
00571 % incharn = N;
00572 % incharvecn = char(floor(rand(incharn,1)*127));
00573 % resultcharn = zeros(incharn,1);
00574 % correctcharn = incharvecn+1;
00575 % gs_call(fname, incharvecn, incharn, resultcharn);
00576 % testcount = testcount+1
00577 % if (size(resultcharn) == [0,0]);
00578 %   fprintf('Result: Failed %s test\n', fname); 
00579 %   failedcount = failedcount+1;
00580 % elseif (max(abs(resultcharn-correctcharn)) > accepterror)
00581 %   fprintf('Result: Failed %s test\n', fname); 
00582 %   failedcount = failedcount+1;
00583 % else 
00584 %   fprintf('Result: Success %s test\n', fname); 
00585 % end
00586 
00587 pause(pause_time);
00588 
00589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00590 
00591 fname = 'return_int_scalar';
00592 inintn = floor(rand(1)*100);
00593 resultintn = 0;
00594 correctintn = inintn+1;
00595 [resultintn] = gs_call(fname, inintn);
00596 testcount = testcount+1;
00597 if (size(resultintn) == [0,0]);
00598   fprintf('Result: Failed %s test\n', fname); 
00599   failedcount = failedcount+1;
00600 elseif (max(abs(resultintn-correctintn)) > accepterror)
00601   fprintf('Result: Failed %s test\n', fname); 
00602   failedcount = failedcount+1;
00603 else 
00604   fprintf('Result: Success %s test\n', fname); 
00605 end
00606 
00607 pause(pause_time);
00608 
00609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00610 
00611 fname = 'return_double_scalar';
00612 indoublen = (rand(1)*100);
00613 resultdoublen = 0;
00614 correctdoublen = indoublen+1;
00615 [resultdoublen] = gs_call(fname, indoublen);
00616 testcount = testcount+1;
00617 if (size(resultdoublen) == [0,0])
00618   fprintf('Result: Failed %s test\n', fname); 
00619   failedcount = failedcount+1;
00620 elseif (max(abs(resultdoublen-correctdoublen)) > accepterror)
00621   fprintf('Result: Failed %s test\n', fname); 
00622   failedcount = failedcount+1;
00623 else 
00624   fprintf('Result: Success %s test\n', fname); 
00625 end
00626 
00627 pause(pause_time);
00628 
00629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00630 
00631 fname = 'return_varout_string';
00632 [n, str2] = gs_call('varlen_return');
00633 % fprintf('%s test: %d \n', fname, n); 
00634 % fprintf('%d ? %d *%s* \n', size(str2,2), n, str2);
00635 testcount = testcount+1;
00636 if (size(str2,2) ~= n-1) 
00637   fprintf('Result: Failed %s test\n', fname); 
00638   failedcount = failedcount+1;
00639 else 
00640   fprintf('Result: Success %s test\n', fname); 
00641 end
00642 
00643 pause(pause_time);
00644 
00645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00646 
00647 % fname = 'return_char_scalar';
00648 % incharn = char(floor(rand(1)*100));
00649 % resultcharn = 0;
00650 % correctcharn = incharn+1;
00651 % [resultcharn] = gs_call(fname, incharn);
00652 % testcount = testcount+1
00653 % if (size(resultcharn) == [0,0]);
00654 %   fprintf('Result: Failed %s test\n', fname); 
00655 %   failedcount = failedcount+1;
00656 % elseif (max(abs(resultcharn-correctcharn)) > accepterror)
00657 %   fprintf('Result: Failed %s test\n', fname); 
00658 %   failedcount = failedcount+1;
00659 % else 
00660 %   fprintf('Result: Success %s test\n', fname); 
00661 % end
00662 
00663 pause(pause_time);
00664 
00665 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00666 
00667 fname = 'return_scomplex_scalar';
00668 in=0; correct=0; result=0; sid=0;
00669 in = rand(1,1)*100 + i*rand(1,1)*100;
00670 correct = in + (1+1i);
00671 sid = gs_call_async(fname, in);
00672 if (sid >= 0) 
00673   pause(async_pause);
00674   [result] = gs_wait(sid);
00675 end;
00676 testcount = testcount+1;
00677 if (size(result) == [0,0])
00678   fprintf('Result: Failed %s (async) test\n', fname); 
00679   failedcount = failedcount+1;
00680 elseif (max(abs(result-correct)) > accepterror)
00681   fprintf('Result: Failed %s (async) test\n', fname); 
00682   failedcount = failedcount+1;
00683 else 
00684   fprintf('Result: Success %s (async) test\n', fname); 
00685 end
00686 pause(pause_time);
00687 
00688 
00689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00690 
00691 fname = 'return_scomplex_scalar';
00692 in=0; correct=0; result=0; sid=0;
00693 in = rand(1,1)*100 + i*rand(1,1)*100;
00694 correct = in + (1+1i);
00695 [result] = gs_call(fname, in);
00696 testcount = testcount+1;
00697 if (size(result) == [0,0])
00698   fprintf('Result: Failed %s test\n', fname); 
00699   failedcount = failedcount+1;
00700 elseif (max(abs(result-correct)) > accepterror)
00701   fprintf('Result: Failed %s test\n', fname); 
00702   failedcount = failedcount+1;
00703 else 
00704   fprintf('Result: Success %s test\n', fname); 
00705 end
00706 pause(pause_time);
00707 
00708 
00709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00710 
00711 fname = 'return_scomplex_vector';
00712 in=0; correct=0; result=0; sid=0;
00713 in = rand(N,1)*100 + i*rand(N,1)*100;
00714 correct = in + (1+1i);
00715 sid = gs_call_async(fname, in, N);
00716 if (sid >= 0) 
00717   pause(async_pause);
00718   [result] = gs_wait(sid);
00719 end;
00720 testcount = testcount+1;
00721 if (size(result) == [0,0])
00722   fprintf('Result: Failed %s (async) test\n', fname); 
00723   failedcount = failedcount+1;
00724 elseif (max(abs(result-correct)) > accepterror)
00725   fprintf('Result: Failed %s (async) test\n', fname); 
00726   failedcount = failedcount+1;
00727 else 
00728   fprintf('Result: Success %s (async) test\n', fname); 
00729 end
00730 pause(pause_time);
00731 
00732 
00733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00734 
00735 fname = 'return_scomplex_vector';
00736 in=0; correct=0; result=0; sid=0;
00737 in = rand(N,1)*100 + i*rand(N,1)*100;
00738 correct = in + (1+1i);
00739 [result] = gs_call(fname, in, N);
00740 testcount = testcount+1;
00741 if (size(result) == [0,0])
00742   fprintf('Result: Failed %s test\n', fname); 
00743   failedcount = failedcount+1;
00744 elseif (max(abs(result-correct)) > accepterror)
00745   fprintf('Result: Failed %s test\n', fname); 
00746   failedcount = failedcount+1;
00747 else 
00748   fprintf('Result: Success %s test\n', fname); 
00749 end
00750 pause(pause_time);
00751 
00752 
00753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00754 
00755 fname = 'return_scomplex_matrix';
00756 in=0; correct=0; result=0; sid=0;
00757 in = rand(M,N)*100 + i*rand(M,N)*100;
00758 correct = in + (1+1i);
00759 sid = gs_call_async(fname, in, N, M);
00760 if (sid >= 0) 
00761   pause(async_pause);
00762   [result] = gs_wait(sid);
00763 end;
00764 testcount = testcount+1;
00765 if (size(result) == [0,0])
00766   fprintf('Result: Failed %s (async) test\n', fname); 
00767   failedcount = failedcount+1;
00768 elseif (max(abs(result-correct)) > accepterror)
00769   fprintf('Result: Failed %s (async) test\n', fname); 
00770   failedcount = failedcount+1;
00771 else 
00772   fprintf('Result: Success %s (async) test\n', fname); 
00773 end
00774 pause(pause_time);
00775 
00776 
00777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00778 
00779 fname = 'return_scomplex_matrix';
00780 in=0; correct=0; result=0; sid=0;
00781 in = rand(M,N)*100 + i*rand(M,N)*100;
00782 correct = in + (1+1i);
00783 [result] = gs_call(fname, in, N, M);
00784 testcount = testcount+1;
00785 if (size(result) == [0,0])
00786   fprintf('Result: Failed %s test\n', fname); 
00787   failedcount = failedcount+1;
00788 elseif (max(abs(result-correct)) > accepterror)
00789   fprintf('Result: Failed %s test\n', fname); 
00790   failedcount = failedcount+1;
00791 else 
00792   fprintf('Result: Success %s test\n', fname); 
00793 end
00794 pause(pause_time);
00795 
00796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00797 
00798 fname = 'return_dcomplex_scalar';
00799 in=0; correct=0; result=0; sid=0;
00800 in = rand(1,1)*100 + i*rand(1,1)*100;
00801 correct = in + (1+1i);
00802 sid = gs_call_async(fname, in);
00803 if (sid >= 0) 
00804   pause(async_pause);
00805   [result] = gs_wait(sid);
00806 end;
00807 testcount = testcount+1;
00808 if (size(result) == [0,0])
00809   fprintf('Result: Failed %s (async) test\n', fname); 
00810   failedcount = failedcount+1;
00811 elseif (max(abs(result-correct)) > accepterror)
00812   fprintf('Result: Failed %s (async) test\n', fname); 
00813   failedcount = failedcount+1;
00814 else 
00815   fprintf('Result: Success %s (async) test\n', fname); 
00816 end
00817 pause(pause_time);
00818 
00819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00820 
00821 fname = 'return_dcomplex_scalar';
00822 in=0; correct=0; result=0; sid=0;
00823 in = rand(1,1)*100 + i*rand(1,1)*100;
00824 correct = in + (1+1i);
00825 [result] = gs_call(fname, in);
00826 testcount = testcount+1;
00827 if (size(result) == [0,0])
00828   fprintf('Result: Failed %s test\n', fname); 
00829   failedcount = failedcount+1;
00830 elseif (max(abs(result-correct)) > accepterror)
00831   fprintf('Result: Failed %s test\n', fname); 
00832   failedcount = failedcount+1;
00833 else 
00834   fprintf('Result: Success %s test\n', fname); 
00835 end
00836 pause(pause_time);
00837 
00838 
00839 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00840 
00841 fname = 'return_dcomplex_vector';
00842 in=0; correct=0; result=0; sid=0;
00843 in = rand(N,1)*100 + i*rand(N,1)*100;
00844 correct = in + (1+1i);
00845 sid = gs_call_async(fname, in, N);
00846 if (sid >= 0) 
00847   pause(async_pause);
00848   [result] = gs_wait(sid);
00849 end;
00850 testcount = testcount+1;
00851 if (size(result) == [0,0])
00852   fprintf('Result: Failed %s (async) test\n', fname); 
00853   failedcount = failedcount+1;
00854 elseif (max(abs(result-correct)) > accepterror)
00855   fprintf('Result: Failed %s (async) test\n', fname); 
00856   failedcount = failedcount+1;
00857 else 
00858   fprintf('Result: Success %s (async) test\n', fname); 
00859 end
00860 pause(pause_time);
00861 
00862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00863 
00864 fname = 'return_dcomplex_vector';
00865 in=0; correct=0; result=0; sid=0;
00866 in = rand(N,1)*100 + i*rand(N,1)*100;
00867 correct = in + (1+1i);
00868 [result] = gs_call(fname, in, N);
00869 testcount = testcount+1;
00870 if (size(result) == [0,0])
00871   fprintf('Result: Failed %s test\n', fname); 
00872   failedcount = failedcount+1;
00873 elseif (max(abs(result-correct)) > accepterror)
00874   fprintf('Result: Failed %s test\n', fname); 
00875   failedcount = failedcount+1;
00876 else 
00877   fprintf('Result: Success %s test\n', fname); 
00878 end
00879 pause(pause_time);
00880 
00881 
00882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00883 
00884 fname = 'return_dcomplex_matrix';
00885 in=0; correct=0; result=0; sid=0;
00886 in = rand(M,N)*100 + i*rand(M,N)*100;
00887 correct = in + (1+1i);
00888 sid = gs_call_async(fname, in, N, M);
00889 if (sid >= 0) 
00890   pause(async_pause);
00891   [result] = gs_wait(sid);
00892 end;
00893 testcount = testcount+1;
00894 if (size(result) == [0,0])
00895   fprintf('Result: Failed %s (async) test\n', fname); 
00896   failedcount = failedcount+1;
00897 elseif (max(abs(result-correct)) > accepterror)
00898   fprintf('Result: Failed %s (async) test\n', fname); 
00899   failedcount = failedcount+1;
00900 else 
00901   fprintf('Result: Success %s (async) test\n', fname); 
00902 end
00903 pause(pause_time);
00904 
00905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00906 
00907 fname = 'return_dcomplex_matrix';
00908 in=0; correct=0; result=0; sid=0;
00909 in = rand(M,N)*100 + i*rand(M,N)*100;
00910 correct = in + (1+1i);
00911 [result] = gs_call(fname, in, N, M);
00912 testcount = testcount+1;
00913 if (size(result) == [0,0])
00914   fprintf('Result: Failed %s test\n', fname);
00915   failedcount = failedcount+1;
00916 elseif (max(abs(result-correct)) > accepterror)
00917   fprintf('Result: Failed %s test\n', fname);
00918   failedcount = failedcount+1;
00919 else 
00920   fprintf('Result: Success %s test\n', fname); 
00921 end
00922 pause(pause_time);
00923 
00924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00927 
00928 fprintf('\n');
00929 if (failedcount > 0)
00930   fprintf('Result: Failed %d of %d tests in gs_totaltest\n', ...
00931           failedcount, testcount);
00932 else
00933   fprintf('Result: Passed all %d tests in gs_totaltest\n', ...
00934           testcount);
00935 end