# Plunit: running tests with optimized code

**URL:** <https://swi-prolog.discourse.group/t/plunit-running-tests-with-optimized-code/6215>\
**Category:** General\
**Created:** [February 13, 2023, 4:23pm UTC](https://swi-prolog.discourse.group/t/plunit-running-tests-with-optimized-code/6215 "2023-02-13T16:23:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![swi](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@swi](https://swi-prolog.discourse.group/u/swi)\
**Post date:** [February 13, 2023, 4:23pm UTC](https://swi-prolog.discourse.group/t/plunit-running-tests-with-optimized-code/6215/1 "2023-02-13T16:23:25Z")

</div>

Is there any way to allow running the plunit tests with `set_prolog_flag(optimise,true)`? The flag disables the tests, and they are do not run.

This is really useful, for example, to see the improvement in timing of the tests with optimization on.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [February 13, 2023, 5:02pm UTC](https://swi-prolog.discourse.group/t/plunit-running-tests-with-optimized-code/6215/2 "2023-02-13T17:02:02Z")

</div>

One of (with the last version)

```
:- set_test_options([load(always)]).
:- set_prolog_flag(plunit_load, always).

```

The two ways to set plunit options apply for all options. I think we should prefer the 2nd, although that will not work for other systems (YAP, SICStus) that use the library. That (and backward compatibility) is why set\_test\_options/1 is kept.
