Annotation of parser3/tests/174.html, revision 1.3
1.2 misha 1: @main[][sDir;sName;hf;hf2;tList;i;k;v;iSizeBefore;iSizeAfter]
1.1 misha 2: $sDir[174]
3: $sName[data]
4:
1.2 misha 5:
1.1 misha 6: # remove previous files first
7: $tList[^file:list[$sDir]]
8: ^tList.menu{
9: ^file:delete[$sDir/$tList.name]
10: }
11:
1.2 misha 12:
13: # open hashfiles
1.1 misha 14: $hf[^hashfile::open[$sDir/$sName]]
1.2 misha 15: $hf2[^hashfile::open[$sDir/${sName}2]]
16:
17:
1.1 misha 18:
19: # check hashfile files -- it mustn't exist because of delayed opened
20: ^checkFiles[$sDir;$sName]
1.2 misha 21: ^checkFiles[$sDir;${sName}2]
22:
23:
24: # $hf2 for checking .cleanup[]
25: ^fill[$hf2]
26: $iSizeBefore(^getFileSize[$sDir;${sName}2])
27:
28:
1.1 misha 29:
30: # add item with key '0' for 2 sec
31: $hf.0[
32: $.value[zigi]
33: $.expires(2/24/60/60)
34: ]
35:
1.2 misha 36: # add more items to hf
1.1 misha 37: ^for[i](1;9){
38: $hf.[$i][=$i=]
39: }
40:
1.2 misha 41:
42:
43: <hr />
1.1 misha 44: ^checkFiles[$sDir;$sName]
1.2 misha 45: ^checkFiles[$sDir;${sName}2]
46:
1.1 misha 47:
1.2 misha 48:
49: <hr />
1.1 misha 50: ^$hf.0: '$hf.0'<br />
51:
1.2 misha 52:
53: # wait till some items expire
54: ^sleep(3)
55:
56:
57:
58:
1.1 misha 59: <hr />
1.2 misha 60: # $hf2 for checking .cleanup[]: add many items, read _file_ size, wait till items expire, .cleanup[],
61: # add the same number of items, read file size again and compare sizes.
62: # second file size must not be higher because of space used with expired items must be reused
63: ^hf2.cleanup[]
64: #^hf2.foreach[;]{}
65:
66:
67: ^fill[$hf2]
68:
69: $iSizeAfter(^getFileSize[$sDir;${sName}2])
70: ^if($iSizeAfter > $iSizeBefore){file size increased}{file size wasn't increased}
71:
72:
1.1 misha 73:
1.2 misha 74: <hr />
1.1 misha 75: ^$hf.0: '$hf.0'<br />
76:
1.2 misha 77:
1.1 misha 78:
79: <hr />
80: keys: ^hf.foreach[k;]{$k}[, ]
81:
82:
83:
84: <hr />
1.2 misha 85: ^hf.delete[1]
1.1 misha 86: ^hf.foreach[k;v]{^$hf.${k}: '$v'<br />}
87:
88:
89:
90: <hr />
1.2 misha 91: ^hf.delete[2]
1.1 misha 92: $s[^hf.foreach[k;v]{^$hf.${k}: '$v'}[<br />]]
93: $s<br />
94:
95:
96:
97: <hr />
98: # delete hashfile
99: ^hf.delete[]
100: # files mustn't exist after .delete[]
101: ^checkFiles[$sDir;$sName]
102:
1.2 misha 103:
104:
1.1 misha 105: <hr />
1.2 misha 106: # trying to read not existing hashfile (it must auto opened)
1.1 misha 107: ^hf.foreach[k;v]{^$hf.${k}: '$v'<br />}
108: # files must exist now
109: ^checkFiles[$sDir;$sName]
110:
111: @checkFiles[sDir;sName]
112: ^checkFile[$sDir/${sName}.dir]
113: ^checkFile[$sDir/${sName}.pag]
114:
115: @checkFile[sFileName]
116: $sFileName -- ^if(-f $sFileName){exist}{not exist}<br />
1.2 misha 117:
118: @getFileSize[sDir;sName][fStat]
119: $fStat[^file::stat[$sDir/${sName}.pag]]
120: $result($fStat.size)
121:
122: @fill[hf][iCount;i]
123: $iCount(150)
124: ^for[i](0;$iCount){
125: $hf.[^math:uuid[]][
126: $.value[^math:uuid[]]
127: $.expires(2/24/60/60)
128: ]
129: }
130: ^hf.release[]
E-mail: