コード例 #1
0
  /**
   * Test that {@link CommandOptions#getLoopTime()} returns a random time between min loop time and
   * max-random-loop-time.
   */
  public void testGetLoopTime_maxrandomset() throws ConfigurationException {
    CommandOptions co = new CommandOptions();
    ArgsOptionParser p = new ArgsOptionParser(co);
    p.parse("--max-random-loop-time", "10", "--min-loop-time", "5");

    long loop = co.getLoopTime();
    assertTrue("Loop time less than min loop time " + loop, loop >= 5);
    assertTrue("Loop time too high: " + loop, loop <= 10);
  }
コード例 #2
0
 /** Test that setting multiple --min-loop-time values results in the lowest value provided. */
 public void testGetLoopTime_least() throws ConfigurationException {
   CommandOptions co = new CommandOptions();
   ArgsOptionParser p = new ArgsOptionParser(co);
   p.parse("--min-loop-time", "0", "--min-loop-time", "5");
   assertEquals(0, co.getLoopTime());
 }