| 1 |
testlabel = "testnotfound" |
| 2 |
|
| 3 |
if paramcnt = 0 then |
| 4 |
messagebox "paramcnt が 0 です" "エラー" |
| 5 |
end |
| 6 |
endif |
| 7 |
|
| 8 |
; param1〜9 と params[] が同じである事の確認 |
| 9 |
for i 1 paramcnt |
| 10 |
if i <= 9 then |
| 11 |
sprintf2 cmd "paramval = param%d" i |
| 12 |
execcmnd cmd |
| 13 |
strcompare params[i] paramval |
| 14 |
if result <> 0 then |
| 15 |
sprintf2 msg "params[%d] と param%d の値が違います" i i |
| 16 |
sprintf2 tmp #10"params[%d]: '%s'" i params[i] |
| 17 |
strconcat msg tmp |
| 18 |
sprintf2 tmp #10"param%d: '%s'" i paramval |
| 19 |
strconcat msg tmp |
| 20 |
messagebox msg "エラー" |
| 21 |
endif |
| 22 |
endif |
| 23 |
next |
| 24 |
|
| 25 |
if paramcnt = 1 then |
| 26 |
messagebox "パラメータなしで起動されました" params[1] |
| 27 |
end |
| 28 |
endif |
| 29 |
|
| 30 |
; テスト番号の検出 |
| 31 |
for i 2 paramcnt |
| 32 |
strmatch params[i] "^test[0-9]+$" |
| 33 |
if result then |
| 34 |
testlabel = matchstr |
| 35 |
break |
| 36 |
endif |
| 37 |
next |
| 38 |
|
| 39 |
; テストの存在確認 |
| 40 |
sprintf2 cmd 'ifdefined %s' testlabel |
| 41 |
execcmnd cmd |
| 42 |
if result = 4 then |
| 43 |
sprintf2 cmd 'goto %s' testlabel |
| 44 |
execcmnd cmd |
| 45 |
endif |
| 46 |
|
| 47 |
; テストが未実装 |
| 48 |
sprintf2 msg "%s: 未実装のテストです" testlabel |
| 49 |
messagebox msg "エラー" |
| 50 |
goto error |
| 51 |
|
| 52 |
; テスト番号が検出できない場合 |
| 53 |
:testnotfound |
| 54 |
messagebox "テスト番号の指定がありません" "エラー" |
| 55 |
goto error |
| 56 |
|
| 57 |
:test1 |
| 58 |
; ttpmacro.exe macrofile /vxx /ixx /V /i test1 |
| 59 |
; ttpmacro.exe macrofile /vxx /ixx /V /i test1 "param 7" "" param9 10 eleven |
| 60 |
; |
| 61 |
; 以下のように解釈する事にする |
| 62 |
; paramcnt: 11 |
| 63 |
; params[2]: /vxx |
| 64 |
; params[3]: /ixx |
| 65 |
; params[4]: /V |
| 66 |
; params[5]: /i |
| 67 |
; params[6]: test1 |
| 68 |
; params[7]: param 7 |
| 69 |
; params[8]: 空文字列 |
| 70 |
; params[9]: param9 |
| 71 |
; params[10]: 10 |
| 72 |
; params[11]: eleven |
| 73 |
; |
| 74 |
if paramcnt <> 11 goto error |
| 75 |
strcompare params[2] "/vxx" |
| 76 |
if result <> 0 goto error |
| 77 |
strcompare params[3] "/ixx" |
| 78 |
if result <> 0 goto error |
| 79 |
strcompare params[4] "/V" |
| 80 |
if result <> 0 goto error |
| 81 |
strcompare params[5] "/i" |
| 82 |
if result <> 0 goto error |
| 83 |
strcompare params[6] "test1" |
| 84 |
if result <> 0 goto error |
| 85 |
strcompare params[7] "param 7" |
| 86 |
if result <> 0 goto error |
| 87 |
strcompare params[8] "" |
| 88 |
if result <> 0 goto error |
| 89 |
strcompare params[9] "param9" |
| 90 |
if result <> 0 goto error |
| 91 |
strcompare params[10] "10" |
| 92 |
if result <> 0 goto error |
| 93 |
strcompare params[11] "eleven" |
| 94 |
if result <> 0 goto error |
| 95 |
|
| 96 |
goto end |
| 97 |
|
| 98 |
:error |
| 99 |
setexitcode 1 |
| 100 |
|
| 101 |
:end |
| 102 |
end |