|
| 1 | +(* |
| 2 | + * Copyright (C) Citrix Systems Inc. |
| 3 | + * |
| 4 | + * This program is free software; you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU Lesser General Public License as published |
| 6 | + * by the Free Software Foundation; version 2.1 only. with the special |
| 7 | + * exception on linking described in file LICENSE. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU Lesser General Public License for more details. |
| 13 | + *) |
| 14 | + |
| 15 | +open Fun |
| 16 | +open OUnit |
| 17 | +open Test_highlevel |
| 18 | + |
| 19 | +module HasBeenRemoved = Generic.Make(struct |
| 20 | + module Io = struct |
| 21 | + type input_t = Datamodel_types.lifecycle_transition list |
| 22 | + type output_t = bool |
| 23 | + |
| 24 | + let string_of_input_t input = |
| 25 | + List.map |
| 26 | + (fun (lifecycle_change, _, _) -> |
| 27 | + Datamodel_types.rpc_of_lifecycle_change lifecycle_change |
| 28 | + |> Rpc.to_string) |
| 29 | + input |
| 30 | + |> String.concat "; " |
| 31 | + |
| 32 | + let string_of_output_t = string_of_bool |
| 33 | + end |
| 34 | + |
| 35 | + let transform = Datamodel_utils.has_been_removed |
| 36 | + |
| 37 | + let tests = Datamodel_types.([ |
| 38 | + [], false; |
| 39 | + [Published, "release1", ""], false; |
| 40 | + [Removed, "release1", ""], true; |
| 41 | + [ |
| 42 | + Published, "release1", ""; |
| 43 | + Deprecated, "release2", ""; |
| 44 | + Removed, "release3", ""; |
| 45 | + ], true; |
| 46 | + [ |
| 47 | + Published, "release1", ""; |
| 48 | + Deprecated, "release2", ""; |
| 49 | + Removed, "release3", ""; |
| 50 | + Published, "release4", ""; |
| 51 | + ], false; |
| 52 | + ]) |
| 53 | +end) |
| 54 | + |
| 55 | + let test = |
| 56 | + "datamodel_utils" >::: |
| 57 | + [ |
| 58 | + "test_has_been_removed" >::: HasBeenRemoved.tests; |
| 59 | + ] |
0 commit comments