Annotation of parser3/tests/174.html, revision 1.4

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: 
1.4     ! moko       17: ^try-catch{ ^hashfile::open[$sDir/$sName] }
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: 
1.4     ! moko       28: $hf.temp[temp]
        !            29: ^hf.clear[]
1.1       misha      30: 
                     31: # add item with key '0' for 2 sec
                     32: $hf.0[
                     33:        $.value[zigi]
                     34:        $.expires(2/24/60/60)
                     35: ]
                     36: 
1.2       misha      37: # add more items to hf
1.1       misha      38: ^for[i](1;9){
                     39:        $hf.[$i][=$i=]
                     40: }
                     41: 
1.2       misha      42: 
1.4     ! moko       43: ^json:string[^hf.hash[]]
        !            44: 
1.2       misha      45: 
                     46: <hr />
1.1       misha      47: ^checkFiles[$sDir;$sName]
1.2       misha      48: ^checkFiles[$sDir;${sName}2]
                     49: 
1.1       misha      50: 
1.2       misha      51: 
                     52: <hr />
1.1       misha      53: ^$hf.0: '$hf.0'<br />
                     54: 
1.2       misha      55: 
                     56: # wait till some items expire
                     57: ^sleep(3)
                     58: 
                     59: 
                     60: 
                     61: 
1.1       misha      62: <hr />
1.2       misha      63: # $hf2 for checking .cleanup[]: add many items, read _file_ size, wait till items expire, .cleanup[],
                     64: # add the same number of items, read file size again and compare sizes.
                     65: # second file size must not be higher because of space used with expired items must be reused
                     66: ^hf2.cleanup[]
                     67: #^hf2.foreach[;]{}
                     68: 
                     69: 
                     70: ^fill[$hf2]
                     71: 
                     72: $iSizeAfter(^getFileSize[$sDir;${sName}2])
                     73: ^if($iSizeAfter > $iSizeBefore){file size increased}{file size wasn't increased}
                     74: 
                     75: 
1.1       misha      76: 
1.2       misha      77: <hr />
1.1       misha      78: ^$hf.0: '$hf.0'<br />
                     79: 
1.2       misha      80: 
1.1       misha      81: 
                     82: <hr />
                     83: keys: ^hf.foreach[k;]{$k}[, ]
                     84: 
                     85: 
                     86: 
                     87: <hr />
1.2       misha      88: ^hf.delete[1]
1.1       misha      89: ^hf.foreach[k;v]{^$hf.${k}: '$v'<br />}
                     90: 
                     91: 
                     92: 
                     93: <hr />
1.2       misha      94: ^hf.delete[2]
1.1       misha      95: $s[^hf.foreach[k;v]{^$hf.${k}: '$v'}[<br />]]
                     96: $s<br />
                     97: 
                     98: 
                     99: 
                    100: <hr />
                    101: # delete hashfile
                    102: ^hf.delete[]
                    103: # files mustn't exist after .delete[]
                    104: ^checkFiles[$sDir;$sName]
                    105: 
1.2       misha     106: 
                    107: 
1.1       misha     108: <hr />
1.2       misha     109: # trying to read not existing hashfile (it must auto opened)
1.1       misha     110: ^hf.foreach[k;v]{^$hf.${k}: '$v'<br />}
                    111: # files must exist now
                    112: ^checkFiles[$sDir;$sName]
                    113: 
                    114: @checkFiles[sDir;sName]
                    115: ^checkFile[$sDir/${sName}.dir]
                    116: ^checkFile[$sDir/${sName}.pag]
                    117: 
                    118: @checkFile[sFileName]
                    119: $sFileName -- ^if(-f $sFileName){exist}{not exist}<br />
1.2       misha     120: 
                    121: @getFileSize[sDir;sName][fStat]
                    122: $fStat[^file::stat[$sDir/${sName}.pag]]
                    123: $result($fStat.size)
                    124: 
                    125: @fill[hf][iCount;i]
                    126: $iCount(150)
                    127: ^for[i](0;$iCount){
                    128:        $hf.[^math:uuid[]][
                    129:                $.value[^math:uuid[]]
                    130:                $.expires(2/24/60/60)
                    131:        ]
                    132: }
                    133: ^hf.release[]

E-mail: