/FingTest/Script.fsx

http://github.com/sandersn/fing · F# · 49 lines · 39 code · 2 blank · 8 comment · 5 complexity · e5206d4477534db1c2fd8b7f25a150f2 MD5 · raw file

  1. // This file is a script that can be executed with the F# Interactive.
  2. // It can be used to explore and test the library project.
  3. // Note that script files will not be part of the project build.
  4. #r @"C:/Program Files (x86)/FSharpPowerPack-2.0.0.0/bin/FSharp.PowerPack.Metadata.dll"
  5. #I @"C:/src/Fing/Fing/Fing/bin/Debug/"
  6. //#r @"Y:/src/Fing/fparsec/main/Build/VS9/bin/Debug/FParsec.dll"
  7. #r @"FParsec.dll"
  8. #r @"FParsecCS.dll"
  9. //#r "Y:/src/Fing/fparsec/main/Build/VS9/bin/Debug/FParsecCS.dll"
  10. #load @"C:\src\Fing\Fing\Fing\Util.fs"
  11. #load @"C:\src\Fing\Fing\Fing\Types.fs"
  12. #load @"C:\src\Fing\Fing\Fing\ParsedTypes.fs"
  13. #load @"C:\src\Fing\Fing\Fing\FSharpTypes.fs"
  14. #load @"C:\src\Fing\Fing\Fing\CSharpTypes.fs"
  15. #load @"C:\src\Fing\Fing\Fing\Parser.fs"
  16. #load @"C:\src\Fing\Fing\Fing\Search.fs"
  17. #load @"C:\src\Fing\Fing\Fing\Fing.fs"
  18. #load @"C:\src\Fing\Fing\FingTest\TestCases.fs"
  19. // #load "Tester.fs"
  20. open Types
  21. open Util
  22. let core = Microsoft.FSharp.Metadata.FSharpAssembly.FSharpLibrary
  23. let parsec = Microsoft.FSharp.Metadata.FSharpAssembly.FromFile "C:/src/Fing/Fing/Fing/bin/Debug/FParsec.dll"
  24. let ts = seq { // Seq.choose id (seq {
  25. for e in core.Entities do
  26. for m in e.MembersOrValues do
  27. yield {Fing.ent=e; Fing.mem=m; Fing.typ=FSharpTypes.cvt m.Type |> Types.index |> FSharpTypes.debinarize}
  28. }
  29. let rawts = seq {
  30. for e in core.Entities do
  31. for m in e.MembersOrValues do
  32. yield m
  33. }
  34. let indices = 1 |> Seq.unfold (fun i -> Some(i, i+1))
  35. // look for the indices of things that fail in cvt
  36. // TODO: Turn this into a test
  37. Seq.zip indices rawts
  38. |> Seq.iter (fun (i,t) ->
  39. try
  40. (FSharpTypes.cvt t.Type) |> ignore
  41. printf "."
  42. with _ ->
  43. printfn "%d: %s . %s" i t.LogicalEnclosingEntity.DisplayName t.DisplayName
  44. )
  45. FParsec.Primitives.preturn
  46. for i,t in Seq.zip indices ts do
  47. printfn "%d. %s : %s" i (t.mem.DisplayName) (format <| Fing.tipe t)