Skip to content

Java Judge: Time_limit not working #3709

Discussion options

You must be logged in to vote

With JUnit you can indeed specify timeouts per testcase like this:

import org.junit.Assert;
import org.junit.Test;

public class TimeTest {
    @Test(timeout = 1000) // 1000 ms = 1 second
    public void fooTest() {
          foo();
    }
    @Test(timeout = 2000) // 2 seconds
    public void barTest() {
          bar();
    }
}

More information about this is on their wiki page.

But as @ninewise mentions, the runtimes on Dodona have a very high variability, so it is only good for filtering the really slow solutions (we normally multiply the expected runtime by 10).

If we want to test the time complexity of algorithms, we like to create snitch-classes which count how many times an operatio…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bmesuere
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #3708 on June 10, 2022 08:18.