Import('use')

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

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/script/script.cpp
test/util/load_exception.cpp
test/network/network.cpp
test/mugen/ast/ast.cpp
test/input/input-manager.cpp
test/input/keyboard.cpp
test/input/joystick.cpp
test/input/allegro/allegro-joystick.cpp
test/input/sdl/joystick.cpp
test/globals.cpp
test/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/windows/system.cpp
test/game/console.cpp
test/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
init.cpp
""")

stage_source = Split("""
load-stage.cpp
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/factory/shadow.cpp
test/factory/object_factory.cpp
test/factory/heart_factory.cpp
test/resource.cpp
test/nameplacer.cpp
test/game/mod.cpp
test/util/ebox.cpp
test/level/utils.cpp
test/game/select_player.cpp
test/loading.cpp
test/network/messages.cpp
test/util/gradient.cpp
test/openbor/mod.cpp
test/openbor/util.cpp
test/openbor/pack-reader.cpp
test/object/item.cpp
test/object/attack.cpp
test/object/projectile.cpp
test/object/animation_event.cpp
test/object/animation_trail.cpp
test/object/animation.cpp
test/object/gib.cpp
test/object/cat.cpp
test/object/actor.cpp
test/object/object_nonattack.cpp
test/object/enemy.cpp
test/object/draw-effect.cpp
test/object/character.cpp
test/object/display_character.cpp
test/object/heart.cpp
test/object/stimulation.cpp
test/object/health_stimulation.cpp
test/object/object.cpp
test/object/object_attack.cpp
test/object/network_player.cpp
test/object/network_character.cpp
test/util/sound.cpp
test/mugen/ast/ast.cpp
test/script/script.cpp
test/util/load_exception.cpp
test/network/network.cpp
test/input/input-manager.cpp
test/input/keyboard.cpp
test/input/joystick.cpp
test/input/allegro/allegro-joystick.cpp
test/input/sdl/joystick.cpp
test/globals.cpp
test/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/game/world.cpp
test/game/console.cpp
test/exceptions/exception.cpp
test/util/thread.cpp
test/util/events.cpp
test/factory/font_render.cpp
test/factory/font_factory.cpp
test/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
""")

stage_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/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
""")

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

# x.append(testEnv.Program('load', load_source + most_game_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')
