Mercurial > hg > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
19327:dc51f26f0db5 | 19328:10c57204fd72 |
---|---|
85 } | 85 } |
86 | 86 |
87 /* | 87 /* |
88 ## Must always report at least 1 cpu available | 88 ## Must always report at least 1 cpu available |
89 %!assert (nproc () >= 1); | 89 %!assert (nproc () >= 1); |
90 %!assert (nproc ("all") >= 1); | |
91 %!assert (nproc ("current") >= 1); | |
92 | |
93 %!test | |
94 %! c = nproc ("current"); | |
95 %! unwind_protect | |
96 %! old_val = getenv ("OMP_NUM_THREADS"); | |
97 %! new_val = c + 1; | |
98 %! setenv ("OMP_NUM_THREADS", num2str (new_val)); | |
99 %! assert (nproc ("overridable"), new_val); | |
100 %! unwind_protect_cleanup | |
101 %! if (! isempty (old_val)) | |
102 %! setenv ("OMP_NUM_THREADS", old_val); | |
103 %! endif | |
104 %! end_unwind_protect | |
105 | |
106 %!error nproc ("no_valid_option"); | |
90 */ | 107 */ |