OCaml の Test::Simple を目コピしてみた その 2
続き。
OCaml では文字列の結合は ^
だけど*1、F# では +
だ。
また、OCaml での string_of_int
は F# には存在しないけど、書くとしたらこんな感じになる:
let string_of_int (n:int):string = n.ToString()
DiagnosticNode
を返す関数 2 連発:
let create_failure_footer test_count failure_count = DiagnosticNode( Diag(["Looks like you failed " + failure_count.ToString() + " tests of " + test_count.ToString() + " run."]) )
let create_count_footer test_count plan_count = DiagnosticNode( Diag(["Looks like you planed " + plan_count.ToString() + " tests but " + (if test_count < plan_count then ("only ran " + test_count.ToString()) else ("ran " + ((test_count - plan_count).ToString()) + " extra")) + " ."]) )
*1:F# でも Warning は出るものの、使うことができる