Mercurial > hg > octave-nkf
diff libinterp/corefcn/nproc.cc @ 19328:10c57204fd72
nproc.cc: codesprint: adding tests
author | Andreas Weber <andy.weber.aw@gmail.com> |
---|---|
date | Sun, 21 Sep 2014 21:32:31 +0200 |
parents | 175b392e91fe |
children | b5c03bcc640a |
line wrap: on
line diff
--- a/libinterp/corefcn/nproc.cc +++ b/libinterp/corefcn/nproc.cc @@ -87,4 +87,21 @@ /* ## Must always report at least 1 cpu available %!assert (nproc () >= 1); +%!assert (nproc ("all") >= 1); +%!assert (nproc ("current") >= 1); + +%!test +%! c = nproc ("current"); +%! unwind_protect +%! old_val = getenv ("OMP_NUM_THREADS"); +%! new_val = c + 1; +%! setenv ("OMP_NUM_THREADS", num2str (new_val)); +%! assert (nproc ("overridable"), new_val); +%! unwind_protect_cleanup +%! if (! isempty (old_val)) +%! setenv ("OMP_NUM_THREADS", old_val); +%! endif +%! end_unwind_protect + +%!error nproc ("no_valid_option"); */