Version 1.11.12
[nbdkit/ericb.git] / tests / test.rb
blob063d51e39014a5e443bfac05817e5650d1377b65
1 $disk = "\0" * (1024*1024);
3 def config_complete()
4 end
6 def open(readonly)
7   return {}
8 end
10 def get_size(h)
11   return $disk.bytesize
12 end
14 def can_write(h)
15   return true
16 end
18 def can_flush(h)
19   return true
20 end
22 def is_rotational(h)
23   return false
24 end
26 def can_trim(h)
27   return true
28 end
30 def pread(h, count, offset)
31   return $disk.byteslice(offset, count)
32 end
34 def pwrite(h, buf, offset)
35   # Is this using bytes or chars? XXX
36   $disk[offset, buf.length] = buf
37 end
39 def flush(h)
40 end
42 def trim(h, count, offset)
43 end