Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /branches/ttcomtester/tests/params_array.ttl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6434 - (hide annotations) (download)
Thu Jul 7 11:46:02 2016 UTC (7 years, 9 months ago) by doda
Original Path: trunk/tests/params_array.ttl
File size: 1973 byte(s)
システム変数 params の追加
今までの param1 ~ param9 を配列にした物

[Ttssh2-devel 3025]
・現在の param1 ~ param9 とは別に配列 params にもパラメータを格納する
・param1 ~ param9 と params の値は同期等しない。
  param1 を書き換えても params[1] は変化しない。逆も同様。
・params の最大値には制限をかけない。10 番目以降にもアクセス可能とする。

[とりあえず現在の仕様]
・param1 ~ param9 は params[1] ~ params[9] としてアクセス可能。
・params[0] にはとりあえずコマンドライン全体を入れておく (awkの$0風)
・パラメータが 10 以上有る場合は paramcnt も 10 以上の値を取る
  以前の仕様(paramcntの最大値は9)と非互換
・パラメータの数が少なくても param1 ~ param9 は常に確保されているが、
  params は paramcnt の値までしか確保されない。
  ⇒ paramcnt==3 の時に params[4] へのアクセスは Index out of range
1 doda 6434 if paramcnt <= 1 goto error
2    
3     testlabel = "testnotfound"
4    
5     ; param19 params[] が同じである事の確認
6     for i 1 paramcnt
7     if i <= 9 then
8     sprintf2 cmd "paramval = param%d" i
9     execcmnd cmd
10     strcompare params[i] paramval
11     if result <> 0 then
12     sprintf2 msg "params[%d] と param%d の値が違います" i i
13     sprintf2 tmp #10"params[%d]: '%s'" i params[i]
14     strconcat msg tmp
15     sprintf2 tmp #10"param%d: '%s'" i paramval
16     strconcat msg tmp
17     messagebox msg "エラー"
18     endif
19     endif
20     next
21    
22     ; テスト番号の検出
23     for i 2 paramcnt
24     strmatch params[i] "^test[0-9]+$"
25     if result then
26     testlabel = matchstr
27     break
28     endif
29     next
30    
31     ; テストの存在確認
32     sprintf2 cmd 'ifdefined %s' testlabel
33     execcmnd cmd
34     if result = 4 then
35     sprintf2 cmd 'goto %s' testlabel
36     execcmnd cmd
37     endif
38    
39     ; テストが未実装
40     sprintf2 msg "%s: 未実装のテストです" testlabel
41     messagebox msg "エラー"
42     goto error
43    
44     ; テスト番号が検出できない場合
45     :testnotfound
46     messagebox "テスト番号の指定がありません" "エラー"
47     goto error
48    
49     :test1
50     ; ttpmacro.exe macrofile /vxx /ixx /V /i test1
51     ; ttpmacro.exe macrofile /vxx /ixx /V /i test1 "param 7" "" param9 10 eleven
52     ;
53     ; 以下のように解釈する事にする
54     ; paramcnt: 11
55     ; params[2]: /vxx
56     ; params[3]: /ixx
57     ; params[4]: /V
58     ; params[5]: /i
59     ; params[6]: test1
60     ; params[7]: param 7
61     ; params[8]: 空文字列
62     ; params[9]: param9
63     ; params[10]: 10
64     ; params[11]: eleven
65     ;
66     if paramcnt <> 11 goto error
67     strcompare params[2] "/vxx"
68     if result <> 0 goto error
69     strcompare params[3] "/ixx"
70     if result <> 0 goto error
71     strcompare params[4] "/V"
72     if result <> 0 goto error
73     strcompare params[5] "/i"
74     if result <> 0 goto error
75     strcompare params[6] "test1"
76     if result <> 0 goto error
77     strcompare params[7] "param 7"
78     if result <> 0 goto error
79     strcompare params[8] ""
80     if result <> 0 goto error
81     strcompare params[9] "param9"
82     if result <> 0 goto error
83     strcompare params[10] "10"
84     if result <> 0 goto error
85     strcompare params[11] "eleven"
86     if result <> 0 goto error
87    
88     goto end
89    
90     :error
91     setexitcode 1
92    
93     :end
94     end

Properties

Name Value
svn:executable *

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26