Skip to content

burner/benchmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

/** This module combines randomized unittests with benchmarking capabilites.

To gain appropriate test coverage and to test unexpected inputs, randomized
unittest are a possible approach.
Additionally, they lend itself for reproducible benchmarking and performance
monitoring.

$(D randomizedtestbenchmark) is a test data generation and benchmark
package. The below example shows a simple example of how to test a function
with this package.
*/

import randomizedtestbenchmark;

bool isPrime(uint a) 
{
	uint ret;
	for (uint i = 2; i < a; ++i)
	{
		if (ret % i == 0) {
			return false;
		}
	}
	return true;
}

/// 
unittest
{
    alias bench = benchmark!(isPrime);
    BenchmarkResult result = bench.execute();
	stdoutPrinter!(Min, Mode, Quantil!0.5, Max)(result);
	gnuplot!(Min, Mode, Quantil!0.5, Max)(result);
}

About

A benchmarking and parameterized unit testing framework for D.

Resources

Stars

Watchers

Forks

Packages

No packages published