Skip to content

Commit

Permalink
[infra] separated test utils from tests (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmondada authored Feb 24, 2022
1 parent d4e5eb7 commit 8049079
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 25 deletions.
3 changes: 2 additions & 1 deletion tket/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ endif()

set(TKET_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR})

include(tkettestutilsfiles.cmake)
include(tkettestsfiles.cmake)

add_executable(test_tket ${TEST_SOURCES})
add_executable(test_tket ${TESTUTILS_SOURCES} ${TEST_SOURCES})

target_link_libraries(test_tket PRIVATE
tket-ArchAwareSynth
Expand Down
24 changes: 0 additions & 24 deletions tket/tests/tkettestsfiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,10 @@ set(TEST_SOURCES
# We should test simpler modules (e.g. Op, Circuit) before
# the more complicated things that rely on them (e.g. Routing,
# Transform) to help identify exactly where stuff breaks
${TKET_TESTS_DIR}/tests_main.cpp
${TKET_TESTS_DIR}/testutil.cpp
${TKET_TESTS_DIR}/CircuitsForTesting.cpp
${TKET_TESTS_DIR}/Utils/test_CosSinDecomposition.cpp
${TKET_TESTS_DIR}/Utils/test_HelperFunctions.cpp
${TKET_TESTS_DIR}/Utils/test_MatrixAnalysis.cpp
${TKET_TESTS_DIR}/Utils/test_RNG.cpp
${TKET_TESTS_DIR}/Graphs/EdgeSequence.cpp
${TKET_TESTS_DIR}/Graphs/EdgeSequenceColouringParameters.cpp
${TKET_TESTS_DIR}/Graphs/GraphTestingRoutines.cpp
${TKET_TESTS_DIR}/Graphs/RandomGraphGeneration.cpp
${TKET_TESTS_DIR}/Graphs/RandomPlanarGraphs.cpp
${TKET_TESTS_DIR}/Graphs/test_GraphColouring.cpp
${TKET_TESTS_DIR}/Graphs/test_GraphFindComponents.cpp
${TKET_TESTS_DIR}/Graphs/test_GraphFindMaxClique.cpp
Expand All @@ -42,25 +34,11 @@ set(TEST_SOURCES
# NOTE: For testing TokenSwapping, it is easier to make use of
# Architecture to set up test problems, rather than trying
# to separate TokenSwapping-without-Architecture tests.
${TKET_TESTS_DIR}/TokenSwapping/Data/FixedCompleteSolutions.cpp
${TKET_TESTS_DIR}/TokenSwapping/Data/FixedSwapSequences.cpp
${TKET_TESTS_DIR}/TokenSwapping/TableLookup/NeighboursFromEdges.cpp
${TKET_TESTS_DIR}/TokenSwapping/TableLookup/PermutationTestUtils.cpp
${TKET_TESTS_DIR}/TokenSwapping/TableLookup/SwapSequenceReductionTester.cpp
${TKET_TESTS_DIR}/TokenSwapping/TableLookup/test_CanonicalRelabelling.cpp
${TKET_TESTS_DIR}/TokenSwapping/TableLookup/test_ExactMappingLookup.cpp
${TKET_TESTS_DIR}/TokenSwapping/TableLookup/test_FilteredSwapSequences.cpp
${TKET_TESTS_DIR}/TokenSwapping/TableLookup/test_SwapSequenceReductions.cpp
${TKET_TESTS_DIR}/TokenSwapping/TableLookup/test_SwapSequenceTable.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/ArchitectureEdgesReimplementation.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/BestTsaTester.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/DebugFunctions.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/DecodedProblemData.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/FullTsaTesting.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/GetRandomSet.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/PartialTsaTesting.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/ProblemGeneration.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/TestStatsStructs.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/test_DebugFunctions.cpp
${TKET_TESTS_DIR}/TokenSwapping/TSAUtils/test_SwapFunctions.cpp
${TKET_TESTS_DIR}/TokenSwapping/test_ArchitectureMappingEndToEnd.cpp
Expand All @@ -78,9 +56,7 @@ set(TEST_SOURCES
${TKET_TESTS_DIR}/Ops/test_ClassicalOps.cpp
${TKET_TESTS_DIR}/Ops/test_Expression.cpp
${TKET_TESTS_DIR}/Ops/test_Ops.cpp
${TKET_TESTS_DIR}/Gate/GatesData.cpp
${TKET_TESTS_DIR}/Gate/test_GateUnitaryMatrix.cpp
${TKET_TESTS_DIR}/Simulation/ComparisonFunctions.cpp
${TKET_TESTS_DIR}/Simulation/test_CircuitSimulator.cpp
${TKET_TESTS_DIR}/Simulation/test_PauliExpBoxUnitaryCalculator.cpp
${TKET_TESTS_DIR}/Circuit/test_Boxes.cpp
Expand Down
43 changes: 43 additions & 0 deletions tket/tests/tkettestutilsfiles.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2019-2022 Cambridge Quantum Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# file to store all the files that serve as utils for the tket unit tests
# new files should be added here

set(TESTUTILS_SOURCES
${TKET_TESTS_DIR}/tests_main.cpp
${TKET_TESTS_DIR}/testutil.cpp
${TKET_TESTS_DIR}/CircuitsForTesting.cpp
${TKET_TESTS_DIR}/Graphs/EdgeSequence.cpp
${TKET_TESTS_DIR}/Graphs/EdgeSequenceColouringParameters.cpp
${TKET_TESTS_DIR}/Graphs/GraphTestingRoutines.cpp
${TKET_TESTS_DIR}/Graphs/RandomGraphGeneration.cpp
${TKET_TESTS_DIR}/Graphs/RandomPlanarGraphs.cpp
${TKET_TESTS_DIR}/TokenSwapping/Data/FixedCompleteSolutions.cpp
${TKET_TESTS_DIR}/TokenSwapping/Data/FixedSwapSequences.cpp
${TKET_TESTS_DIR}/TokenSwapping/TableLookup/NeighboursFromEdges.cpp
${TKET_TESTS_DIR}/TokenSwapping/TableLookup/PermutationTestUtils.cpp
${TKET_TESTS_DIR}/TokenSwapping/TableLookup/SwapSequenceReductionTester.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/ArchitectureEdgesReimplementation.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/BestTsaTester.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/DebugFunctions.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/DecodedProblemData.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/FullTsaTesting.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/GetRandomSet.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/PartialTsaTesting.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/ProblemGeneration.cpp
${TKET_TESTS_DIR}/TokenSwapping/TestUtils/TestStatsStructs.cpp
${TKET_TESTS_DIR}/Gate/GatesData.cpp
${TKET_TESTS_DIR}/Simulation/ComparisonFunctions.cpp
)

0 comments on commit 8049079

Please sign in to comment.