Import('use')

testEnv = use.Clone()
testEnv.VariantDir('test', '../../')
testEnv.VariantDir('common', '../common')

more_source = []
def addObjects(files):
    more_source.extend(files)

use = testEnv
SConscript('../../mugen/parser/SConstruct', exports = ['use', 'addObjects'], variant_dir = 'test-parser')

most_game_source = Split("""
test/mugen/character.cpp
test/mugen/helper.cpp
test/mugen/evaluator.cpp
test/mugen/compiler.cpp
test/mugen/state-controller.cpp
test/mugen/stage.cpp
test/mugen/sprite.cpp
test/mugen/sound.cpp
test/mugen/exception.cpp
test/mugen/util.cpp
test/mugen/animation.cpp
test/mugen/item-content.cpp
test/mugen/item.cpp
test/mugen/command.cpp
test/mugen/background.cpp
test/mugen/parse-cache.cpp
test/gui/rectarea.cpp
test-parser/air.cpp
test-parser/def.cpp
test-parser/cmd.cpp
test/object/object.cpp
test/object/object_attack.cpp
test/util/sound.cpp
test/paintown-engine/script/script.cpp
test/util/load_exception.cpp
test/util/network/network.cpp
test/mugen/ast/ast.cpp
test/util/input/input-manager.cpp
test/util/input/input-source.cpp
test/util/input/keyboard.cpp
test/util/input/joystick.cpp
test/util/input/allegro/allegro-joystick.cpp
test/util/input/sdl/joystick.cpp
test/globals.cpp
test/util/debug.cpp
test/menu/font-info.cpp
test/configuration.cpp
test/util/events.cpp
test/util/thread.cpp
test/util/bitmap.cpp
test/util/timedifference.cpp
test/util/funcs.cpp
test/util/font.cpp
test/util/ftalleg.cpp
test/util/regex.cpp
test/util/system.cpp
test/util/file-system.cpp
test/util/message-queue.cpp
test/util/token.cpp
test/util/tokenreader.cpp
test/util/token_exception.cpp
test/exceptions/exception.cpp
test/factory/font_render.cpp
test/factory/font_factory.cpp
test/util/windows/system.cpp
test/util/input/text-input.cpp
test/util/console.cpp
test/paintown-engine/game/world.cpp
test/mugen/config.cpp
test/mugen/characterhud.cpp
test/mugen/behavior.cpp
test/gui/fadetool.cpp
test/mugen/font.cpp
test/mugen/reader.cpp
test/mugen/section.cpp

""")

load_source = Split("""
load.cpp
common/init.cpp
""")

stage_source = Split("""
load-stage.cpp
common/init.cpp
test/mugen/stage.cpp
test/mugen/character.cpp
test/mugen/helper.cpp
test/mugen/evaluator.cpp
test/mugen/compiler.cpp
test/mugen/sprite.cpp
test/mugen/state-controller.cpp
test/mugen/font.cpp
test/mugen/sound.cpp
test/mugen/exception.cpp
test/mugen/util.cpp
test/mugen/animation.cpp
test/mugen/background.cpp
test/mugen/item-content.cpp
test/mugen/item.cpp
test/mugen/parse-cache.cpp
test/mugen/characterhud.cpp
test/gui/rectarea.cpp
test/menu/font-info.cpp
test-parser/air.cpp
test-parser/def.cpp
test-parser/cmd.cpp
test/factory/collector.cpp
test/paintown-engine/factory/shadow.cpp
test/paintown-engine/factory/object_factory.cpp
test/paintown-engine/factory/heart_factory.cpp
test/util/resource.cpp
test/nameplacer.cpp
test/paintown-engine/game/mod.cpp
test/util/ebox.cpp
test/paintown-engine/level/utils.cpp
test/paintown-engine/game/select_player.cpp
test/loading.cpp
test/util/messages.cpp
test/util/gradient.cpp
test/openbor/mod.cpp
test/openbor/util.cpp
test/openbor/pack-reader.cpp
test/paintown-engine/object/item.cpp
test/paintown-engine/object/attack.cpp
test/paintown-engine/object/projectile.cpp
test/paintown-engine/object/animation_event.cpp
test/paintown-engine/object/animation_trail.cpp
test/paintown-engine/object/animation.cpp
test/paintown-engine/object/gib.cpp
test/paintown-engine/object/cat.cpp
test/paintown-engine/object/actor.cpp
test/paintown-engine/object/object_nonattack.cpp
test/paintown-engine/object/enemy.cpp
test/paintown-engine/object/draw-effect.cpp
test/paintown-engine/object/character.cpp
test/paintown-engine/object/display_character.cpp
test/paintown-engine/object/heart.cpp
test/paintown-engine/object/stimulation.cpp
test/paintown-engine/object/object.cpp
test/paintown-engine/object/object_attack.cpp
test/paintown-engine/object/network_player.cpp
test/paintown-engine/object/network_character.cpp
test/util/sound.cpp
test/mugen/ast/ast.cpp
test/paintown-engine/script/script.cpp
test/util/load_exception.cpp
test/util/network/network.cpp
test/util/input/input-manager.cpp
test/util/input/input-source.cpp
test/util/input/keyboard.cpp
test/util/input/joystick.cpp
test/util/input/allegro/allegro-joystick.cpp
test/util/input/sdl/joystick.cpp
test/globals.cpp
test/util/debug.cpp
test/configuration.cpp
test/util/bitmap.cpp
test/util/timedifference.cpp
test/util/funcs.cpp
test/util/font.cpp
test/util/ftalleg.cpp
test/util/regex.cpp
test/util/system.cpp
test/util/file-system.cpp
test/util/message-queue.cpp
test/util/token.cpp
test/util/tokenreader.cpp
test/util/token_exception.cpp
test/paintown-engine/game/world.cpp
test/util/console.cpp
test/util/input/text-input.cpp
test/exceptions/exception.cpp
test/util/thread.cpp
test/util/events.cpp
test/factory/font_render.cpp
test/factory/font_factory.cpp
test/util/windows/system.cpp
test/mugen/config.cpp
test/mugen/behavior.cpp
test/gui/fadetool.cpp
test/mugen/reader.cpp
test/mugen/command.cpp
test/mugen/section.cpp
""")

full_source = most_game_source + Split("""
load-full.cpp
common/init.cpp
test/factory/collector.cpp
test/paintown-engine/factory/shadow.cpp
test/paintown-engine/factory/object_factory.cpp
test/paintown-engine/factory/heart_factory.cpp
test/paintown-engine/object/item.cpp
test/paintown-engine/object/attack.cpp
test/paintown-engine/object/projectile.cpp
test/paintown-engine/object/animation_event.cpp
test/paintown-engine/object/animation_trail.cpp
test/paintown-engine/object/animation.cpp
test/paintown-engine/object/gib.cpp
test/paintown-engine/object/cat.cpp
test/paintown-engine/object/actor.cpp
test/paintown-engine/object/object_nonattack.cpp
test/paintown-engine/object/enemy.cpp
test/util/messages.cpp
test/util/gradient.cpp
test/util/loading.cpp
test/paintown-engine/game/select_player.cpp
test/openbor/util.cpp
test/openbor/pack-reader.cpp
test/util/resource.cpp
test/openbor/mod.cpp
test/util/ebox.cpp
test/paintown-engine/level/utils.cpp
test/paintown-engine/object/draw-effect.cpp
test/paintown-engine/object/character.cpp
test/paintown-engine/object/display_character.cpp
test/paintown-engine/object/heart.cpp
test/paintown-engine/game/mod.cpp
test/paintown-engine/object/stimulation.cpp
test/paintown-engine/object/network_player.cpp
test/paintown-engine/object/network_character.cpp
test/nameplacer.cpp
""")

stage_source.append(testEnv.Peg('test/openbor/data.peg'))
full_source.append(testEnv.Peg('test/openbor/data.peg'))

ast_source = Split("""
test-parser/air.cpp
test-parser/def.cpp
test-parser/cmd.cpp
test/util/token.cpp
test/util/tokenreader.cpp
test/util/debug.cpp
test/util/system.cpp
test/util/token_exception.cpp
test/util/timedifference.cpp
test/mugen/exception.cpp
test/mugen/ast/ast.cpp
test/exceptions/exception.cpp
""")

load_source = Split("""
common/init.cpp
load.cpp
test/util/file-system.cpp
test/util/bitmap.cpp
test/util/debug.cpp
test/exceptions/exception.cpp
test/globals.cpp
test/factory/font_factory.cpp
test/factory/font_render.cpp
test/paintown-engine/object/draw-effect.cpp
test/paintown-engine/object/gib.cpp
test/paintown-engine/object/object.cpp
test/paintown-engine/object/object_attack.cpp
test/paintown-engine/object/character.cpp
test/paintown-engine/object/player.cpp
test/paintown-engine/script/script.cpp
test/util/gui/animation.cpp
test/util/gui/coordinate.cpp
test/util/token_exception.cpp
test/util/tokenreader.cpp
test/util/token.cpp
test/paintown-engine/factory/shadow.cpp
test/util/loading.cpp
test/util/gradient.cpp
test/paintown-engine/game/select_player.cpp
test/util/messages.cpp
test/paintown-engine/object/object_nonattack.cpp
test/mugen/parse-cache.cpp
test/mugen/ast/ast.cpp
test/mugen/sound.cpp
test/mugen/item-content.cpp
test/mugen/item.cpp
test/mugen/animation.cpp
test/mugen/sprite.cpp
test/mugen/util.cpp
test/mugen/config.cpp
test/paintown-engine/object/stimulation.cpp
test/paintown-engine/object/item.cpp
test/paintown-engine/object/network_player.cpp
test/paintown-engine/object/network_character.cpp
test/paintown-engine/object/actor.cpp
test/paintown-engine/object/enemy.cpp
test/paintown-engine/object/cat.cpp
test/paintown-engine/object/heart.cpp
test/util/resource.cpp
test/paintown-engine/factory/object_factory.cpp
test/paintown-engine/factory/heart_factory.cpp
test/factory/collector.cpp
test/paintown-engine/object/display_character.cpp
test/menu/font-info.cpp
test/mugen/exception.cpp
test/paintown-engine/object/player-common.cpp
test/nameplacer.cpp
test/paintown-engine/object/animation.cpp
test/paintown-engine/object/animation_trail.cpp
test/configuration.cpp
test/util/input/keyboard.cpp
test/paintown-engine/level/utils.cpp
test/paintown-engine/level/blockobject.cpp
test/util/network/network.cpp
test/util/audio.cpp
test/openbor/mod.cpp
test/openbor/pack-reader.cpp
test/paintown-engine/game/mod.cpp
test/util/events.cpp
test/util/input/allegro/allegro-joystick.cpp
test/util/input/joystick.cpp
test/openbor/util.cpp
test/util/input/sdl/joystick.cpp
test/util/input/input-manager.cpp
test/util/input/input-source.cpp
test/paintown-engine/object/attack.cpp
test/paintown-engine/object/projectile.cpp
test/paintown-engine/object/animation_event.cpp
test/util/ebox.cpp
test/util/load_exception.cpp
test/util/timedifference.cpp
test/util/regex.cpp
test/util/sound.cpp
test/util/system.cpp
test-parser/air.cpp
test-parser/def.cpp
test-parser/cmd.cpp
test/util/ftalleg.cpp
test/util/font.cpp
test/util/thread.cpp
test/util/funcs.cpp
test/util/message-queue.cpp
""")

load_source.append(testEnv.Peg('test/openbor/data.peg'))

game_source = Split("""
common/init.cpp
game.cpp
test/util/file-system.cpp
test/util/bitmap.cpp
test/util/debug.cpp
test/exceptions/exception.cpp
test/globals.cpp
test/factory/font_factory.cpp
test/factory/font_render.cpp
test/paintown-engine/object/draw-effect.cpp
test/paintown-engine/object/gib.cpp
test/paintown-engine/object/object.cpp
test/paintown-engine/object/object_attack.cpp
test/paintown-engine/object/character.cpp
test/paintown-engine/object/player.cpp
test/paintown-engine/script/script.cpp
test/util/token_exception.cpp
test/util/tokenreader.cpp
test/util/token.cpp
test/paintown-engine/factory/shadow.cpp
test/util/loading.cpp
test/util/gradient.cpp
test/paintown-engine/game/select_player.cpp
test/util/gui/animation.cpp
test/util/gui/coordinate.cpp
test/util/messages.cpp
test/paintown-engine/object/object_nonattack.cpp
test/mugen/parse-cache.cpp
test/mugen/ast/ast.cpp
test/mugen/sound.cpp
test/mugen/item-content.cpp
test/mugen/item.cpp
test/mugen/animation.cpp
test/mugen/sprite.cpp
test/mugen/util.cpp
test/mugen/config.cpp
test/paintown-engine/object/stimulation.cpp
test/paintown-engine/object/item.cpp
test/paintown-engine/object/network_player.cpp
test/paintown-engine/object/network_character.cpp
test/paintown-engine/object/actor.cpp
test/paintown-engine/object/enemy.cpp
test/paintown-engine/object/cat.cpp
test/paintown-engine/object/heart.cpp
test/util/resource.cpp
test/paintown-engine/factory/object_factory.cpp
test/paintown-engine/factory/heart_factory.cpp
test/factory/collector.cpp
test/paintown-engine/object/display_character.cpp
test/paintown-engine/object/effect.cpp
test/menu/font-info.cpp
test/mugen/exception.cpp
test/paintown-engine/object/player-common.cpp
test/nameplacer.cpp
test/paintown-engine/object/animation.cpp
test/paintown-engine/object/animation_trail.cpp
test/configuration.cpp
test/util/input/keyboard.cpp
test/paintown-engine/environment/atmosphere.cpp
test/paintown-engine/trigger/trigger.cpp
test/paintown-engine/level/scene.cpp
test/util/music.cpp
test/util/music-player.cpp
test/util/audio.cpp
test/paintown-engine/level/block.cpp
test/paintown-engine/level/blockobject.cpp
test/paintown-engine/level/random-scene.cpp
test/paintown-engine/level/utils.cpp
test/paintown-engine/level/cacher.cpp
test/util/network/network.cpp
test/openbor/mod.cpp
test/openbor/pack-reader.cpp
test/paintown-engine/game/mod.cpp
test/paintown-engine/game/adventure_world.cpp
test/paintown-engine/game/world.cpp
test/util/events.cpp
test/util/input/allegro/allegro-joystick.cpp
test/util/input/joystick.cpp
test/openbor/util.cpp
test/util/input/sdl/joystick.cpp
test/util/input/input-manager.cpp
test/util/input/input-source.cpp
test/paintown-engine/object/attack.cpp
test/paintown-engine/object/projectile.cpp
test/paintown-engine/object/animation_event.cpp
test/util/ebox.cpp
test/util/load_exception.cpp
test/util/timedifference.cpp
test/util/regex.cpp
test/util/sound.cpp
test/util/system.cpp
test-parser/air.cpp
test-parser/def.cpp
test-parser/cmd.cpp
test/util/ftalleg.cpp
test/util/font.cpp
test/util/thread.cpp
test/util/funcs.cpp
test/util/message-queue.cpp
""")

game_source.append(testEnv.Peg('test/openbor/data.peg'))

x = []
def makeTest(name, files):
    test = testEnv.Program(name, files)
    x.append(test)
    testEnv.AddPostAction(test, testEnv['PAINTOWN_TEST'])

makeTest('load', load_source)
makeTest('game', game_source)

# x.append(testEnv.Program('load', load_source + most_game_source))
#makeTest('load-full', full_source)
#makeTest('load', load_source + most_game_source)
#makeTest('serialize', ['serialize.cpp'] + ast_source)
#x.append(testEnv.Program('load-stage', stage_source))
#x.append(testEnv.Program('palette', ['palette.cpp', 'test/debug.cpp']))
Return('x')
