benchmarks/jbox2d/src/test/java/org/apidesign/benchmark/jbox2d/JBox2dSimulationTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 05 Mar 2016 08:47:12 +0100
changeset 1885 95250e1b35de
parent 1878 126d266b2da9
permissions -rw-r--r--
Let's iterate over smaller number to pass the test on slow computers
jaroslav@381
     1
/**
jaroslav@381
     2
 * Back 2 Browser Bytecode Translator
jaroslav@1787
     3
 * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@381
     4
 *
jaroslav@381
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@381
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@381
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@381
     8
 *
jaroslav@381
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@381
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@381
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@381
    12
 * GNU General Public License for more details.
jaroslav@381
    13
 *
jaroslav@381
    14
 * You should have received a copy of the GNU General Public License
jaroslav@381
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@381
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@381
    17
 */
jaroslav@1877
    18
package org.apidesign.benchmark.jbox2d;
jaroslav@381
    19
jaroslav@381
    20
import java.io.IOException;
jaroslav@381
    21
import org.apidesign.bck2brwsr.vmtest.Compare;
jaroslav@381
    22
import org.apidesign.bck2brwsr.vmtest.VMTest;
jaroslav@381
    23
import org.testng.annotations.Factory;
jaroslav@381
    24
jaroslav@1877
    25
public class JBox2dSimulationTest {
jaroslav@1877
    26
    public JBox2dSimulationTest() {
jaroslav@1854
    27
    }
jaroslav@1854
    28
jaroslav@1878
    29
    @Compare(slowdown = 30.0)
jaroslav@1885
    30
    public int fewIter() throws IOException {
jaroslav@1877
    31
        Scene s = new Scene();
jaroslav@1885
    32
        for (int i = 0; i < 100; i++) {
jaroslav@1877
    33
            s.calculate();
jaroslav@1877
    34
        }
jaroslav@1877
    35
        return s.getWorld().getBodyCount();
jaroslav@381
    36
    }
jaroslav@381
    37
jaroslav@381
    38
    @Factory
jaroslav@381
    39
    public static Object[] create() {
jaroslav@1877
    40
        return VMTest.create(JBox2dSimulationTest.class);
jaroslav@381
    41
    }
jaroslav@381
    42
}