|
248 | 248 | end
|
249 | 249 |
|
250 | 250 | @testset "Graphs.jl integration" begin
|
251 |
| - g = GNNGraph(erdos_renyi(10, 20)) |
| 251 | + g = GNNGraph(erdos_renyi(10, 20), graph_type=GRAPH_T) |
252 | 252 | @test g isa Graphs.AbstractGraph
|
253 | 253 | end
|
| 254 | + |
| 255 | + @testset "==" begin |
| 256 | + g1 = rand_graph(5, 6, ndata=rand(5), edata=rand(6), graph_type=GRAPH_T) |
| 257 | + @test g1 == g1 |
| 258 | + @test g1 == deepcopy(g1) |
| 259 | + @test g1 !== deepcopy(g1) |
| 260 | + |
| 261 | + g2 = GNNGraph(g1, graph_type=GRAPH_T) |
| 262 | + @test g1 == g2 |
| 263 | + @test g1 === g2 # this is true since GNNGraph is immutable |
| 264 | + |
| 265 | + g2 = GNNGraph(g1, ndata=rand(5), graph_type=GRAPH_T) |
| 266 | + @test g1 != g2 |
| 267 | + @test g1 !== g2 |
| 268 | + |
| 269 | + g2 = GNNGraph(g1, edata=rand(6), graph_type=GRAPH_T) |
| 270 | + @test g1 != g2 |
| 271 | + @test g1 !== g2 |
| 272 | + end |
| 273 | + |
| 274 | + @testset "hash" begin |
| 275 | + g1 = rand_graph(5, 6, ndata=rand(5), edata=rand(6), graph_type=GRAPH_T) |
| 276 | + @test hash(g1) == hash(g1) |
| 277 | + @test hash(g1) == hash(deepcopy(g1)) |
| 278 | + @test hash(g1) == hash(GNNGraph(g1, ndata=g1.ndata, graph_type=GRAPH_T)) |
| 279 | + @test hash(g1) == hash(GNNGraph(g1, ndata=g1.ndata, graph_type=GRAPH_T)) |
| 280 | + @test hash(g1) != hash(GNNGraph(g1, ndata=rand(5), graph_type=GRAPH_T)) |
| 281 | + @test hash(g1) != hash(GNNGraph(g1, edata=rand(6), graph_type=GRAPH_T)) |
| 282 | + end |
254 | 283 | end
|
255 | 284 |
|
256 | 285 |
|
0 commit comments