//------------------------------------------------------------------------------
// Lamp : Open source game middleware
// Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//------------------------------------------------------------------------------

/** @file
 * Lampの全テスト実装
 * @author Junpee
 */


#include "Test/stdafx.h"
#include "Test/LampAllTests.h"
#include <Core/Utility/Timer.h>
#include <LampAll.h>

int _tmain(int argc, _TCHAR* argv[]){
	//--------------------------------------------------------------------------
	// システム初期化
	//--------------------------------------------------------------------------
	// Lamp初期化
	LampCore::initialize();
	{
		Timer::Tick startTime = Timer::getTick();

		// D3DX Info 出力
		D3DXMATRIX __declspec(align(16)) d3dMtx;
		D3DXMatrixScaling(&d3dMtx, 1.f, 1.f, 1.f);

		// テスト初期化
		TestStringListener listener;
		TestResult result;
		result.addListener(&listener);
		LampAllTests allTest;

		//--------------------------------------------------------------------------
		// テスト実行
		listener.print("------------------------------"
			"-------------------------------------------------\n");
		listener.printFormat(
			"テスト開始  テスト数 %d\n", allTest.getCountTestCases());
		allTest.run(&result);

		//--------------------------------------------------------------------------
		// 時間表示
		float time = Timer::getInterval(startTime);
		listener.printFormat("\nテスト終了 %.3fms  %d / %d (失敗 / 実行数)\n",
			time, result.getFailureCount(), result.getRunCount());
		if(result.wasSuccessful()){
			listener.print("テストは無事終了しました。\n");
		}else{
			listener.print("##############################"
				"#################################################\n");
			listener.print("テストは失敗しました。\n");
		}
		listener.print("------------------------------"
			"-------------------------------------------------\n");
	}
	//--------------------------------------------------------------------------
	// Lamp後始末
	LampCore::finalize();

	return 0;
}
