-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathinterface.jl
47 lines (39 loc) · 1.52 KB
/
interface.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
mutable struct DummyGraph <: AbstractGraph{Int} end
mutable struct DummyDiGraph <: AbstractGraph{Int} end
mutable struct DummyEdge <: AbstractEdge{Int} end
@testset "Interface" begin
dummygraph = DummyGraph()
dummydigraph = DummyDiGraph()
dummyedge = DummyEdge()
@test_throws LightGraphs.NotImplementedError is_directed(DummyGraph)
@test_throws LightGraphs.NotImplementedError zero(DummyGraph)
for edgefun in [src, dst, Pair, Tuple, reverse]
@test_throws LightGraphs.NotImplementedError edgefun(dummyedge)
end
for edgefun2edges in [==]
@test_throws LightGraphs.NotImplementedError edgefun2edges(dummyedge, dummyedge)
end
for graphfunbasic in [
nv, ne, vertices, edges, is_directed,
edgetype, eltype
]
@test_throws LightGraphs.NotImplementedError graphfunbasic(dummygraph)
end
for graphfun1int in [
has_vertex, inneighbors, outneighbors
]
@test_throws LightGraphs.NotImplementedError graphfun1int(dummygraph, 1)
end
for graphfunedge in [
has_edge,
]
@test_throws LightGraphs.NotImplementedError graphfunedge(dummygraph, dummyedge)
@test_throws LightGraphs.NotImplementedError graphfunedge(dummygraph, 1, 2)
end
# Implementation error
impl_error = LightGraphs.NotImplementedError(edges)
@test impl_error isa LightGraphs.NotImplementedError{typeof(edges)}
io = IOBuffer()
Base.showerror(io, impl_error)
@test String(take!(io)) == "method $edges not implemented."
end # testset