BenchmarkBenchHelperTimesTest.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:jmh 作者:
@TearDown(Level.Trial)
    public void tearDownLATEST() { // this name ensures this is the latest teardown to run
        Assert.assertEquals("Setup1 called once", 1, countSetupRun1.get());
        Assert.assertEquals("Setup2 called once", 1, countSetupRun2.get());
        Assert.assertEquals("Setup3 called twice", 2, countSetupIteration1.get());
        Assert.assertEquals("Setup4 called twice", 2, countSetupIteration2.get());

        // These asserts make no sense for Benchmark tests
//        Assert.assertEquals("Setup5 = invocation count", countInvocations.get(), countSetupInvocation1.get());
//        Assert.assertEquals("Setup6 = invocation count", countInvocations.get(), countSetupInvocation2.get());

        Assert.assertEquals("TearDown1 called once", 1, countTearDownRun1.get());
        Assert.assertEquals("TearDown2 called once", 1, countTearDownRun2.get());
        Assert.assertEquals("TearDown3 called twice", 2, countTearDownIteration1.get());
        Assert.assertEquals("TearDown4 called twice", 2, countTearDownIteration2.get());

        // These two asserts make no sense for Benchmark tests.
//        Assert.assertEquals("TearDown5 = invocation count", countInvocations.get(), countTearDownInvocation1.get());
//        Assert.assertEquals("TearDown6 = invocation count", countInvocations.get(), countTearDownInvocation2.get());
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号