소스 검색

使用枚举替代魔数常量;

scbc.sat2 5 년 전
부모
커밋
008307c985
1개의 변경된 파일37개의 추가작업 그리고 7개의 파일을 삭제
  1. 37 7
      SATHTTP/SATHTTP/SATHTTP.h

+ 37 - 7
SATHTTP/SATHTTP/SATHTTP.h

@@ -20,6 +20,30 @@ public:
 };
 
 namespace SATHTTP{
+	// 执行状态;
+	enum _EXECUTION_STATE_ {
+		// 未执行;
+		UNEXECUTED,
+		// 执行中;
+		INEXECUTED,
+		// 已执行;
+		EXECUTED,
+	};
+
+	// 执行结果;
+	enum _EXECUTION_RESULT_ {
+		// 无;
+		NONE,
+		// 成功;
+		SUCCESS,
+		// 失败;
+		FAIL,
+		// 异常;
+		ABNORMAL,
+		// 超时;
+		OVERTIME
+	};
+
 	//////////////////////////////////////////////////////////////////////////
 	// 通用的结构体;
 	typedef struct __ST_DEVICE__{
@@ -116,6 +140,8 @@ namespace SATHTTP{
 		void *_pExcutor;
 		// 执行状态;
 		int _nExecutionState;
+		// 执行结果;
+		int _nExecutionResult;
 		// 脚本保存路径;
 		std::string _strFileDir;
 		std::string _strFileName;	// 脚本文件名;
@@ -126,12 +152,13 @@ namespace SATHTTP{
 		std::string _strEndTime;
 		// 用例的日志文件;
 		std::string _strCaseLog;
-		__ST_CASE__()
-		{
+		__ST_CASE__() {
 			_nCaseStep = 1;
 			_pExcutor = NULL;
-			// 0表示未执行;1表示执行中;2表示执行完毕;3表示超时中断;4表示脚本文件初始化失败或异常;
-			_nExecutionState = 0;
+			// 0表示未执行;1表示执行中;2表示已执行;
+			_nExecutionState = UNEXECUTED;
+			// 默认成功;
+			_nExecutionResult = SUCCESS;
 		}
 	}STCase, *pSTCase;
 
@@ -196,6 +223,8 @@ namespace SATHTTP{
 		std::string strProgress;
 		// 任务执行状态;
 		int _nExecutionState;
+		// 任务执行结果;
+		int _nExecutionResult;
 		std::string strStartTime;
 		std::string strStopTime;
 		std::string strTaskName;
@@ -206,11 +235,12 @@ namespace SATHTTP{
 		STJob Job;
 		// 任务日志;
 		std::string _strTaskLog;
-		__ST_TASK__()
-		{
+		__ST_TASK__() {
 			_bConcurrent = false;
 			// 0表示未执行;1表示执行中;2表示执行完毕;
-			_nExecutionState = 0;
+			_nExecutionState = UNEXECUTED;
+			// 默认成功;
+			_nExecutionResult = SUCCESS;
 		}
 	}STTask, *pSTTask;