open OUnit2 let test_get_title test_ctxt = let body = " Fabien

Header

" in let title = SimpleHttp.get_http_title body in assert_equal (Some "Fabien") title let test_remove_spaces test_ctxt = let str = " foo bar baz " in let cleaned_str = Evaluate.remove_spaces (Some str) in assert_equal (Some "foo bar baz") cleaned_str let test_escape_characters text_ctx = let html_str = "I'll" in let expected = "I'll" in assert_equal expected (SimpleHttp.decode_esc_char html_str) let test_https test_ctx = let url = "https://en.wikipedia.org/wiki/Main_Page" in let title = SimpleHttp.get_http_title (SimpleHttp.get_body url) in assert_equal (Some "Wikipedia, the free encyclopedia") title (* Name the test cases and group them together *) let suite = "suite">::: [ "test get_title">:: test_get_title; "test remove_spaces">:: test_remove_spaces; "test HTML character escaping">:: test_escape_characters; "test HTTPS">:: test_https ] let () = run_test_tt_main suite