text
stringlengths
0
601k
let capnp_string_gen = let open Quickcheck . Generator . Monad_infix in Quickcheck . Generator . string_of random_char_generator >>| fun s -> Capnp . Runtime . Util . str_slice ~ stop ( ( : String . length s ) s land ( lnot 0x7 ) 0x7 ) 0x7 s
let laws_exn name trials gen fn = let config = Quickcheck . Test { . default_config with Config . test_count = trials } in Quickcheck . Test . with_sample_exn ~ config gen ~ f ( : fun s -> Base . Sequence . iter s ~ f ( : fun x -> if not ( fn x ) x then failwith name ) name )
let test_random_pack_unpack _ctx = laws_exn " unpack ( unpackpack ( unpackpackx ) unpackpackx ) unpackpackx = x " 2000 capnp_string_gen ( fun s -> let packed = Capnp . Runtime . Packing . pack_string s in let unpacked = Capnp . Runtime . Packing . unpack_string packed in unpacked = s ) s
let fragment ( s : string ) string ( add_fragment : string -> unit ) unit = let open Capnp . Runtime in let rec loop ofs = if ofs = String . length s then ( ) else let next_ofs = min ( String . length s ) s ( ofs + ( Random . int 100 ) 100 ) 100 in let ( ) = add_fragment ( Util . str_slice ~ start : ofs ~ stop : next_o...
let test_random_pack_unpack_fragmented _ctx = laws_exn " unpack ( unpackfragment ( unpackfragmentpack ( unpackfragmentpackx ) unpackfragmentpackx ) unpackfragmentpackx ) unpackfragmentpackx = x " 2000 capnp_string_gen ( fun s -> let open Capnp . Runtime in let packed = Packing . pack_string s in let packed_fragments = ...
let random_packing_suite = " random_packing " >::: [ " pack_string_unpack_string " >:: test_random_pack_unpack ; " fragmented_pack_string_unpack_string " >:: test_random_pack_unpack_fragmented ]
let message_gen = let open Quickcheck . Generator . Monad_infix in let segment_gen = capnp_string_gen >>| Bytes . unsafe_of_string in Quickcheck . Generator . int_uniform_inclusive 1 25 >>= fun length -> Quickcheck . Generator . list_with_length ~ length segment_gen >>| Capnp . BytesMessage . Message . of_storage
let test_random_serialize_deserialize _ctx = laws_exn " deserialize ( deserializefragment ( deserializefragmentserialize ( deserializefragmentserializex ) deserializefragmentserializex ) deserializefragmentserializex ) deserializefragmentserializex = x " 2000 ( Quickcheck . Generator . both message_gen capnp_string_gen...
let test_random_serialize_deserialize_fold _ctx = laws_exn " deserialize ( deserializefragment ( deserializefragmentserialize ( deserializefragmentserializex ) deserializefragmentserializex ) deserializefragmentserializex ) deserializefragmentserializex = x " 2000 ( Quickcheck . Generator . both message_gen capnp_strin...
let test_random_serialize_deserialize_fold_copyless _ctx = laws_exn " deserialize ( deserializefragment ( deserializefragmentserialize ( deserializefragmentserializex ) deserializefragmentserializex ) deserializefragmentserializex ) deserializefragmentserializex = x " 2000 ( Quickcheck . Generator . both message_gen ca...
let test_random_serialize_deserialize_packed _ctx = laws_exn " deserialize_unpack ( deserialize_unpackfragment ( deserialize_unpackfragmentserialize_pack ( deserialize_unpackfragmentserialize_packx ) deserialize_unpackfragmentserialize_packx ) deserialize_unpackfragmentserialize_packx ) deserialize_unpackfragmentserial...
let random_serialize_suite = " random_serialization_deserialization " >::: [ " serialize_deserialize_message " >:: test_random_serialize_deserialize ; " serialize_deserialize_fold_message " >:: test_random_serialize_deserialize_fold ; " serialize_deserialize_fold_copyless_message " >:: test_random_serialize_deserialize...
let verbose = ref true
let odb = let rebase fn = FilePath . make_filename [ " test " ; " data " ; " storage " ; fn ] in ref ( ODBContext . default ( rebase " incoming " ) )
let ocsigen = ref " ocsigen "
let ocsigen_args = ref [ " - s " ]
let oasis_cli = ref " false "
let oasis_db_ocsigen = ref false
let in_data_dir fn = FilePath . make_filename [ " test " ; " data " ; fn ]
let odb_run f = Lwt_main . run ( f ~ ctxt :! odb ( ) )
let long = ref true
let skip_long ( ) = skip_if ( not ! long ) " Skipping long test "
let is_port_free n = let sock = socket PF_INET SOCK_STREAM 0 in let res = setsockopt sock SO_REUSEADDR true ; try bind sock ( ADDR_INET ( inet_addr_loopback , n ) ) ; true with e -> false in close sock ; res
let ( ) = Random . self_init ( )
type ocsigen_t = { ocs_port : int ; ocs_addr : inet_addr ; ocs_rootdir : string ; ocs_command : string ; ocs_base_url : string ; }
let bracket_tmpdir f = bracket ( fun ( ) -> let dn = Filename . temp_file " oasis - db " - " . dir " in FileUtil . rm [ dn ] ; FileUtil . mkdir dn ; dn ) f ( fun dn -> OASISFileUtil . rmdir ~ ctxt ( : ODBContext . to_oasis ! odb ) dn )
module InotifyExt = let default_timeout = 60 . 0 let wait_create ~ is_file ( ? timeout = default_timeout ) topfn = let directory_exists dn = Sys . file_exists dn && Sys . is_directory dn in let fd = Inotify . init ( ) in let end_time = ( Unix . gettimeofday ( ) ) . + timeout in let existence_test ~ is_file fn = ( is_fi...
let conf_std str ocs fn = let std_conf = Printf . sprintf " < port >% s :% d </ port > < charset > utf - 8 </ charset > < logdir >% s </ logdir > < commandpipe >% s </ commandpipe > < extension findlib - package " =\ ocsigen . ext . staticmod " \/> < extension findlib - package " =\ ocsigen . ext . ocsipersist - sqlite...
let conf_oasis_db ocs fn = let args = List . fold_left ( fun acc ( vr , vl ) -> " - set " :: vr :: vl :: acc ) [ " etc / ocsigen . conf . in " ; " - o " ; fn ] [ " port " , ( string_of_inet_addr ocs . ocs_addr ) " " ^: ( ^ string_of_int ocs . ocs_port ) ; " topdir " , Sys . getcwd ( ) ; " command_pipe " , ocs . ocs_com...
let bracket_ocsigen conf pre_start f post_stop ( ) = let ( ) = skip_if ( not ! oasis_db_ocsigen ) " Ocsigen extension not available " in let port = let rec find port = if is_port_free port then port else find ( port + 1 ) in find ( ( Random . int 8000 ) + 1025 ) in let addr = inet_addr_loopback in let rootdir = let fn ...
let bracket_oasis_db pre_start f post_stop = bracket_ocsigen conf_oasis_db ( fun ocs -> List . iter ( fun nm -> FileUtil . mkdir ( Filename . concat ocs . ocs_rootdir nm ) ) [ " incoming " ; " dist " ] ; pre_start ocs ) f post_stop
let in_incoming_dir ocs fn = FilePath . make_filename [ ocs . ocs_rootdir ; " incoming " ; fn ]
let in_dist_dir ocs fn = FilePath . make_filename [ ocs . ocs_rootdir ; " dist " ; fn ]
let test_ix c = print_string " Testing IX interface . . . " ; print_newline ( ) ; print_string " Calling f 10 " ; print_newline ( ) ; c # f 10
let test_iy c = print_string " Testing IY interface . . . " ; print_newline ( ) ; print_string " Calling g 2 " ; print_newline ( ) ; let n = c # g 2 in print_string " Result is " ; print_int n ; print_newline ( ) ; print_string " Calling h " ; print_newline ( ) ; let n = c # h in print_string " Result is " ; print_stri...
let make_test ( ) = let c = Component . create_instance ( ) in begin try test_ix ( Component . use_iX ( Com . query_interface c Component . iid_iX ) ) with Com . Error ( _ , _ , s ) -> print_string " Lookup of IX interface failed : " ; print_string s ; print_newline ( ) end ; begin try test_iy ( Component . use_iY ( Co...
let _ = make_test ( ) ; Gc . full_major ( )
let tests = " Cones " >::: [ " Intersecting a cone with a ray " >:: ( fun test_ctxt -> let c = RTCCone . build ( ) in let rec run_scenarios = function | [ ] -> ( ) | ( origin , direction , t0 , t1 ) :: scenarios -> let r = RTCRay . build origin ( RTCTuple . norm direction ) in let xs = c . local_intersect c r in assert...
let x t s = RTCIntersection . build t s [ ]
let evaluate_rule table fn = let rec loop = function | [ ] -> ( ) | ( lhit , inl , inr , expect ) :: rest -> let result = fn lhit inl inr in assert_equal expect result ; loop rest in loop table
let tests = " CSG " >::: [ " CSG is created with an operation and two shapes " >:: ( fun test_ctxt -> let s1 = RTCSphere . build ( ) and s2 = RTCCube . build ( ) in let c = RTCCSG . union s1 s2 in match c . shape with | Union ( left , right , _ ) -> assert_equal ~ cmp ( ) :== left s1 ; assert_equal ~ cmp ( ) :== right ...
let tests = " Cubes " >::: [ " A ray intersects a sphere at two points " >:: ( fun test_ctxt -> let c = RTCCube . build ( ) in let rec run_scenarios = function | [ ] -> ( ) | ( origin , direction , t1 , t2 ) :: scenarios -> let r = RTCRay . build origin direction in let xs = c . local_intersect c r in assert_equal 2 ( ...
let tests = " Cylinders " >::: [ " A ray misses a cylinder " >:: ( fun test_ctxt -> let c = RTCCylinder . build ( ) in let rec run_scenarios = function | [ ] -> ( ) | ( origin , direction ) :: scenarios -> let r = RTCRay . build origin ( RTCTuple . norm direction ) in let xs = c . local_intersect c r in assert_equal 0 ...
let test_to_string ( ) = let t = { GapiDate . epoch with Netdate . year = 2011 ; month = 10 ; day = 14 ; hour = 10 ; minute = 30 ; second = 0 ; nanos = 10000000 ; zone = 120 ; } in let s = GapiDate . to_string t in assert_equal ~ printer : Fun . id " 2011 - 10 - 14T10 : 30 : 00 . 010 + 02 : 00 " s
let test_to_string_with_one_millisecond ( ) = let t = { GapiDate . epoch with Netdate . year = 2011 ; month = 10 ; day = 14 ; hour = 10 ; minute = 30 ; nanos = 1000000 ; zone = 120 ; } in let s = GapiDate . to_string t in assert_equal ~ printer : Fun . id " 2011 - 10 - 14T10 : 30 : 00 . 001 + 02 : 00 " s
let test_of_string ( ) = let t = GapiDate . of_string " 2011 - 10 - 14T10 : 30 : 00 . 000 + 02 : 00 " in assert_equal ~ printer : GapiDate . to_string { GapiDate . epoch with Netdate . year = 2011 ; month = 10 ; day = 14 ; hour = 10 ; minute = 30 ; zone = 120 ; week_day = - 1 ; } t
let test_of_string_negative_offset ( ) = let t = GapiDate . of_string " 2011 - 10 - 14T10 : 30 : 00 . 000 - 02 : 00 " in assert_equal ~ printer : GapiDate . to_string { GapiDate . epoch with Netdate . year = 2011 ; month = 10 ; day = 14 ; hour = 10 ; minute = 30 ; zone = - 120 ; week_day = - 1 ; } t
let test_of_string_utc ( ) = let t = GapiDate . of_string " 2011 - 10 - 14T10 : 30 : 00 . 010Z " in assert_equal ~ printer : GapiDate . to_string { GapiDate . epoch with Netdate . year = 2011 ; month = 10 ; day = 14 ; hour = 10 ; minute = 30 ; second = 0 ; nanos = 10000000 ; week_day = - 1 ; } t
let test_of_string_utc_with_one_millisecond ( ) = let t = GapiDate . of_string " 2011 - 10 - 14T10 : 30 : 00 . 001Z " in assert_equal ~ printer : GapiDate . to_string { GapiDate . epoch with Netdate . year = 2011 ; month = 10 ; day = 14 ; hour = 10 ; minute = 30 ; second = 0 ; nanos = 1000000 ; week_day = - 1 ; } t
let test_of_string_full_date ( ) = let t = GapiDate . of_string " 2011 - 10 - 14 " in assert_equal ~ printer : GapiDate . to_string { GapiDate . epoch with Netdate . year = 2011 ; month = 10 ; day = 14 ; hour = 0 ; minute = 0 ; second = 0 ; nanos = 0 ; week_day = - 1 ; } t
let suite = " Date test " >::: [ " test_to_string " >:: test_to_string ; " test_to_string_with_one_millisecond " >:: test_to_string_with_one_millisecond ; " test_of_string " >:: test_of_string ; " test_of_string_negative_offset " >:: test_of_string_negative_offset ; " test_of_string_utc " >:: test_of_string_utc ; " tes...
let ( ) = run_test_tt_main ~ exit ( " OASIS " >::: [ TestSelfCompile . tests ; " setup . ml has been generated with a previous version of oasis " >:: ( fun test_ctxt -> let oasis_version_for_setup_ml = let buf = Buffer . create 13 in OUnit2 . assert_command ~ chdir " . . " : ~ ctxt : test_ctxt ~ foutput ( : Stream . it...
let test_parse_directory_list ( ) = let directory_list_json = Yojson . Safe . from_file " test_data / test_directory_list . json " in let tree = GapiJson . json_to_data_model directory_list_json in let directory_list = DirectoryList . of_data_model tree in let tree ' = DirectoryList . to_data_model directory_list in le...
let test_parse_discovery_rest_service ( ) = let discovery_service_json = Yojson . Safe . from_file " test_data / test_discovery_rest_service . json " in let tree = GapiJson . json_to_data_model discovery_service_json in let discovery_service = RestDescription . of_data_model tree in let tree ' = RestDescription . to_da...
let test_parse_tasks_rest_service ( ) = let tasks_service_json = Yojson . Safe . from_file " test_data / test_tasks_rest_service . json " in let tree = GapiJson . json_to_data_model tasks_service_json in let tasks_service = RestDescription . of_data_model tree in let tree ' = RestDescription . to_data_model tasks_servi...
let test_parse_plus_rest_service ( ) = let plus_service_json = Yojson . Safe . from_file " test_data / test_plus_rest_service . json " in let tree = GapiJson . json_to_data_model plus_service_json in let plus_service = RestDescription . of_data_model tree in let tree ' = RestDescription . to_data_model plus_service in ...
let test_parse_calendar_rest_service ( ) = let calendar_service_json = Yojson . Safe . from_file " test_data / test_calendar_rest_service . json " in let tree = GapiJson . json_to_data_model calendar_service_json in let calendar_service = RestDescription . of_data_model tree in let tree ' = RestDescription . to_data_mo...
let suite = " APIs Discovery Service Model test " >::: [ " test_parse_directory_list " >:: test_parse_directory_list ; " test_parse_discovery_rest_service " >:: test_parse_discovery_rest_service ; " test_parse_tasks_rest_service " >:: test_parse_tasks_rest_service ; " test_parse_plus_rest_service " >:: test_parse_plus_...
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2013 - 04 - 01 " ] ) ; ( " Action " , [ " TestDNSAnswer " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . render (...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " TestDNSAnswerResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp TestDNSAnswerResponse . parse ) ( let open Error in BadResponse { body ; message = " Could not find well formed TestDNSAnswerResponse . " } ) with ...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None
let test_parse_file ( ) = let file_json = Yojson . Safe . from_file " test_data / test_drive_file . json " in let tree = GapiJson . json_to_data_model file_json in let file = File . of_data_model tree in let tree ' = File . to_data_model file in let json = GapiJson . data_model_to_json tree ' in assert_equal ~ printer ...
let test_parse_file_list ( ) = let file_list_json = Yojson . Safe . from_file " test_data / test_drive_file_list . json " in let tree = GapiJson . json_to_data_model file_list_json in let file_list = FileList . of_data_model tree in let tree ' = FileList . to_data_model file_list in let json = GapiJson . data_model_to_...
let test_parse_about ( ) = let about_json = Yojson . Safe . from_file " test_data / test_drive_about . json " in let tree = GapiJson . json_to_data_model about_json in let about = About . of_data_model tree in let tree ' = About . to_data_model about in let json = GapiJson . data_model_to_json tree ' in assert_equal ~ ...
let test_parse_change ( ) = let change_json = Yojson . Safe . from_file " test_data / test_drive_change . json " in let tree = GapiJson . json_to_data_model change_json in let change = Change . of_data_model tree in let tree ' = Change . to_data_model change in let json = GapiJson . data_model_to_json tree ' in assert_...
let test_parse_change_list ( ) = let change_list_json = Yojson . Safe . from_file " test_data / test_drive_change_list . json " in let tree = GapiJson . json_to_data_model change_list_json in let change_list = ChangeList . of_data_model tree in let tree ' = ChangeList . to_data_model change_list in let json = GapiJson ...
let test_parse_child_reference ( ) = let child_reference_json = Yojson . Safe . from_file " test_data / test_drive_child_reference . json " in let tree = GapiJson . json_to_data_model child_reference_json in let child_reference = ChildReference . of_data_model tree in let tree ' = ChildReference . to_data_model child_r...
let test_parse_child_list ( ) = let child_list_json = Yojson . Safe . from_file " test_data / test_drive_child_list . json " in let tree = GapiJson . json_to_data_model child_list_json in let child_list = ChildList . of_data_model tree in let tree ' = ChildList . to_data_model child_list in let json = GapiJson . data_m...
let test_parse_parent_reference ( ) = let parent_reference_json = Yojson . Safe . from_file " test_data / test_drive_parent_reference . json " in let tree = GapiJson . json_to_data_model parent_reference_json in let parent_reference = ParentReference . of_data_model tree in let tree ' = ParentReference . to_data_model ...
let test_parse_parent_list ( ) = let parent_list_json = Yojson . Safe . from_file " test_data / test_drive_parent_list . json " in let tree = GapiJson . json_to_data_model parent_list_json in let parent_list = ParentList . of_data_model tree in let tree ' = ParentList . to_data_model parent_list in let json = GapiJson ...
let test_parse_permission ( ) = let permission_json = Yojson . Safe . from_file " test_data / test_drive_permission . json " in let tree = GapiJson . json_to_data_model permission_json in let permission = Permission . of_data_model tree in let tree ' = Permission . to_data_model permission in let json = GapiJson . data...
let test_parse_permission_list ( ) = let permission_list_json = Yojson . Safe . from_file " test_data / test_drive_permission_list . json " in let tree = GapiJson . json_to_data_model permission_list_json in let permission_list = PermissionList . of_data_model tree in let tree ' = PermissionList . to_data_model permiss...
let test_parse_revision ( ) = let revision_json = Yojson . Safe . from_file " test_data / test_drive_revision . json " in let tree = GapiJson . json_to_data_model revision_json in let revision = Revision . of_data_model tree in let tree ' = Revision . to_data_model revision in let json = GapiJson . data_model_to_json t...
let test_parse_revision_list ( ) = let revision_list_json = Yojson . Safe . from_file " test_data / test_drive_revision_list . json " in let tree = GapiJson . json_to_data_model revision_list_json in let revision_list = RevisionList . of_data_model tree in let tree ' = RevisionList . to_data_model revision_list in let ...
let test_parse_app_list ( ) = let app_list_json = Yojson . Safe . from_file " test_data / test_drive_app_list . json " in let tree = GapiJson . json_to_data_model app_list_json in let app_list = AppList . of_data_model tree in let tree ' = AppList . to_data_model app_list in let json = GapiJson . data_model_to_json tre...
let suite = " Drive Data Model test " >::: [ " test_parse_file " >:: test_parse_file ; " test_parse_file_list " >:: test_parse_file_list ; " test_parse_about " >:: test_parse_about ; " test_parse_change " >:: test_parse_change ; " test_parse_change_list " >:: test_parse_change_list ; " test_parse_child_reference " >:: ...
let test_get_about ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let about , session = AboutResource . get session in assert_equal " drive # about " about . About . kind ; assert_equal about . About . etag session . GapiConversation . Session . etag ) etag
let test_get_remaining_changes ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let about , session = AboutResource . get session ~ startChangeId : 1L ~ maxChangeIdCount : 10L in assert_bool " remainingChangeIds should be greater than 0 " ( about . About . remainingChangeIds > 0L ) 0L ; T...
let test_list_changes ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let changes , session = ChangesResource . list ~ maxResults : 5 session in assert_bool " There should be at most 5 entries " ( List . length changes . ChangeList . items <= 5 ) 5 ; TestHelper . assert_not_empty " ETag ...
let test_list_files ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let files , session = FilesResource . list ~ maxResults : 5 session in assert_equal " drive # fileList " files . FileList . kind ; assert_bool " There should be at most 5 files " ( List . length files . FileList . items ...
let test_list_text_documents ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let files , session = FilesResource . list ~ q " : mimeType = ' application / vnd . oasis . opendocument . text ' " ~ maxResults : 5 session in assert_bool " All the entries should be of type document " ( List ....
let test_list_revisions ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let files , session = FilesResource . list ~ maxResults : 1 ~ q " : mimeType = ' application / vnd . google - apps . document ' " session in if List . length files . FileList . items > 0 then ( let file = List . hd f...
let test_download_revision ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let files , session = FilesResource . list ~ maxResults : 1 ~ q " : mimeType = ' application / vnd . google - apps . document ' " session in if List . length files . FileList . items > 0 then let file = List . hd ...
let test_list_permissions ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let files , session = FilesResource . list ~ maxResults : 1 ~ q " : mimeType = ' application / vnd . google - apps . document ' " session in if List . length files . FileList . items > 0 then let file = List . hd f...
let new_empty_document = { File . empty with File . title = " Legal Contract " ; mimeType = " application / vnd . google - apps . document " ; }
let test_insert_empty_document ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let file , session = FilesResource . insert new_empty_document session in let fileId = file . File . id in let ( ) = TestHelper . delay ( ) in let file , session = FilesResource . get ~ fileId session in ignor...
let test_insert_pdf ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let media_source = GapiMediaResource . create_file_resource " test_data / test . pdf " in let file , session = FilesResource . insert ~ media_source { File . empty with File . title = " test . pdf " } session in let file...
let test_update_document ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let file , session = FilesResource . insert new_empty_document session in let fileId = file . File . id in let ( ) = TestHelper . delay ( ) in let file , session = FilesResource . get ~ fileId session in let updated...
let new_empty_text_file = { File . empty with File . title = " Text document " ; mimeType = " text / plain " }
let test_update_content ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let media_source = { GapiMediaResource . source = GapiMediaResource . String " text content " ; name = " text_file . txt " ; content_type = " text / plain " ; content_length = 12L ; } in let file , session = FilesRes...
let test_delete_revision ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let media_source = { GapiMediaResource . source = GapiMediaResource . String " text content " ; name = " text_file . txt " ; content_type = " text / plain " ; content_length = 12L ; } in let file , session = FilesRe...
let test_update_revision ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let file , session = FilesResource . insert new_empty_text_file session in let fileId = file . File . id in let ( ) = TestHelper . delay ( ) in let file , session = FilesResource . get ~ fileId session in let revisi...
let test_copy_document ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let file , session = FilesResource . insert new_empty_document session in let fileId = file . File . id in let ( ) = TestHelper . delay ( ) in let file , session = FilesResource . get ~ fileId session in let copy_file...
let test_list_children ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let about , session = AboutResource . get session in let root_folder_id = about . About . rootFolderId in let children , session = ChildrenResource . list ~ maxResults : 1 ~ folderId : root_folder_id session in assert...
let test_get_permission ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let files , session = FilesResource . list ~ maxResults : 1 session in if List . length files . FileList . items > 0 then let fileId = files . FileList . items . | GapiLens . head . | File . id in let permissions , s...
let test_insert_permission ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let files , session = FilesResource . list ~ maxResults : 1 session in if List . length files . FileList . items > 0 then ( let fileId = files . FileList . items . | GapiLens . head . | File . id in let new_permis...
let test_update_permission ( ) = TestHelper . test_request TestHelper . build_oauth2_auth ( fun session -> let files , session = FilesResource . list ~ maxResults : 1 session in if List . length files . FileList . items > 0 then ( let fileId = files . FileList . items . | GapiLens . head . | File . id in let new_permis...
let suite = " Drive service test " >::: [ " test_get_about " >:: test_get_about ; " test_get_remaining_changes " >:: test_get_remaining_changes ; " test_list_changes " >:: test_list_changes ; " test_list_files " >:: test_list_files ; " test_list_text_documents " >:: test_list_text_documents ; " test_list_revisions " >:...
let assert_float_equal f1 f2 eps = let f1_abs = Float . abs f1 in let f2_abs = Float . abs f2 in let largest = max f1_abs f2_abs in let delta = Float . abs ( f1 . - f2 ) f2 in assert_bool " floating point equality " ( delta <= largest . * 3 . 0 . * eps ) eps
let assert_float32_equal f1 f2 = assert_float_equal f1 f2 1 . 192092896e - 07