file(GLOB_RECURSE test_files ${CMAKE_CURRENT_SOURCE_DIR}/../src/rules/*.java)
set(counter 1)
foreach(test_file IN LISTS test_files)
    add_test(NAME "logifix.test.${counter}"
             COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/run_test.sh ${PROJECT_BINARY_DIR}/logifix "${test_file}" "${test_file}.diff")
    math(EXPR counter "${counter}+1")
endforeach()


set(regression_test_data 
    "fix_imprecise_calls_to_bigdecimal,https://github.com/apache/kafka/blob/179be72e3003183b0472a888f5f2396423bb031d/connect/api/src/main/java/org/apache/kafka/connect/data/Values.java,"
    "fix_imprecise_calls_to_bigdecimal,https://github.com/apache/pdfbox/blob/cf39f61d4d054bdcfbce81196f8887f41d67eae7/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaint.java,"
    "fix_inefficient_map_access,https://github.com/payara/Payara/blob/8e76681d1f330b9f048f623d7b2d24cc83edf0c2/appserver/deployment/dol/src/main/java/com/sun/enterprise/deployment/util/ApplicationValidator.java,"
    "fix_inefficient_map_access,https://github.com/payara/Payara/blob/8e76681d1f330b9f048f623d7b2d24cc83edf0c2/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/EjbDescriptor.java,"
    "fix_potential_resource_leaks,https://github.com/Konloch/bytecode-viewer/blob/db959d4704dfea3ad22c502997e1e2360dedec9e/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java,"
    "fix_raw_use_of_empty_collections,https://github.com/apache/druid/blob/2c384b61ff47f858a0adb6f8b389c84f2acc84d1/processing/src/test/java/org/apache/druid/query/groupby/GroupByQueryRunnerTest.java,"
    "fix_raw_use_of_empty_collections,https://github.com/apache/druid/blob/2c384b61ff47f858a0adb6f8b389c84f2acc84d1/processing/src/test/java/org/apache/druid/query/groupby/orderby/TopNSequenceTest.java,"
    "fix_raw_use_of_empty_collections,https://github.com/apache/druid/blob/2c384b61ff47f858a0adb6f8b389c84f2acc84d1/server/src/main/java/org/apache/druid/server/emitter/ComposingEmitterModule.java,"
    "fix_raw_use_of_empty_collections,https://github.com/apache/druid/blob/2c384b61ff47f858a0adb6f8b389c84f2acc84d1/server/src/test/java/org/apache/druid/query/lookup/LookupSnapshotTakerTest.java,"
    "fix_raw_use_of_empty_collections,https://github.com/apache/druid/blob/2c384b61ff47f858a0adb6f8b389c84f2acc84d1/server/src/test/java/org/apache/druid/server/lookup/cache/LookupCoordinatorManagerTest.java,"
    "fix_raw_use_of_empty_collections,https://github.com/apache/druid/blob/2c384b61ff47f858a0adb6f8b389c84f2acc84d1/server/src/test/java/org/apache/druid/server/shard/NumberedShardSpecTest.java,"
    "fix_raw_use_of_empty_collections,https://github.com/ronak-manglani/memoir/blob/825df2461004006b9d8139e9bbe702dcf5252d1e/RTEditor/src/main/java/com/onegravity/rteditor/utils/validator/UrlValidator.java,"
    "fix_raw_use_of_generic_class,https://github.com/lyxell/spoon/blob/69c1bc985c607c5bf6202b5bce7f553adbca76ba/src/main/java/spoon/ContractVerifier.java,"
    "fix_raw_use_of_generic_class,https://github.com/lyxell/spoon/blob/69c1bc985c607c5bf6202b5bce7f553adbca76ba/src/main/java/spoon/pattern/internal/matcher/TobeMatched.java,"
    "fix_raw_use_of_generic_class,https://github.com/lyxell/spoon/blob/69c1bc985c607c5bf6202b5bce7f553adbca76ba/src/main/java/spoon/reflect/visitor/ImportCleaner.java,"
    "fix_raw_use_of_generic_class,https://github.com/lyxell/spoon/blob/69c1bc985c607c5bf6202b5bce7f553adbca76ba/src/main/java/spoon/support/reflect/declaration/CtAnnotationImpl.java,"
    "remove_redundant_calls_to_collection_addall,https://github.com/spring-projects/spring-framework/blob/c5fb7b9fb70d0a711a963b2a160c3af5cc4be3a7/spring-expression/src/test/java/org/springframework/expression/spel/ConstructorInvocationTests.java,"
    "remove_redundant_calls_to_collection_addall,https://github.com/spring-projects/spring-framework/blob/c5fb7b9fb70d0a711a963b2a160c3af5cc4be3a7/spring-expression/src/test/java/org/springframework/expression/spel/MethodInvocationTests.java,"
    "remove_unused_local_variables,https://github.com/INRIA/spoon/blob/d7b8daa0331a14b25002e091dd7299271e3a550c/src/main/java/spoon/pattern/internal/node/ElementNode.java,"
    "remove_unused_local_variables,https://github.com/INRIA/spoon/blob/d7b8daa0331a14b25002e091dd7299271e3a550c/src/main/java/spoon/reflect/visitor/CommentHelper.java,"
    "remove_unused_local_variables,https://github.com/INRIA/spoon/blob/d7b8daa0331a14b25002e091dd7299271e3a550c/src/main/java/spoon/reflect/visitor/ImportScannerImpl.java,"
    "remove_unused_local_variables,https://github.com/INRIA/spoon/blob/d7b8daa0331a14b25002e091dd7299271e3a550c/src/main/java/spoon/support/reflect/declaration/CtElementImpl.java,"
    "remove_unused_local_variables,https://github.com/Netflix/astyanax/blob/8daa973723a42d08196ae666bebeacdefe4ace19/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeEntityMapper.java,"
    "remove_unused_local_variables,https://github.com/informatici/openhospital-api/blob/9cf75d34db764fc17352d2f3b7a0c54debc95732/src/test/java/org/isf/admission/rest/AdmissionControllerTest.java,"
    "simplify_calls_to_string_substring,https://github.com/spring-projects/spring-framework/blob/d6c9c7d642372cc13f05e6394595139e06e2a9b5/spring-core/src/main/java/org/springframework/util/MimeTypeUtils.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/samtools/BAMIndexMetaData.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/samtools/SAMUtils.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/samtools/SamFileHeaderMerger.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/samtools/TextualBAMIndexWriter.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/samtools/cram/lossy/QualityScorePreservation.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/samtools/fastq/FastqRecord.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/samtools/util/BufferedLineReader.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/samtools/util/FormatUtil.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/samtools/util/StringUtil.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/tribble/index/interval/IntervalIndexCreator.java,--ignore-all-space"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/tribble/index/interval/IntervalTreeIndex.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/tribble/index/linear/LinearIndexCreator.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/tribble/readers/TabixReader.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/variant/bcf2/BCF2Codec.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/variant/bcf2/BCF2Utils.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/variant/variantcontext/VariantContextComparator.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/a71f1373521b3d9153d4184a0cf99729b757feb0/src/java/htsjdk/variant/vcf/VCFHeaderLine.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/c340afec92d8e54fe014695a7499a08e1948a26d/src/java/htsjdk/samtools/HighAccuracyDownsamplingIterator.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/c340afec92d8e54fe014695a7499a08e1948a26d/src/java/htsjdk/samtools/util/DiskBackedQueue.java,"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/c340afec92d8e54fe014695a7499a08e1948a26d/src/java/htsjdk/variant/vcf/AbstractVCFCodec.java,--ignore-all-space"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/c340afec92d8e54fe014695a7499a08e1948a26d/src/java/htsjdk/variant/vcf/VCF3Codec.java,--ignore-all-space"
    "simplify_code_using_collection_isempty,https://github.com/Micront/htsjdk/blob/c340afec92d8e54fe014695a7499a08e1948a26d/src/java/htsjdk/variant/vcf/VCFCodec.java,--ignore-all-space"
    "simplify_code_using_collection_isempty,https://github.com/cflint/CFLint/blob/257cc0f1822ac2613d7e6a06fedb3518ac39ceec/src/main/java/com/cflint/CFLint.java,"
    "simplify_code_using_collection_isempty,https://github.com/codice/ddf/blob/975a9bfe58962ee48f843f2aa932a4fde13e9b2a/catalog/core/catalog-core-api-impl/src/main/java/ddf/catalog/validation/impl/report/AttributeValidationReportImpl.java,"
    "simplify_code_using_collection_isempty,https://github.com/codice/ddf/blob/975a9bfe58962ee48f843f2aa932a4fde13e9b2a/catalog/core/catalog-core-commands/src/main/java/org/codice/ddf/commands/catalog/MigrateCommand.java,"
    "simplify_code_using_collection_isempty,https://github.com/codice/ddf/blob/975a9bfe58962ee48f843f2aa932a4fde13e9b2a/catalog/core/catalog-core-impl/filter-proxy/src/main/java/ddf/catalog/filter/proxy/adapter/GeotoolsFilterAdapterImpl.java,"
    "simplify_code_using_collection_isempty,https://github.com/codice/ddf/blob/975a9bfe58962ee48f843f2aa932a4fde13e9b2a/catalog/core/catalog-core-validator/src/main/java/ddf/catalog/validation/impl/ReportingMetacardValidatorImpl.java,"
    "simplify_code_using_collection_isempty,https://github.com/codice/ddf/blob/975a9bfe58962ee48f843f2aa932a4fde13e9b2a/catalog/core/catalog-core-validator/src/main/java/ddf/catalog/validation/impl/validator/RequiredAttributesMetacardValidator.java,"
    "simplify_code_using_collection_isempty,https://github.com/conanlm426/test/blob/d47efc23c0124daaba3fc0e2c5e62c925568a732/core/src/main/java/smile/neighbor/CoverTree.java,"
    "simplify_code_using_collection_isempty,https://github.com/conanlm426/test/blob/d47efc23c0124daaba3fc0e2c5e62c925568a732/core/src/test/java/smile/neighbor/SNLSHTest.java,"
    "simplify_code_using_collection_isempty,https://github.com/conanlm426/test/blob/d47efc23c0124daaba3fc0e2c5e62c925568a732/graph/src/main/java/smile/graph/AdjacencyList.java,"
    "simplify_code_using_collection_isempty,https://github.com/conanlm426/test/blob/d47efc23c0124daaba3fc0e2c5e62c925568a732/graph/src/main/java/smile/graph/AdjacencyMatrix.java,"
    "simplify_code_using_collection_isempty,https://github.com/conanlm426/test/blob/d47efc23c0124daaba3fc0e2c5e62c925568a732/nlp/src/main/java/smile/nlp/tokenizer/BreakIteratorTokenizer.java,"
    "simplify_code_using_collection_isempty,https://github.com/conanlm426/test/blob/d47efc23c0124daaba3fc0e2c5e62c925568a732/plot/src/main/java/smile/swing/FontChooser.java,"
    "simplify_code_using_collection_isempty,https://github.com/danangkimhoa/espresso_ZulipAndroid/blob/4cfc4d3a78ad40b950640bd427d9e7632bd83a09/app/src/main/java/com/zulip/android/activities/LoginActivity.java,"
    "simplify_code_using_collection_isempty,https://github.com/danangkimhoa/espresso_ZulipAndroid/blob/4cfc4d3a78ad40b950640bd427d9e7632bd83a09/app/src/main/java/com/zulip/android/models/MessageRange.java,"
    "simplify_code_using_collection_isempty,https://github.com/danangkimhoa/espresso_ZulipAndroid/blob/4cfc4d3a78ad40b950640bd427d9e7632bd83a09/app/src/main/java/com/zulip/android/networking/AsyncGetOldMessages.java,"
    "simplify_code_using_collection_isempty,https://github.com/frodoking/App-Architecture/blob/d3f774ea0dd249f2f2635ef66445ef0623f8efa1/framework/src/main/java/com/frodo/app/framework/orm/sql/SqlInfoBuilder.java,"
    "simplify_code_using_collection_isempty,https://github.com/frodoking/App-Architecture/blob/d3f774ea0dd249f2f2635ef66445ef0623f8efa1/framework/src/main/java/com/frodo/app/framework/orm/sql/WhereBuilder.java,"
    "simplify_code_using_collection_isempty,https://github.com/jaltekruse/OpenNotebook/blob/2e3e7e38d3bc54c8aa279b15678740a7961a85bb/src/main/java/doc_gui/DocMouseListener.java,"
    "simplify_code_using_collection_isempty,https://github.com/jaltekruse/OpenNotebook/blob/2e3e7e38d3bc54c8aa279b15678740a7961a85bb/src/main/java/doc_gui/NotebookPanel.java,"
    "simplify_code_using_collection_isempty,https://github.com/jaltekruse/OpenNotebook/blob/2e3e7e38d3bc54c8aa279b15678740a7961a85bb/src/main/java/doc_gui/graph/BarGraph.java,"
    "simplify_code_using_collection_isempty,https://github.com/jaltekruse/OpenNotebook/blob/2e3e7e38d3bc54c8aa279b15678740a7961a85bb/src/main/java/expression/Expression.java,"
    "simplify_code_using_collection_isempty,https://github.com/jaltekruse/OpenNotebook/blob/2e3e7e38d3bc54c8aa279b15678740a7961a85bb/src/main/java/math_rendering/ExpressionModification.java,"
    "simplify_code_using_collection_isempty,https://github.com/javaparser/javaparser/blob/389c7e859a5fb534b41e0ceb1cc22812f8701d51/javaparser-core/src/main/java/com/github/javaparser/CommentsInserter.java,"
    "simplify_code_using_collection_isempty,https://github.com/javaparser/javaparser/blob/389c7e859a5fb534b41e0ceb1cc22812f8701d51/javaparser-core/src/main/java/com/github/javaparser/ast/comments/CommentsParser.java,"
    "simplify_code_using_collection_isempty,https://github.com/javaparser/javaparser/blob/e63d52dd1ce6e6b27edc5e74e58c98ed17fc7318/javaparser-core/src/main/java/com/github/javaparser/JavaParser.java,"
    "simplify_code_using_collection_isempty,https://github.com/javaparser/javaparser/blob/e63d52dd1ce6e6b27edc5e74e58c98ed17fc7318/javaparser-core/src/main/java/com/github/javaparser/PositionUtils.java,"
    "simplify_code_using_collection_isempty,https://github.com/javaparser/javaparser/blob/e63d52dd1ce6e6b27edc5e74e58c98ed17fc7318/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/DumpVisitor.java,"
    "simplify_code_using_collection_isempty,https://github.com/javaparser/javaparser/blob/e709c28d4c7d8aa5f4ae1a76c2ca746c244e496f/java-symbol-solver-core/src/main/java/me/tomassetti/symbolsolver/javaparsermodel/declarations/JavaParserEnumDeclaration.java,"
    "simplify_code_using_collection_isempty,https://github.com/javaparser/javaparser/blob/e709c28d4c7d8aa5f4ae1a76c2ca746c244e496f/java-symbol-solver-core/src/main/java/me/tomassetti/symbolsolver/javaparsermodel/declarations/JavaParserMethodDeclaration.java,"
    "simplify_code_using_collection_isempty,https://github.com/pac4j/pac4j/blob/84c5f44752803c95c224c0876e195fc129d0bc78/pac4j-core/src/main/java/org/pac4j/core/authorization/DefaultAuthorizationChecker.java,"
    "simplify_code_using_collection_isempty,https://github.com/pac4j/pac4j/blob/84c5f44752803c95c224c0876e195fc129d0bc78/pac4j-core/src/main/java/org/pac4j/core/authorization/generator/SpringSecurityPropertiesAuthorizationGenerator.java,"
    "simplify_code_using_collection_isempty,https://github.com/pac4j/pac4j/blob/84c5f44752803c95c224c0876e195fc129d0bc78/pac4j-core/src/main/java/org/pac4j/core/matching/DefaultMatchingChecker.java,"
    "simplify_code_using_collection_isempty,https://github.com/pac4j/pac4j/blob/84c5f44752803c95c224c0876e195fc129d0bc78/pac4j-mongo/src/main/java/org/pac4j/mongo/credentials/authenticator/MongoAuthenticator.java,"
    "simplify_code_using_collection_isempty,https://github.com/pac4j/pac4j/blob/84c5f44752803c95c224c0876e195fc129d0bc78/pac4j-oauth/src/main/java/org/pac4j/oauth/profile/google2/Google2Profile.java,"
    "simplify_code_using_collection_isempty,https://github.com/pac4j/pac4j/blob/84c5f44752803c95c224c0876e195fc129d0bc78/pac4j-saml/src/main/java/org/pac4j/saml/context/SAML2MessageContext.java,"
    "simplify_code_using_collection_isempty,https://github.com/pac4j/pac4j/blob/84c5f44752803c95c224c0876e195fc129d0bc78/pac4j-sql/src/main/java/org/pac4j/sql/credentials/authenticator/DbAuthenticator.java,"
    "simplify_code_using_collection_isempty,https://github.com/socketio/socket.io-client-java/blob/a3f2b8cd00b3812c9cb3c9b3e209cbc3be9b2b7f/src/main/java/io/socket/client/Manager.java,"
    "simplify_code_using_collection_isempty,https://github.com/socketio/socket.io-client-java/blob/a3f2b8cd00b3812c9cb3c9b3e209cbc3be9b2b7f/src/main/java/io/socket/client/Socket.java,"
    "simplify_code_using_collection_isempty,https://github.com/spring-projects/spring-boot/blob/786aacf2e9079a99ba3bd12a4dc55e320abd840b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationProperties.java,"
    "simplify_code_using_collection_isempty,https://github.com/spring-projects/spring-boot/blob/786aacf2e9079a99ba3bd12a4dc55e320abd840b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java,"
    "simplify_code_using_collection_isempty,https://github.com/spring-projects/spring-boot/blob/786aacf2e9079a99ba3bd12a4dc55e320abd840b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java,"
    "simplify_code_using_collection_isempty,https://github.com/spring-projects/spring-boot/blob/9588188800fd4d2f1f1dd15989e4e9bc999a6633/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/TotalProgressBar.java,"
    "simplify_code_using_collection_isempty,https://github.com/spring-projects/spring-data-mongodb/blob/1d1c80db7be9052e4488592924c1dd377c91048c/spring-data-mongodb-log4j/src/main/java/org/springframework/data/mongodb/log4j/MongoLog4jAppender.java,"
    "simplify_code_using_collection_isempty,https://github.com/spring-projects/spring-data-mongodb/blob/1d1c80db7be9052e4488592924c1dd377c91048c/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/Aggregation.java,"
    "simplify_code_using_collection_isempty,https://github.com/sutra/okcoin-client/blob/8055019b168693fd7d29ecce80cf708e0f0f22ec/okcoin-client-xchange/src/main/java/org/oxerr/okcoin/xchange/service/fix/OKCoinXChangeApplication.java,"
    "simplify_code_using_map_computeifabsent,https://github.com/cbeust/testng/blob/9ea649f6c66ab6165813af7a6c28cbde13c0b685/testng-core/src/main/java/org/testng/internal/MethodGroupsHelper.java,"
    "simplify_code_using_map_computeifabsent,https://github.com/lyxell/spoon/blob/2a2d3d63e62ff7b7081cd9cac572d6ee85def1b1/src/main/java/spoon/pattern/PatternParameterConfigurator.java,"
    "simplify_code_using_map_computeifabsent,https://github.com/spring-projects/spring-framework/blob/01c8de0111806d8f9346f332b22ece9dd9fef618/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java,"
)

set(counter 1)
foreach(regression_test IN LISTS regression_test_data)
    add_test(NAME "logifix.regression_test.${counter}"
             COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/download_and_run_tests.sh ${PROJECT_BINARY_DIR}/logifix "${regression_test}")
    math(EXPR counter "${counter}+1")
endforeach()
