mirror of
https://github.com/Smaug123/agda-utils
synced 2025-10-06 12:08:41 +00:00
Initial commit of the bones of an unused-open-removing Agda tool
This commit is contained in:
46
AgdaUnusedOpens.Test/TestGraph.fs
Normal file
46
AgdaUnusedOpens.Test/TestGraph.fs
Normal file
@@ -0,0 +1,46 @@
|
||||
namespace AgdaUnusedOpens.Test
|
||||
|
||||
open NUnit.Framework
|
||||
open FsUnitTyped
|
||||
|
||||
open AgdaUnusedOpens
|
||||
|
||||
[<TestFixture>]
|
||||
module TestGraph =
|
||||
[<Test>]
|
||||
let ``Hard-coded example`` () =
|
||||
let g =
|
||||
"Example.dot"
|
||||
|> Utils.getResource
|
||||
|> Graph.parse
|
||||
match g with
|
||||
| Success (Graph g) ->
|
||||
let m0 = Path.make ["Sequences"]
|
||||
let m1 = Path.make ["Setoids" ; "Setoids"]
|
||||
let m2 = Path.make ["LogicalFormulae"]
|
||||
let m3 = Path.make ["Agda" ; "Primitive"]
|
||||
let m4 = Path.make ["Functions"]
|
||||
let m5 = Path.make ["Sets" ; "EquivalenceRelations"]
|
||||
let m6 = Path.make ["Numbers" ; "Naturals" ; "Definition"]
|
||||
let actual = g |> Set.ofList
|
||||
let expected =
|
||||
[
|
||||
(m0, m1)
|
||||
(m0, m2)
|
||||
(m0, m6)
|
||||
(m1, m2)
|
||||
(m1, m3)
|
||||
(m1, m4)
|
||||
(m1, m5)
|
||||
(m2, m3)
|
||||
(m4, m2)
|
||||
(m4, m3)
|
||||
(m5, m2)
|
||||
(m5, m3)
|
||||
(m5, m4)
|
||||
(m6, m2)
|
||||
]
|
||||
|> List.map (fun (a, b) -> { From = a ; To = b })
|
||||
|> Set.ofList
|
||||
actual |> shouldEqual expected
|
||||
| x -> failwithf "oh no: %O" x
|
Reference in New Issue
Block a user