X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=unit_test.ml;fp=unit_test.ml;h=0000000000000000000000000000000000000000;hb=4b52da1a20a4fe031930bb96d2ca46bec06dc529;hp=1f7e73213ac0201a50fff965b2c3dc28c49387fe;hpb=a223af3254fb51c279cfbccdc18c59484fdca74e;p=SXSI%2Fxpathcomp.git diff --git a/unit_test.ml b/unit_test.ml deleted file mode 100644 index 1f7e732..0000000 --- a/unit_test.ml +++ /dev/null @@ -1,58 +0,0 @@ -(******************************************************************************) -(* SXSI : XPath evaluator *) -(* Kim Nguyen (Kim.Nguyen@nicta.com.au) *) -(* Copyright NICTA 2008 *) -(* Distributed under the terms of the LGPL (see LICENCE) *) -(******************************************************************************) - - - -if Array.length (Sys.argv) <> 2 -then - begin - Printf.printf "usage: %s file.xml\n" (Sys.argv.(0)); - exit 1 - end - - -let doc = - try - Tree.load Sys.argv.(1) - with - | _ -> - ( try - Tree.parse_xml_uri Sys.argv.(1) - with - | _ ->( - - Printf.printf "Error parsing document\n"; - exit 2)) -;; - - -let full_traversal tree = - let rec loop t = - if Tree.is_node t - then - begin - (*ignore (Tree.tag t); *) - loop (Tree.node_child t); - loop (Tree.node_sibling t); - end - in loop tree -;; - - -let _ = Tag.init (Tree.tag_pool doc) - -let time f x = - let t1 = Unix.gettimeofday () in - let r = f x in - let t2 = Unix.gettimeofday () in - let t = (1000. *.(t2 -. t1)) in - Printf.eprintf " %fms\n%!" t ; - r -;; -let _ = Printf.eprintf "Timing traversal ... ";; -let _ = time (full_traversal) doc -;;