Пример #1
0
def test_dynamic_builds_per_hour():
    m = Model(builds_per_hour=100.0, build_run_time=10, sec_per_tick=3600,
              initial_builder_count=100, builder_boot_time=0, builds_per_hour_fn=Model.SINE)
    assert m.current_builds_per_hour() == 0.0
    m.advance(12)
    print 'ticks:', m.ticks
    print 'per hour:', m.current_builds_per_hour()
    assert m.current_builds_per_hour() == 100.0
    m.advance(12)
    assert m.current_builds_per_hour() == 0.0
Пример #2
0
def test_dynamic_builds_per_hour():
    m = Model(builds_per_hour=100.0,
              build_run_time=10,
              sec_per_tick=3600,
              initial_builder_count=100,
              builder_boot_time=0,
              builds_per_hour_fn=Model.SINE)
    assert m.current_builds_per_hour() == 0.0
    m.advance(12)
    print 'ticks:', m.ticks
    print 'per hour:', m.current_builds_per_hour()
    assert m.current_builds_per_hour() == 100.0
    m.advance(12)
    assert m.current_builds_per_hour() == 0.0
Пример #3
0
def test_fixed_builds_per_hour():
    m = Model(ticks=3600,
              builds_per_hour=100.0,
              build_run_time=10,
              sec_per_tick=10,
              initial_builder_count=100,
              builder_boot_time=0)
    assert m.current_builds_per_hour() == 100.0
Пример #4
0
def test_fixed_builds_per_hour():
    m = Model(ticks=3600, builds_per_hour=100.0, build_run_time=10, sec_per_tick=10,
              initial_builder_count=100, builder_boot_time=0)
    assert m.current_builds_per_hour() == 100.0