-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathblockdels.tcl
69 lines (57 loc) · 1.13 KB
/
blockdels.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Blocked view deletion tests
# jcw, 26-3-2002
if [catch {package require Mk4tcl}] {
catch {load ./Mk4tcl.so mk4tcl}
catch {load ./Mk4tcl_d.dll mk4tcl}
}
proc fill {n} {
$::bv size 0
set ::vv {}
for {set i 0} {$i < $n} {incr i} {
$::bv insert end a $i
lappend ::vv $i
}
}
proc remove {from {count 1}} {
incr count -1
$::bv delete $from [incr count $from]
set ::vv [lreplace $::vv $from $count]
}
proc check {} {
set pos 0
foreach y $::vv {
set x [$::bv get $pos a]
if {$x != $y} { error "pos $pos is $x, should be $y" }
incr pos
}
}
mk::file open db
mk::view layout db.v {{_B {a:I}}}
set bv [[mk::view open db.v] view blocked]
for {set j 1} {$j < 6} {incr j} {
fill 2000
remove 996 $j
check
}
for {set j 988} {$j < 1001} {incr j} {
fill 2000
remove $j 10
check
}
for {set j 1100} {$j < 1110} {incr j} {
fill 3000
remove 985 $j
check
}
set total 50000
fill $total
foreach x {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
puts -nonewline stderr "$x "
for {set i [expr {$total-1025}]} {$i > 0} {incr i -1000} {
remove $i 45
remove $i 45
incr total -90
}
check
}
puts stderr OK