summaryrefslogtreecommitdiffhomepage
path: root/app/tests.rb
blob: db71ff688b1d031edfc55a1a395d55924302e6ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# For advanced users:
# You can put some quick verification tests here, any method
# that starts with the `test_` will be run when you save this file.

# Here is an example test and game

# To run the test: ./dragonruby mygame --eval app/tests.rb --no-tick

class MySuperHappyFunGame
  attr_gtk

  def tick
    outputs.solids << [100, 100, 300, 300]
  end
end

def test_universe args, assert
  game = MySuperHappyFunGame.new
  game.args = args
  game.tick
  assert.true!  args.outputs.solids.length == 1, "failure: a solid was not added after tick"
  assert.false! 1 == 2, "failure: some how, 1 equals 2, the world is ending"
  puts "test_universe completed successfully"
end

puts "running tests"
$gtk.reset 100
$gtk.log_level = :off
$gtk.tests.start