[Libguestfs] [hivex][PATCH 4/8] ocaml: Add unit test for new RLenValue type
Richard W.M. Jones
rjones at redhat.com
Thu Oct 20 11:42:44 UTC 2011
On Wed, Oct 19, 2011 at 04:53:36PM -0700, Alex Nelson wrote:
[...]
> +let () =
> + let h = Hivex.open_file ("../images/large") [] in
You don't need to put parens around the string.
> + let (data_off, data_len) = Hivex.value_data_cell_offset h (Obj.magic 297680:Hivex.value) in
You can if you want omit the parens around (data_off, data_len),
although it is a matter of preference.
> + let check_off = assert (data_off == (Obj.magic 0:Hivex.value)) in
> + let check_len = assert (data_len == 0) in
Assigning these values is useless. 'assert' doesn't return anything
(or to be very strict, it returns a unit value). If assert fails, it
throws an exception and the program quits. So just drop the whole
'let ... = [...] in' bit and just have the assert.
> + printf "Offset and length of value data for value metadata at offset 297680 is %d, %d.\n" (Obj.magic data_off:int) (Obj.magic data_len:int);
Best not to print anything in tests.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
More information about the Libguestfs
mailing list