Je suis en train de faire tester pour cette fonctionFsCheck NUnit. Tests avec l'état
let extract_one_rule (rule:Rule.t<'a,'b>) =
let rec expand = function
|PAlt (a,b) -> expand a @ expand b
|PSeq (a,b) -> let wrap = List.map (fun x -> (x.rule, fun r -> {x with rule = r})) a
|> List.unzip
in
let rec gen = function
| hd::tl -> [for x in hd -> x :: (gen tl |> List.concat)]
| [] -> []
in
fst wrap |> List.map expand |> gen
|> List.map (fun x -> PSeq ((List.map2 (|>) x (snd wrap)),b))
|PRef _
|PLiteral _
|PToken _ as t -> [t]
| _ -> (System.Console.WriteLine("incorrect tree for alternative expanding!")
; failwith "incorrect tree for alternative expanding!")
in
expand rule.body |> List.map (fun x -> {rule with body = x})
utilisant FsCheck donc j'ai ce
let ExpandAlterTest(t : Rule.t<Source.t,Source.t>) = convertToMeta t |> List.forall (fun x -> ruleIsAfterEBNF x)
mais i'l sauf exception "arbre incorrect pour l'expansion alternative!" mais quand j'utilise smth comme ça
let ExpandAlterTest(t : Rule.t<Source.t,Source.t>) = (correctForAlExp t.body) ==> lazy (convertToMeta t |> List.forall (fun x -> ruleIsAfterEBNF x))
NUnit ne cesse pas de fonctionner Pourquoi il peut être?