Skip to content
A model generator library for use with automated test generation.
Java
Branch: develop
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
src
.travis.yml
LICENSE
README.md
build.xml
config.xml
pom.xml

README.md

Example 1

Generate 10 integers uniformly at random between -10000 and 10000

Domain.Small<Integer> ints = Domains.Sample(Domains.Int(-10000, 10000), 10);
//
for(int i=0;i!=ints.size();++i) {
	System.out.print(ints.get(i) + " ");
}
System.out.println();

Example 2

Generate 10 arrays of of lengths 1 .. 3 using above integers

Domain.Small<Integer[]> arrays = Domains.Sample(Domains.Array(1, 3, ints), 10);
//
for(int i=0;i!=arrays.size();++i) {
	System.out.print(arrays.get(i) + " ");
}
System.out.println();

Example 3

Generate products of ints and booleans using above integers

Domain.Big<Object[]> items = Domains.Product(new Domain.Big[] { ints, Domains.BOOL });
//
for(Object[] item : items) {
	System.out.print(Arrays.toString(item) + " ");
}
System.out.println();

Example 4

Generate arrays of sorted integers_

private static class Constraint implements Walker.State<Integer> {
	private final int min;
	private final int max;

	public Constraint(int min, int max) {
		this.min = min;
		this.max = max;
	}

	@Override
	public Walker<Integer> construct() {
		return Walkers.Adaptor(Domains.Int(min, max));
	}

	@Override
	public State<Integer> transfer(Integer item) {
		return item <= min ? this : new Constraint(item, max);
	}
}

Walker.State<Integer> seed = new Constraint(0,2);
Walker<List<Integer>> walker = Walkers.Product(0, 4, seed, (items) -> items);
//
for(List<Integer> item : walker) {
	System.out.println(item);
}
You can’t perform that action at this time.