Mercurial > octave-antonio
comparison scripts/testfun/speed.m @ 17904:817da22e58ed
speed.m: Change %!test blocks to %!xtest blocks.
* speed.m: speed tests can fail on systems with low resolution timers.
Because of this variability, make tests %!xtest blocks.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 12 Nov 2013 08:43:05 -0800 |
parents | d63878346099 |
children | 446c46af4b42 |
comparison
equal
deleted
inserted
replaced
17903:de8591a19bc6 | 17904:817da22e58ed |
---|---|
410 %! clear -f build build_orig | 410 %! clear -f build build_orig |
411 %! disp ("-----------------------"); | 411 %! disp ("-----------------------"); |
412 %! disp ("This time, the for loop is done away with entirely."); | 412 %! disp ("This time, the for loop is done away with entirely."); |
413 %! disp ("Notice how much bigger the speedup is than in example 1."); | 413 %! disp ("Notice how much bigger the speedup is than in example 1."); |
414 | 414 |
415 %!test | 415 ## FIXME: Tests are known to fail on operating systems with low resolution |
416 ## timers such as MinGW. Therefore, tests are made xtests so that false | |
417 ## failures are not reported. However, it might be better to either | |
418 ## force the tests to do more work, or use %!testif to check the OS. | |
419 %!xtest | |
416 %! [order, n, T_f1, T_f2] = speed ("airy (x)", "x = rand (n, 10)", [100, 1000]); | 420 %! [order, n, T_f1, T_f2] = speed ("airy (x)", "x = rand (n, 10)", [100, 1000]); |
417 %! assert (isstruct (order)); | 421 %! assert (isstruct (order)); |
418 %! assert (size (order), [1, 1]); | 422 %! assert (size (order), [1, 1]); |
419 %! assert (fieldnames (order), {"p"; "a"}); | 423 %! assert (fieldnames (order), {"p"; "a"}); |
420 %! assert (isnumeric (n)); | 424 %! assert (isnumeric (n)); |
422 %! assert (isnumeric (T_f1)); | 426 %! assert (isnumeric (T_f1)); |
423 %! assert (size (T_f1), size (n)); | 427 %! assert (size (T_f1), size (n)); |
424 %! assert (isnumeric (T_f2)); | 428 %! assert (isnumeric (T_f2)); |
425 %! assert (length (T_f2) > 10); | 429 %! assert (length (T_f2) > 10); |
426 | 430 |
427 %% This test is known to fail on operating systems with low resolution timers | |
428 %% such as MinGW | |
429 %!xtest | 431 %!xtest |
430 %! [order, n, T_f1, T_f2] = speed ("sum (x)", "", [100, 1000], "v = 0; for i = 1:length (x), v += x(i); endfor"); | 432 %! [order, n, T_f1, T_f2] = speed ("sum (x)", "", [100, 1000], "v = 0; for i = 1:length (x), v += x(i); endfor"); |
431 %! assert (isstruct (order)); | 433 %! assert (isstruct (order)); |
432 %! assert (size (order), [1, 1]); | 434 %! assert (size (order), [1, 1]); |
433 %! assert (fieldnames (order), {"p"; "a"}); | 435 %! assert (fieldnames (order), {"p"; "a"}); |