00001 //------------------------------------------------------------------------------ 00002 // Lamp : Open source game middleware 00003 // Copyright (C) 2004 Junpei Ohtani ( Email : junpee@users.sourceforge.jp ) 00004 // 00005 // This library is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // This library is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with this library; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 //------------------------------------------------------------------------------ 00019 00020 /** @file 00021 * テスト失敗ヘッダ 00022 * @author Junpee 00023 */ 00024 00025 #ifndef TEST_FAILURE_H_ 00026 #define TEST_FAILURE_H_ 00027 00028 namespace LampUnit{ 00029 00030 class Test; 00031 00032 //------------------------------------------------------------------------------ 00033 /** 00034 * テスト失敗 00035 */ 00036 class TestFailure{ 00037 public: 00038 /** 00039 * コンストラクタ 00040 * @param failedTest 失敗したテスト 00041 * @param message メッセージ 00042 * @param file ファイル名 00043 * @param line 行数 00044 */ 00045 TestFailure(Test* failedTest, const Lamp::String& message, 00046 const char* file, int line); 00047 00048 /// デストラクタ 00049 virtual ~TestFailure(){} 00050 00051 /** 00052 * 失敗したテストの取得 00053 * @return 失敗したテスト 00054 */ 00055 Test* failedTest() const { return failedTest_; } 00056 00057 /** 00058 * 失敗したテストの情報を取得 00059 * @return 失敗したテストの情報 00060 */ 00061 const Lamp::String& what() const { return message_; } 00062 00063 /** 00064 * テストが失敗したファイル名の取得 00065 * @return テストが失敗したファイル名 00066 */ 00067 const char* file() const { return file_; } 00068 00069 /** 00070 * テストが失敗したファイル行数の取得 00071 * @return テストが失敗したファイル行数 00072 */ 00073 int line() const { return line_; } 00074 00075 /** 00076 * テスト失敗を文字列に変換 00077 * @return テスト失敗の文字列表記 00078 */ 00079 Lamp::String toString() const; 00080 00081 private: 00082 // コピーコンストラクタの隠蔽 00083 TestFailure(const TestFailure& copy); 00084 00085 // 代入コピーの隠蔽 00086 void operator =(const TestFailure& copy); 00087 00088 // 失敗したテスト 00089 Test* failedTest_; 00090 // メッセージ 00091 Lamp::String message_; 00092 // ファイル名 00093 const char* file_; 00094 // ファイル行数 00095 int line_; 00096 }; 00097 00098 //------------------------------------------------------------------------------ 00099 } // End of namespace LampUnit 00100 #endif // End of TEST_FAILURE_H_ 00101 //------------------------------------------------------------------------------