<commit_before>(*
 * Copyright (C) 2006-2012 Citrix Systems Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; version 2.1 only. with the special
 * exception on linking described in file LICENSE.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *)

open API
open Fun
open OUnit

(** Utility functions *)
let id (x : 'a) : 'a = x

let string_of_string_list strings =
	Printf.sprintf "[%s]"
		(String.concat "; " strings)

let string_of_string_map map =
	Printf.sprintf "[%s]"
		(List.map (fun (k, v) -> k ^ ": " ^ v) map |> String.concat "; ")

let string_of_opt string_of = function
	| None -> "None"
	| Some x -> Printf.sprintf "Some %s" (string_of x)

let string_of_string_opt = string_of_opt (fun x -> x)

let skip str = skip_if true str
let make_uuid () = Uuid.string_of_uuid (Uuid.make_uuid ())

let assert_raises_api_error (code : string) ?(args : string list option) (f : unit -> 'a) : unit =
	try
		f ();<commit_msg>Add generic string_of_list function to Test_common<commit_after>(*
 * Copyright (C) 2006-2012 Citrix Systems Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; version 2.1 only. with the special
 * exception on linking described in file LICENSE.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *)

open API
open Fun
open OUnit

(** Utility functions *)
let id (x : 'a) : 'a = x

let string_of_list string_of list =
	Printf.sprintf "[%s]"
		(String.concat "; " (List.map string_of list))

let string_of_string_list strings =
	string_of_list (fun x -> x) strings

let string_of_string_map map =
	string_of_list (fun (k, v) -> Printf.sprintf "%s: %s" k v) map

let string_of_opt string_of = function
	| None -> "None"
	| Some x -> Printf.sprintf "Some %s" (string_of x)

let string_of_string_opt = string_of_opt (fun x -> x)

let skip str = skip_if true str
let make_uuid () = Uuid.string_of_uuid (Uuid.make_uuid ())

let assert_raises_api_error (code : string) ?(args : string list option) (f : unit -> 'a) : unit =
	try
		f ();
{'fraction_non_alphanumeric': 0.09811320754716982, 'fraction_numerical': 0.007547169811320755, 'mean_word_length': 3.9092592592592594, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7026249', 'n_tokens_mistral': 851, 'n_tokens_neox': 829, 'n_words': 346}