minimized_result


Description:

[ PrintfFormat ]
[ Version ( since = "2.16" ) ]
public void minimized_result (double minimized_quantity, string format, ...)

Report the result of a performance or measurement test.

The test should generally strive to minimize the reported quantities (smaller values are better than larger ones), this and minimized_quantity can determine sorting order for test result reports.

Example: Timers:

public static int main (string[] args) {
Test.init (ref args);

Test.add_func ("/libvaladoc/driver-0.12.x", () => {
Test.timer_start ();
for (int i = 0; i < 10000 ; i++);
double elapsed = Test.timer_elapsed ();
double last_elapsed = Test.timer_last ();
assert (elapsed == last_elapsed);

// When smaller values are better:
Test.minimized_result (elapsed, "for-test: %gsec", elapsed);

// When larger values are better:
Test.maximized_result (elapsed, "for-test: %gsec", elapsed);
});

Test.run ();
return 0;
}

valac --pkg glib-2.0 GLib.Test.minimized_result.vala

./GLib.Test.minimized_result --verbose

Parameters:

minimized_quantity

the reported value

format

the format string of the report message

...

arguments to pass to the printf function


Namespace: GLib.Test
Package: glib-2.0