@@ -0,0 +1,2657 @@
+/**%0A * Copyright (c) 2017 Siemens AG%0A * All rights reserved.%0A * %0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted provided that the following conditions are met:%0A * %0A * 1) Redistributions of source code must retain the above copyright notice, this%0A *    list of conditions and the following disclaimer.%0A * %0A * 2) Redistributions in binary form must reproduce the above copyright notice,%0A *    this list of conditions and the following disclaimer in the documentation%0A *    and/or other materials provided with the distribution.%0A * %0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %22AS IS%22%0A * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE%0A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE%0A * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE%0A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL%0A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR%0A * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER%0A * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,%0A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE%0A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A */%0Apackage at.ac.tuwien.kr.alpha.solver;%0A%0Aimport at.ac.tuwien.kr.alpha.common.AnswerSet;%0Aimport org.junit.Test;%0A%0Aimport java.util.Set;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Apublic class SolverStatisticsTests extends AbstractSolverTests %7B%0A%0A%09@Test%0A%09public void checkStatsStringZeroChoices() %7B%0A%09%09Solver solver = getInstance(%22a.%22);%0A%09%09collectAnswerSetsAndCheckStats(solver, 1, 0, 0, 0, 0);%0A%09%7D%0A%0A%09@Test%0A%09public void checkStatsStringOneChoice() %7B%0A%09%09Solver solver = getInstance(%22a :- not b. b :- not a.%22);%0A%09%09collectAnswerSetsAndCheckStats(solver, 2, 1, 0, 1, 0);%0A%09%7D%0A%0A%09private void collectAnswerSetsAndCheckStats(Solver solver, int expectedNumberOfAnswerSets, int expectedNumberOfGuesses, int expectedNumberOfBacktracks,%0A%09%09%09int expectedNumberOfBackjumps, int expectedNumberOfMBTs) %7B%0A%09%09Set%3CAnswerSet%3E answerSets = solver.collectSet();%0A%09%09assertEquals(expectedNumberOfAnswerSets, answerSets.size());%0A%09%09if (solver instanceof SolverMaintainingStatistics) %7B%0A%09%09%09SolverMaintainingStatistics solverMaintainingStatistics = (SolverMaintainingStatistics) solver;%0A%09%09%09assertEquals(%0A%09%09%09%09%09String.format(%22g=%25d, bt=%25d, bj=%25d, mbt=%25d%22, expectedNumberOfGuesses, expectedNumberOfBacktracks, expectedNumberOfBackjumps, expectedNumberOfMBTs),%0A%09%09%09%09%09solverMaintainingStatistics.getStatisticsString());%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Add some unit tests to check solver statistics