|
| 1 | +/* |
| 2 | + * Copyright (c) "Neo4j" |
| 3 | + * Neo4j Sweden AB [http://neo4j.com] |
| 4 | + * |
| 5 | + * This file is part of Neo4j. |
| 6 | + * |
| 7 | + * Neo4j is free software: you can redistribute it and/or modify |
| 8 | + * it under the terms of the GNU General Public License as published by |
| 9 | + * the Free Software Foundation, either version 3 of the License, or |
| 10 | + * (at your option) any later version. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU General Public License |
| 18 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | + */ |
| 20 | +package org.neo4j.gds.msbfs; |
| 21 | + |
| 22 | +import org.junit.jupiter.params.ParameterizedTest; |
| 23 | +import org.junit.jupiter.params.provider.CsvSource; |
| 24 | +import org.neo4j.gds.assertions.MemoryEstimationAssert; |
| 25 | +import org.neo4j.gds.core.GraphDimensions; |
| 26 | +import org.neo4j.gds.core.concurrency.Concurrency; |
| 27 | + |
| 28 | +class MSBFSMemoryEstimationTest { |
| 29 | + |
| 30 | + @ParameterizedTest |
| 31 | + @CsvSource({ |
| 32 | + "100,1,264", |
| 33 | + "100,4,360" |
| 34 | + }) |
| 35 | + void shouldWorkForPredecessor(long nodeCount, int concurrency, long expectedMemory){ |
| 36 | + MemoryEstimationAssert.assertThat(MSBFSMemoryEstimation.MSBFSWithPredecessorStrategy()) |
| 37 | + .memoryRange(GraphDimensions.of(nodeCount),new Concurrency(concurrency)) |
| 38 | + .hasSameMinAndMaxEqualTo(expectedMemory); |
| 39 | + } |
| 40 | + |
| 41 | + @ParameterizedTest |
| 42 | + @CsvSource({ |
| 43 | + "100,1,216", |
| 44 | + "100,4,288" |
| 45 | + }) |
| 46 | + void shouldWorkForANP(long nodeCount, int concurrency, long expectedMemory){ |
| 47 | + MemoryEstimationAssert.assertThat(MSBFSMemoryEstimation.MSBFSWithANPStrategy()) |
| 48 | + .memoryRange(GraphDimensions.of(nodeCount),new Concurrency(concurrency)) |
| 49 | + .hasSameMinAndMaxEqualTo(expectedMemory); |
| 50 | + } |
| 51 | + |
| 52 | +} |
0 commit comments