From e71354935626fe52006fdeafea6f5b864cd2051f Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Tue, 26 May 2026 16:23:57 +0200 Subject: [PATCH 01/10] Add test runner tags --- test/test.cpp | 148 ++++++++++++++++++++++++++++++++++++++++++++++++-- test/test.hh | 29 ++++++++++ test/test.hpp | 15 ++++- 3 files changed, 186 insertions(+), 6 deletions(-) diff --git a/test/test.cpp b/test/test.cpp index 4912fa558a..d34abbf611 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -52,12 +52,105 @@ namespace Test { // Log stream std::ostringstream olog; + /// Names of tags supported by the test runner + static const char* tag_names[] = { + "check", + "normal", + "sweep", + nullptr + }; + + /// Masks of tags supported by the test runner + static const unsigned int tag_masks[] = { + TAG_CHECK, + TAG_NORMAL, + TAG_SWEEP + }; + + /// Patterns that reproduce the historic make check selection + static const char* check_patterns[] = { + "Branch::Int::Dense::3", + "FlatZinc::magic_square", + "Int::Arithmetic::Abs", + "Int::Arithmetic::ArgMax", + "Int::Arithmetic::Max::Nary", + "Int::Cumulative::Man::Fix::0::4", + "Int::Distinct::Random", + "Int::Linear::Bool::Int::Lq", + "Int::MiniModel::LinExpr::Bool::352", + "NoGoods::Queens", + "Search::DFS::Sol::Binary::Nary::Binary::1::1::1", + "Set::Dom::Dom::Gr", + "Set::RelOp::ConstSSI::Union", + "Set::Sequence::SeqU1", + "Set::Wait", + nullptr + }; + + /// Patterns for tests that are too heavy for the normal suite + static const char* sweep_patterns[] = { + "FlatZinc::oss", + "FlatZinc::packing", + "FlatZinc::radiation", + "FlatZinc::steiner_triples", + "FlatZinc::template_design", + "FlatZinc::tenpenki", + "FlatZinc::timetabling", + "FlatZinc::trucking", + "Int::Distinct::Pathological", + nullptr + }; + + /// Test whether \a s matches one of \a patterns as a substring + static bool + matches_any_pattern(const std::string& s, const char* patterns[]) { + for (int i=0; patterns[i] != nullptr; i++) + if (s.find(patterns[i]) != std::string::npos) + return true; + return false; + } + + /// Return the tag mask for \a name, or zero if not known + static unsigned int + tag_mask(const char* name) { + for (int i=0; tag_names[i] != nullptr; i++) + if (!strcmp(name, tag_names[i])) + return tag_masks[i]; + if (!strcmp(name, "all")) + return TAG_CHECK | TAG_NORMAL | TAG_SWEEP; + return 0; + } + + /// Print all tag names + static void + print_tags(std::ostream& os) { + for (int i=0; tag_names[i] != nullptr; i++) + os << tag_names[i] << std::endl; + } + + /// Convert \a tags to a comma-separated string + static std::string + tags_to_string(unsigned int tags) { + std::string s; + for (int i=0; tag_names[i] != nullptr; i++) { + if ((tags & tag_masks[i]) != 0) { + if (!s.empty()) + s += ","; + s += tag_names[i]; + } + } + return s; + } + /* * Base class for tests * */ - Base::Base(std::string s) - : _name(std::move(s)), _next(_tests), _rand(Gecode::Support::RandomGenerator()) { + Base::Base(std::string s) + : Base(s, default_tags(s)) {} + + Base::Base(std::string s, unsigned int t) + : _name(std::move(s)), _tags(t), _next(_tests), _rand(Gecode::Support::RandomGenerator()) { _tests = this; _n_tests++; } @@ -91,6 +184,16 @@ namespace Test { Base::~Base() = default; + unsigned int + Base::default_tags(const std::string& s) { + unsigned int tags = TAG_NORMAL; + if (matches_any_pattern(s, sweep_patterns)) + tags = TAG_SWEEP; + if (matches_any_pattern(s, check_patterns)) + tags |= TAG_CHECK; + return tags; + } + Options opt; void report_error(const std::string& name, unsigned int seed, const Options& options, std::ostream& ostream) { @@ -130,6 +233,10 @@ namespace Test { << "\t\tprefixing with \"^\" requires a match at the beginning" << std::endl << "\t\tmultiple pattern-options may be given" << std::endl + << "\t-tag (check|normal|sweep|all) default: (none)" << std::endl + << "\t\ttag for the tests to run" << std::endl + << "\t\tmultiple tag-options may be given" + << std::endl << "\t-start (string) default: (none)" << std::endl << "\t\tsimple pattern for the first test to run" << std::endl << "\t-log" @@ -145,6 +252,10 @@ namespace Test { << "\t\tstop on first error or continue" << std::endl << "\t-list" << std::endl << "\t\toutput list of all test cases and exit" << std::endl + << "\t-list-tags" << std::endl + << "\t\toutput list of known test tags and exit" << std::endl + << "\t-list-with-tags" << std::endl + << "\t\toutput list of all test cases with tags and exit" << std::endl ; exit(EXIT_SUCCESS); } else if (!strcmp(argv[i],"-threads")) { @@ -176,6 +287,16 @@ namespace Test { testpat.emplace_back(MT_NOT, argv[i] + 1); else testpat.emplace_back(MT_ANY, argv[i]); + } else if (!strcmp(argv[i],"-tag")) { + if (++i == argc) goto missing; + unsigned int tag = tag_mask(argv[i]); + if (tag == 0) { + std::cerr << "Erroneous argument (-tag)" << std::endl + << " unknown tag: " << argv[i] << std::endl; + exit(EXIT_FAILURE); + } + testtags |= tag; + use_testtags = true; } else if (!strcmp(argv[i],"-start")) { if (++i == argc) goto missing; start_from = argv[i]; @@ -190,6 +311,10 @@ namespace Test { } } else if (!strcmp(argv[i],"-list")) { list = true; + } else if (!strcmp(argv[i],"-list-tags")) { + list_tags = true; + } else if (!strcmp(argv[i],"-list-with-tags")) { + list_with_tags = true; } i++; } @@ -246,6 +371,10 @@ namespace Test { } } + bool Options::is_test_tags_matching(unsigned int tags) const { + return !use_testtags || ((tags & testtags) != 0); + } + /// Run a single test, returning true iff the test succeeded bool run_test(Base* test, unsigned int test_seed, const Options& options, std::ostream& ostream) { try { @@ -464,7 +593,8 @@ namespace Test { continue; } } - if (options.is_test_name_matching(t->name())) { + if (options.is_test_name_matching(t->name()) && + options.is_test_tags_matching(t->tags())) { tests.emplace_back(t); } } @@ -475,11 +605,19 @@ namespace Test { opt = Options(); opt.parse(argc, argv); + if (opt.list_tags) { + print_tags(std::cout); + return EXIT_SUCCESS; + } + Base::sort(); - if (opt.list) { + if (opt.list || opt.list_with_tags) { for (Base* t = Base::tests(); t != nullptr; t = t->next()) { - std::cout << t->name() << std::endl; + std::cout << t->name(); + if (opt.list_with_tags) + std::cout << " [" << tags_to_string(t->tags()) << "]"; + std::cout << std::endl; } return EXIT_SUCCESS; } diff --git a/test/test.hh b/test/test.hh index 53e605f89c..40a90da1cc 100755 --- a/test/test.hh +++ b/test/test.hh @@ -80,6 +80,13 @@ namespace Test { MT_FIRST //< Positive match at beginning }; + /// Tags for test selection + enum TestTag { + TAG_CHECK = 1U << 0, ///< Basic integrity tests + TAG_NORMAL = 1U << 1, ///< Normal test suite + TAG_SWEEP = 1U << 2 ///< Really heavy sweep tests + }; + /// Commandline options class Options { public: @@ -101,10 +108,18 @@ namespace Test { bool log; /// Patterns to test against std::vector > testpat; + /// Tags to test against + unsigned int testtags; + /// Whether test tags have been requested + bool use_testtags; /// Name of first test to start with const char* start_from; /// Whether to list all tests bool list; + /// Whether to list known tags + bool list_tags; + /// Whether to include tags when listing tests + bool list_with_tags; /// Initialize options with defaults Options(void); @@ -113,6 +128,8 @@ namespace Test { /// True iff a test name should be executed according to the patterns. With no patterns, always true. bool is_test_name_matching(const std::string& test_name) const; + /// True iff test tags should be executed according to the requested tags. With no tag request, always true. + bool is_test_tags_matching(unsigned int tags) const; }; /// The options @@ -123,6 +140,8 @@ namespace Test { private: /// Name of the test std::string _name; + /// Tags assigned to the test + unsigned int _tags; /// Next test Base* _next; /// All tests @@ -132,10 +151,20 @@ namespace Test { public: /// Create and register test with name \a s Base(std::string s); + /// Create and register test with name \a s and tags \a t + Base(std::string s, unsigned int t); /// Sort tests alphabetically static void sort(void); /// Return name of test const std::string& name(void) const; + /// Return tags for test + unsigned int tags(void) const; + /// Add tags \a t to test + void add_tags(unsigned int t); + /// Remove tags \a t from test + void remove_tags(unsigned int t); + /// Return default tags for test named \a s + static unsigned int default_tags(const std::string& s); /// Return all tests static Base* tests(void); /// Return next test diff --git a/test/test.hpp b/test/test.hpp index f7f56488e7..769175565b 100755 --- a/test/test.hpp +++ b/test/test.hpp @@ -40,7 +40,8 @@ namespace Test { inline Options::Options(void) : threads(1), seed(0), iter(defiter), fixprob(deffixprob), - stop(true), log(false), testpat(), start_from(nullptr), list(false) + stop(true), log(false), testpat(), testtags(0), use_testtags(false), + start_from(nullptr), list(false), list_tags(false), list_with_tags(false) {} /* @@ -51,6 +52,18 @@ namespace Test { Base::name(void) const { return _name; } + inline unsigned int + Base::tags(void) const { + return _tags; + } + inline void + Base::add_tags(unsigned int t) { + _tags |= t; + } + inline void + Base::remove_tags(unsigned int t) { + _tags &= ~t; + } inline Base* Base::tests(void) { return _tests; From df9e7de799f7958d79665955e9a817a3c7c6f9cd Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Tue, 26 May 2026 16:24:01 +0200 Subject: [PATCH 02/10] Use test tags for check targets --- CMakeLists.txt | 91 ++++++++++++-------------------------------------- Makefile.in | 58 +++++--------------------------- 2 files changed, 30 insertions(+), 119 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cfa8516ad..ed0625a85b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1489,64 +1489,7 @@ if(BUILD_TESTING) "${GECODE_TEST_BLACKBOX_LOG}.dll_parallel") endif() - set(GECODE_CHECK_TESTS - Branch::Int::Dense::3 - Int::Arithmetic::Abs - Int::Arithmetic::ArgMax - Int::Arithmetic::Max::Nary - Int::Cumulative::Man::Fix::0::4 - Int::Distinct::Random - Int::Extensional::TupleSet::Sparse::IncrementalDelta - Int::Extensional::TupleSet::Auto::DefaultDispatch - Int::Linear::Bool::Int::Lq - Int::MiniModel::LinExpr::Bool::352 - NoGoods::Queens - Search::DFS::Sol::Binary::Nary::Binary::1::1::1) - if(GECODE_ENABLE_FLATZINC) - list(INSERT GECODE_CHECK_TESTS 1 - FlatZinc::Options - FlatZinc::magic_square - FlatZinc::blackbox) - endif() - if(GECODE_ENABLE_SET_VARS) - list(APPEND GECODE_CHECK_TESTS - Set::Dom::Dom::Gr - Set::RelOp::ConstSSI::Union - Set::Sequence::SeqU1 - Set::Wait) - endif() - if(GECODE_ENABLE_FLOAT_VARS) - set(GECODE_FLOAT_CHECK_TESTS - Float::Arithmetic::PositiveNRootBounds - Float::Arithmetic::PowConsistency - Float::Arithmetic::MultZeroEndpoint - Float::Arithmetic::Pow::N::2::XY::Sol::C - Float::Arithmetic::NRoot::N::2::XY::Sol::C - Float::Arithmetic::Mult::XYZ::Sol::C) - list(APPEND GECODE_CHECK_TESTS ${GECODE_FLOAT_CHECK_TESTS}) - - # Keep the fast CI selection honest when Float regressions are added or - # the list above is edited. These names must remain registered in the - # ordinary check target rather than living only in ad-hoc test commands. - set(GECODE_REQUIRED_FLOAT_CHECK_TESTS - Float::Arithmetic::PositiveNRootBounds - Float::Arithmetic::PowConsistency - Float::Arithmetic::MultZeroEndpoint - Float::Arithmetic::Pow::N::2::XY::Sol::C - Float::Arithmetic::NRoot::N::2::XY::Sol::C - Float::Arithmetic::Mult::XYZ::Sol::C) - foreach(gecode_required_float_test ${GECODE_REQUIRED_FLOAT_CHECK_TESTS}) - if(NOT gecode_required_float_test IN_LIST GECODE_CHECK_TESTS) - message(FATAL_ERROR - "Required Float check test is missing: ${gecode_required_float_test}") - endif() - endforeach() - endif() - - set(GECODE_CHECK_ARGS -iter 2 -threads 0 -fixprob 1) - foreach(gecode_check_test ${GECODE_CHECK_TESTS}) - list(APPEND GECODE_CHECK_ARGS -test ${gecode_check_test}) - endforeach() + set(GECODE_CHECK_ARGS -iter 2 -threads 0 -tag check) # Keep ctest robust while leaving the large test binaries out of the default build. set(GECODE_TEST_BUILD_TARGETS gecode-test) @@ -1562,27 +1505,19 @@ if(BUILD_TESTING) FIXTURES_SETUP "${GECODE_TEST_BUILD_FIXTURES}" RESOURCE_LOCK gecode-test-build) add_test(NAME test COMMAND gecode-test ${GECODE_CHECK_ARGS}) - set_tests_properties(test PROPERTIES + add_test(NAME test-normal COMMAND gecode-test -tag normal) + add_test(NAME test-sweep COMMAND gecode-test -tag sweep) + set_tests_properties(test test-normal test-sweep PROPERTIES FIXTURES_REQUIRED gecode-test-built) if(GECODE_ENABLE_FLATZINC) set(GECODE_TEST_BLACKBOX_ENV "GECODE_TEST_BLACKBOX_EXEC=$" "GECODE_TEST_BLACKBOX_DLL=$" "GECODE_TEST_BLACKBOX_LOG=${GECODE_TEST_BLACKBOX_LOG}") - set_tests_properties(test PROPERTIES + set_tests_properties(test test-normal test-sweep PROPERTIES ENVIRONMENT "${GECODE_TEST_BLACKBOX_ENV}") endif() set(GECODE_CHECK_DEPENDS gecode-test) - if(GECODE_ENABLE_FLOAT_VARS) - add_custom_target(verify-gecode-check-tests - COMMAND ${CMAKE_COMMAND} - "-DTEST_EXECUTABLE=$" - "-DREQUIRED_TESTS=${GECODE_REQUIRED_FLOAT_CHECK_TESTS}" - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/VerifyTestSelection.cmake - DEPENDS gecode-test - VERBATIM) - list(APPEND GECODE_CHECK_DEPENDS verify-gecode-check-tests) - endif() if(GECODE_ENABLE_FLATZINC) list(APPEND GECODE_CHECK_DEPENDS gecode-test-blackbox-exec @@ -1601,6 +1536,14 @@ if(BUILD_TESTING) DEPENDS ${GECODE_CHECK_DEPENDS} USES_TERMINAL) endif() + add_custom_target(check-normal + COMMAND $ -tag normal + DEPENDS gecode-test + USES_TERMINAL) + add_custom_target(check-sweep + COMMAND $ -tag sweep + DEPENDS gecode-test + USES_TERMINAL) if(GECODE_ENABLE_FAULT_INJECTION) set(GECODE_FAULT_CHECK_ARGS -iter 1 -threads 1 -test "^Fault::") add_test(NAME fault COMMAND gecode-fault-test ${GECODE_FAULT_CHECK_ARGS}) @@ -1617,10 +1560,18 @@ if(BUILD_TESTING) message(WARNING "Skipping gecode-test/check targets because required modules are disabled") add_custom_target(check COMMAND ${CMAKE_COMMAND} -E echo "Skipping check target because required modules are disabled") + add_custom_target(check-normal + COMMAND ${CMAKE_COMMAND} -E echo "Skipping check-normal target because required modules are disabled") + add_custom_target(check-sweep + COMMAND ${CMAKE_COMMAND} -E echo "Skipping check-sweep target because required modules are disabled") endif() else() add_custom_target(check COMMAND ${CMAKE_COMMAND} -E echo "Skipping check target because BUILD_TESTING is OFF") + add_custom_target(check-normal + COMMAND ${CMAKE_COMMAND} -E echo "Skipping check-normal target because BUILD_TESTING is OFF") + add_custom_target(check-sweep + COMMAND ${CMAKE_COMMAND} -E echo "Skipping check-sweep target because BUILD_TESTING is OFF") endif() # --------------------------------------------------------------------------- diff --git a/Makefile.in b/Makefile.in index fdc39ad001..32b25aba0a 100755 --- a/Makefile.in +++ b/Makefile.in @@ -1441,67 +1441,27 @@ test: mkcompiledirs $(BLACKBOXFIXTURES) @$(MAKE) $(VARIMP) $(TESTEXE) \ $(TESTPUBLICRUNNERSMOKEEXE) $(TESTPUBLICINTSMOKEEXE) -CHECKTESTS = Branch::Int::Dense::3 \ - Int::Arithmetic::Abs \ - Int::Arithmetic::ArgMax \ - Int::Arithmetic::Max::Nary \ - Int::Cumulative::Man::Fix::0::4 \ - Int::Distinct::Random \ - Int::Extensional::TupleSet::Sparse::IncrementalDelta \ - Int::Extensional::TupleSet::Auto::DefaultDispatch \ - Int::Linear::Bool::Int::Lq \ - Int::MiniModel::LinExpr::Bool::352 \ - NoGoods::Queens \ - Search::DFS::Sol::Binary::Nary::Binary::1::1::1 - -ifeq "@enable_set_vars@" "yes" -CHECKTESTS += \ - Set::Dom::Dom::Gr \ - Set::RelOp::ConstSSI::Union \ - Set::Sequence::SeqU1 \ - Set::Wait -endif - ifeq "@enable_flatzinc@" "yes" -CHECKTESTS += FlatZinc::magic_square FlatZinc::Options FlatZinc::blackbox BLACKBOXCHECKENV = \ GECODE_TEST_BLACKBOX_EXEC=$(abspath $(BLACKBOXEXEC)) \ GECODE_TEST_BLACKBOX_DLL=$(abspath $(BLACKBOXDLL)) \ GECODE_TEST_BLACKBOX_LOG=$(BLACKBOXLOG) endif -ifeq "@enable_float_vars@" "yes" -FLOATCHECKTESTS = Float::Arithmetic::PositiveNRootBounds \ - Float::Arithmetic::PowConsistency \ - Float::Arithmetic::MultZeroEndpoint \ - Float::Arithmetic::Pow::N::2::XY::Sol::C \ - Float::Arithmetic::NRoot::N::2::XY::Sol::C \ - Float::Arithmetic::Mult::XYZ::Sol::C -CHECKTESTS += $(FLOATCHECKTESTS) -REQUIREDFLOATCHECKTESTS = Float::Arithmetic::PositiveNRootBounds \ - Float::Arithmetic::PowConsistency \ - Float::Arithmetic::MultZeroEndpoint \ - Float::Arithmetic::Pow::N::2::XY::Sol::C \ - Float::Arithmetic::NRoot::N::2::XY::Sol::C \ - Float::Arithmetic::Mult::XYZ::Sol::C -endif - # A basic integrity test check: test $(RUNENVIRONMENT) $(TESTPUBLICRUNNERSMOKEEXE) $(RUNENVIRONMENT) $(TESTPUBLICINTSMOKEEXE) - @for t in $(REQUIREDFLOATCHECKTESTS); do \ - case " $(CHECKTESTS) " in *" $$t "*) ;; \ - *) echo "Required Float check test is missing: $$t" >&2; exit 1 ;; \ - esac; \ - if ! $(RUNENVIRONMENT) $(TESTEXE) -list | grep -Fqx "$$t"; then \ - echo "Required Float check test is not registered: $$t" >&2; \ - exit 1; \ - fi; \ - done $(BLACKBOXCHECKENV) $(RUNENVIRONMENT) \ - $(TESTEXE) -iter 2 -threads 0 -fixprob 1 \ - $(CHECKTESTS:%=-test %) + $(TESTEXE) -iter 2 -threads 0 -tag check + +# The normal test suite without sweep tests +check-normal: test + $(BLACKBOXCHECKENV) $(RUNENVIRONMENT) $(TESTEXE) -tag normal + +# Really heavy sweep tests +check-sweep: test + $(BLACKBOXCHECKENV) $(RUNENVIRONMENT) $(TESTEXE) -tag sweep .PHONY: regenerate regenerate: From 5b480ba9841c89b8a7d2b1943ae436809c152fe5 Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Tue, 26 May 2026 16:29:11 +0200 Subject: [PATCH 03/10] Use scoped enum for test tags --- test/test.cpp | 44 ++++++++++++++++++++++---------------------- test/test.hh | 48 ++++++++++++++++++++++++++++++++++++------------ test/test.hpp | 48 ++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 100 insertions(+), 40 deletions(-) diff --git a/test/test.cpp b/test/test.cpp index d34abbf611..e3da7761d1 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -61,10 +61,10 @@ namespace Test { }; /// Masks of tags supported by the test runner - static const unsigned int tag_masks[] = { - TAG_CHECK, - TAG_NORMAL, - TAG_SWEEP + static const TestTag tag_values[] = { + TestTag::check, + TestTag::normal, + TestTag::sweep }; /// Patterns that reproduce the historic make check selection @@ -110,15 +110,15 @@ namespace Test { return false; } - /// Return the tag mask for \a name, or zero if not known - static unsigned int - tag_mask(const char* name) { + /// Return the tag set for \a name, or an empty set if not known + static TestTags + tag_set(const char* name) { for (int i=0; tag_names[i] != nullptr; i++) if (!strcmp(name, tag_names[i])) - return tag_masks[i]; + return TestTags(tag_values[i]); if (!strcmp(name, "all")) - return TAG_CHECK | TAG_NORMAL | TAG_SWEEP; - return 0; + return TestTags::all(); + return TestTags(); } /// Print all tag names @@ -130,10 +130,10 @@ namespace Test { /// Convert \a tags to a comma-separated string static std::string - tags_to_string(unsigned int tags) { + tags_to_string(TestTags tags) { std::string s; for (int i=0; tag_names[i] != nullptr; i++) { - if ((tags & tag_masks[i]) != 0) { + if (tags.overlaps(TestTags(tag_values[i]))) { if (!s.empty()) s += ","; s += tag_names[i]; @@ -149,7 +149,7 @@ namespace Test { Base::Base(std::string s) : Base(s, default_tags(s)) {} - Base::Base(std::string s, unsigned int t) + Base::Base(std::string s, TestTags t) : _name(std::move(s)), _tags(t), _next(_tests), _rand(Gecode::Support::RandomGenerator()) { _tests = this; _n_tests++; } @@ -184,13 +184,13 @@ namespace Test { Base::~Base() = default; - unsigned int + TestTags Base::default_tags(const std::string& s) { - unsigned int tags = TAG_NORMAL; + TestTags tags(TestTag::normal); if (matches_any_pattern(s, sweep_patterns)) - tags = TAG_SWEEP; + tags = TestTags(TestTag::sweep); if (matches_any_pattern(s, check_patterns)) - tags |= TAG_CHECK; + tags.add(TestTag::check); return tags; } @@ -289,13 +289,13 @@ namespace Test { testpat.emplace_back(MT_ANY, argv[i]); } else if (!strcmp(argv[i],"-tag")) { if (++i == argc) goto missing; - unsigned int tag = tag_mask(argv[i]); - if (tag == 0) { + TestTags tag = tag_set(argv[i]); + if (tag.empty()) { std::cerr << "Erroneous argument (-tag)" << std::endl << " unknown tag: " << argv[i] << std::endl; exit(EXIT_FAILURE); } - testtags |= tag; + testtags.add(tag); use_testtags = true; } else if (!strcmp(argv[i],"-start")) { if (++i == argc) goto missing; @@ -371,8 +371,8 @@ namespace Test { } } - bool Options::is_test_tags_matching(unsigned int tags) const { - return !use_testtags || ((tags & testtags) != 0); + bool Options::is_test_tags_matching(TestTags tags) const { + return !use_testtags || tags.overlaps(testtags); } /// Run a single test, returning true iff the test succeeded diff --git a/test/test.hh b/test/test.hh index 40a90da1cc..0507db8279 100755 --- a/test/test.hh +++ b/test/test.hh @@ -81,10 +81,34 @@ namespace Test { }; /// Tags for test selection - enum TestTag { - TAG_CHECK = 1U << 0, ///< Basic integrity tests - TAG_NORMAL = 1U << 1, ///< Normal test suite - TAG_SWEEP = 1U << 2 ///< Really heavy sweep tests + enum class TestTag : unsigned int { + check = 1U << 0, ///< Basic integrity tests + normal = 1U << 1, ///< Normal test suite + sweep = 1U << 2 ///< Really heavy sweep tests + }; + + /// Set of test tags + class TestTags { + private: + /// Bit mask for tags + unsigned int _mask; + /// Initialize from raw bit mask \a m + explicit TestTags(unsigned int m); + public: + /// Initialize with no tags + TestTags(void); + /// Initialize with tag \a t + TestTags(TestTag t); + /// Return set with all known tags + static TestTags all(void); + /// Whether no tags are set + bool empty(void) const; + /// Whether this set contains any tag from \a t + bool overlaps(TestTags t) const; + /// Add tags \a t + void add(TestTags t); + /// Remove tags \a t + void remove(TestTags t); }; /// Commandline options @@ -109,7 +133,7 @@ namespace Test { /// Patterns to test against std::vector > testpat; /// Tags to test against - unsigned int testtags; + TestTags testtags; /// Whether test tags have been requested bool use_testtags; /// Name of first test to start with @@ -129,7 +153,7 @@ namespace Test { /// True iff a test name should be executed according to the patterns. With no patterns, always true. bool is_test_name_matching(const std::string& test_name) const; /// True iff test tags should be executed according to the requested tags. With no tag request, always true. - bool is_test_tags_matching(unsigned int tags) const; + bool is_test_tags_matching(TestTags tags) const; }; /// The options @@ -141,7 +165,7 @@ namespace Test { /// Name of the test std::string _name; /// Tags assigned to the test - unsigned int _tags; + TestTags _tags; /// Next test Base* _next; /// All tests @@ -152,19 +176,19 @@ namespace Test { /// Create and register test with name \a s Base(std::string s); /// Create and register test with name \a s and tags \a t - Base(std::string s, unsigned int t); + Base(std::string s, TestTags t); /// Sort tests alphabetically static void sort(void); /// Return name of test const std::string& name(void) const; /// Return tags for test - unsigned int tags(void) const; + TestTags tags(void) const; /// Add tags \a t to test - void add_tags(unsigned int t); + void add_tags(TestTags t); /// Remove tags \a t from test - void remove_tags(unsigned int t); + void remove_tags(TestTags t); /// Return default tags for test named \a s - static unsigned int default_tags(const std::string& s); + static TestTags default_tags(const std::string& s); /// Return all tests static Base* tests(void); /// Return next test diff --git a/test/test.hpp b/test/test.hpp index 769175565b..889004305d 100755 --- a/test/test.hpp +++ b/test/test.hpp @@ -33,6 +33,42 @@ namespace Test { + /* + * Test tags + * + */ + inline + TestTags::TestTags(unsigned int m) + : _mask(m) {} + inline + TestTags::TestTags(void) + : _mask(0) {} + inline + TestTags::TestTags(TestTag t) + : _mask(static_cast(t)) {} + inline TestTags + TestTags::all(void) { + return TestTags(static_cast(TestTag::check) | + static_cast(TestTag::normal) | + static_cast(TestTag::sweep)); + } + inline bool + TestTags::empty(void) const { + return _mask == 0; + } + inline bool + TestTags::overlaps(TestTags t) const { + return (_mask & t._mask) != 0; + } + inline void + TestTags::add(TestTags t) { + _mask |= t._mask; + } + inline void + TestTags::remove(TestTags t) { + _mask &= ~t._mask; + } + /* * Commandline options * @@ -40,7 +76,7 @@ namespace Test { inline Options::Options(void) : threads(1), seed(0), iter(defiter), fixprob(deffixprob), - stop(true), log(false), testpat(), testtags(0), use_testtags(false), + stop(true), log(false), testpat(), testtags(), use_testtags(false), start_from(nullptr), list(false), list_tags(false), list_with_tags(false) {} @@ -52,17 +88,17 @@ namespace Test { Base::name(void) const { return _name; } - inline unsigned int + inline TestTags Base::tags(void) const { return _tags; } inline void - Base::add_tags(unsigned int t) { - _tags |= t; + Base::add_tags(TestTags t) { + _tags.add(t); } inline void - Base::remove_tags(unsigned int t) { - _tags &= ~t; + Base::remove_tags(TestTags t) { + _tags.remove(t); } inline Base* Base::tests(void) { From 9a7d73d09476c1ce46d23b29001c334647509b07 Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Tue, 26 May 2026 17:00:22 +0200 Subject: [PATCH 04/10] Document tag-based test targets --- CMakeLists.txt | 6 ++---- docs/cmake-build.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed0625a85b..96bf7be864 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1505,16 +1505,14 @@ if(BUILD_TESTING) FIXTURES_SETUP "${GECODE_TEST_BUILD_FIXTURES}" RESOURCE_LOCK gecode-test-build) add_test(NAME test COMMAND gecode-test ${GECODE_CHECK_ARGS}) - add_test(NAME test-normal COMMAND gecode-test -tag normal) - add_test(NAME test-sweep COMMAND gecode-test -tag sweep) - set_tests_properties(test test-normal test-sweep PROPERTIES + set_tests_properties(test PROPERTIES FIXTURES_REQUIRED gecode-test-built) if(GECODE_ENABLE_FLATZINC) set(GECODE_TEST_BLACKBOX_ENV "GECODE_TEST_BLACKBOX_EXEC=$" "GECODE_TEST_BLACKBOX_DLL=$" "GECODE_TEST_BLACKBOX_LOG=${GECODE_TEST_BLACKBOX_LOG}") - set_tests_properties(test test-normal test-sweep PROPERTIES + set_tests_properties(test PROPERTIES ENVIRONMENT "${GECODE_TEST_BLACKBOX_ENV}") endif() set(GECODE_CHECK_DEPENDS gecode-test) diff --git a/docs/cmake-build.md b/docs/cmake-build.md index b5d5786bd9..a9fe2d319b 100644 --- a/docs/cmake-build.md +++ b/docs/cmake-build.md @@ -72,6 +72,37 @@ cmake --install build/vs2022-vcpkg --config Release --prefix C:/path/to/install Visual Studio is a multi-config generator, so use `--config Release` (or `Debug`) for build/install/check commands rather than `CMAKE_BUILD_TYPE`. +## Test Targets + +When `BUILD_TESTING=ON`, CMake builds the `gecode-test` test runner on demand. +The standard `check` target runs the basic integrity suite: + +```bash +cmake --build build --target check +``` + +Two additional targets expose broader tag-based suites: + +```bash +cmake --build build --target check-normal +cmake --build build --target check-sweep +``` + +`check-normal` runs the normal test suite. `check-sweep` runs tests tagged as +heavy sweep tests and is intended for deliberate, longer-running validation. + +The test runner can also be invoked directly with tags: + +```bash +gecode-test -tag check +gecode-test -tag normal +gecode-test -tag sweep +gecode-test -tag normal -tag sweep +``` + +Use `gecode-test -list-tags` to list known tags and +`gecode-test -list-with-tags` to inspect test assignments. + ## Build Conventions and Key Options ### Common CMake options From 808be26a99814aa6e8c532b1934cf952959b5527 Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Sun, 6 Sep 2026 11:51:59 +0200 Subject: [PATCH 05/10] Preserve check coverage with test tags --- CMakeLists.txt | 18 +++++++++++++----- Makefile.in | 2 +- test/test.cpp | 10 ++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96bf7be864..dee4d341dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1489,7 +1489,7 @@ if(BUILD_TESTING) "${GECODE_TEST_BLACKBOX_LOG}.dll_parallel") endif() - set(GECODE_CHECK_ARGS -iter 2 -threads 0 -tag check) + set(GECODE_CHECK_ARGS -iter 2 -threads 0 -fixprob 1 -tag check) # Keep ctest robust while leaving the large test binaries out of the default build. set(GECODE_TEST_BUILD_TARGETS gecode-test) @@ -1528,16 +1528,24 @@ if(BUILD_TESTING) $ ${GECODE_CHECK_ARGS} DEPENDS ${GECODE_CHECK_DEPENDS} USES_TERMINAL) + add_custom_target(check-normal + COMMAND ${CMAKE_COMMAND} -E env + GECODE_TEST_BLACKBOX_EXEC=$ + GECODE_TEST_BLACKBOX_DLL=$ + GECODE_TEST_BLACKBOX_LOG=${GECODE_TEST_BLACKBOX_LOG} + $ -tag normal + DEPENDS ${GECODE_CHECK_DEPENDS} + USES_TERMINAL) else() add_custom_target(check COMMAND $ ${GECODE_CHECK_ARGS} DEPENDS ${GECODE_CHECK_DEPENDS} USES_TERMINAL) + add_custom_target(check-normal + COMMAND $ -tag normal + DEPENDS gecode-test + USES_TERMINAL) endif() - add_custom_target(check-normal - COMMAND $ -tag normal - DEPENDS gecode-test - USES_TERMINAL) add_custom_target(check-sweep COMMAND $ -tag sweep DEPENDS gecode-test diff --git a/Makefile.in b/Makefile.in index 32b25aba0a..7d7fa154f9 100755 --- a/Makefile.in +++ b/Makefile.in @@ -1453,7 +1453,7 @@ check: test $(RUNENVIRONMENT) $(TESTPUBLICRUNNERSMOKEEXE) $(RUNENVIRONMENT) $(TESTPUBLICINTSMOKEEXE) $(BLACKBOXCHECKENV) $(RUNENVIRONMENT) \ - $(TESTEXE) -iter 2 -threads 0 -tag check + $(TESTEXE) -iter 2 -threads 0 -fixprob 1 -tag check # The normal test suite without sweep tests check-normal: test diff --git a/test/test.cpp b/test/test.cpp index e3da7761d1..971a70ed7b 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -70,12 +70,22 @@ namespace Test { /// Patterns that reproduce the historic make check selection static const char* check_patterns[] = { "Branch::Int::Dense::3", + "FlatZinc::Options", "FlatZinc::magic_square", + "FlatZinc::blackbox", + "Float::Arithmetic::PositiveNRootBounds", + "Float::Arithmetic::PowConsistency", + "Float::Arithmetic::MultZeroEndpoint", + "Float::Arithmetic::Pow::N::2::XY::Sol::C", + "Float::Arithmetic::NRoot::N::2::XY::Sol::C", + "Float::Arithmetic::Mult::XYZ::Sol::C", "Int::Arithmetic::Abs", "Int::Arithmetic::ArgMax", "Int::Arithmetic::Max::Nary", "Int::Cumulative::Man::Fix::0::4", "Int::Distinct::Random", + "Int::Extensional::TupleSet::Sparse::IncrementalDelta", + "Int::Extensional::TupleSet::Auto::DefaultDispatch", "Int::Linear::Bool::Int::Lq", "Int::MiniModel::LinExpr::Bool::352", "NoGoods::Queens", From 4a9163e1ff9f056b576e3d6e5fe244bcc0f39553 Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Sun, 6 Sep 2026 12:28:02 +0200 Subject: [PATCH 06/10] Keep exhaustive test families out of normal runs --- test/test.cpp | 94 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 2 deletions(-) diff --git a/test/test.cpp b/test/test.cpp index 971a70ed7b..f00c70bfc0 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -97,6 +97,58 @@ namespace Test { nullptr }; + /// Representative cases retained from otherwise exhaustive sweep families + static const char* normal_patterns[] = { + "Float::Arithmetic::Abs::XX::A", + "Float::Arithmetic::Div::A", + "Float::Arithmetic::Max::Bin::XXX::A", + "Float::Arithmetic::Min::Bin::XXX::A", + "Float::Arithmetic::Sqr::XX::A", + "Float::Arithmetic::Sqrt::XX::A", + "Float::Linear::Float::Eq::11::0::1", + "Float::Linear::Var::Eq::11::1", + "Float::MiniModel::LinExpr::000", + "Float::Transcendental::Exp::XX::A", + "Float::Transcendental::Log::XX::A", + "Float::Transcendental::Pow::N::1.5::XX::A", + "Float::Trigonometric::ACos::XX::A", + "Float::Trigonometric::ASin::XX::A", + "Float::Trigonometric::ATan::XX::A", + "Float::Trigonometric::Cos::XX::A", + "Float::Trigonometric::Sin::XX::A", + "Float::Trigonometric::Tan::XX::A", + "Int::Arithmetic::Nroot::XX::1::Bnd::A", + "Int::Arithmetic::Pow::XX::0::Bnd::A", + "Int::Channel::Bool::Multi::A", + "Int::Circuit::Cost::Dom::4::0", + "Int::Count::Distinct::Bnd::Dense", + "Int::Cumulative::Opt::Fix::-2147483646::-1", + "Int::Cumulative::Opt::Flex::-2147483646::4::0::2", + "Int::Distinct::Bnd::Dense", + "Int::Distinct::Dom::Dense", + "Int::Distinct::Offset::Dense::Bnd", + "Int::GCC::Int::All::Max::Bnd", + "Int::Linear::Int::Int::Eq::Bnd::11::0::1", + "Int::MiniModel::SetExpr::Const::000::0::0", + "Int::MiniModel::SetExpr::Expr::000::000::0", + "Int::NValues::Int::Int::Eq::1::0", + "Int::NoOverlap::Int::2::2::[1,1,1,1]::[1,1,1,1]", + "Int::Path::Cost::Dom::3::0", + "Int::Rel::Int::Array::Eq::0::4", + "Int::Unary::Man::Fix::-2147483646::[2,2,0,2,2]::Def+A", + "Int::Unary::Man::Flex::-2147483646::4::0::2::Def+A", + "Int::Unary::Opt::Fix::-2147483646::[2,2,0,2,2]::Def+A", + "Int::Unary::Opt::Flex::-2147483646::4::0::2::Def+A", + "Search::BAB::Sol::BalGr::Binary::Binary::Binary::1::1::1", + "Set::Branch::Dense::3", + "Set::Channel::Bool::1", + "Set::Element::Disjoint", + "Set::Precede::Multi::[1,2,3]", + "Set::Rel::Bin::Cmpl::S0", + "Set::RelOp::ConstISI::DUnion::Cmpl::0::0", + nullptr + }; + /// Patterns for tests that are too heavy for the normal suite static const char* sweep_patterns[] = { "FlatZinc::oss", @@ -107,7 +159,43 @@ namespace Test { "FlatZinc::tenpenki", "FlatZinc::timetabling", "FlatZinc::trucking", + "Float::Arithmetic", + "Float::Linear::Float", + "Float::Linear::Var", + "Float::MiniModel::LinExpr", + "Float::Transcendental", + "Float::Trigonometric", + "Int::Arithmetic::Nroot", + "Int::Arithmetic::Pow", + "Int::Channel", + "Int::Circuit", + "Int::Count::Distinct", + "Int::Cumulative::Man", + "Int::Cumulative::Opt", + "Int::Distinct::Bnd", + "Int::Distinct::Dom", + "Int::Distinct::Offset", "Int::Distinct::Pathological", + "Int::Extensional::TupleSet", + "Int::GCC", + "Int::Linear::Bool", + "Int::Linear::Int", + "Int::MiniModel::LinExpr", + "Int::MiniModel::SetExpr", + "Int::NValues::Int", + "Int::NoOverlap", + "Int::Path", + "Int::Rel::Int", + "Int::Unary", + "Search::BAB::Sol", + "Search::DFS::Sol", + "Set::Branch", + "Set::Channel", + "Set::Dom", + "Set::Element", + "Set::Precede", + "Set::Rel", + "Set::RelOp", nullptr }; @@ -196,10 +284,12 @@ namespace Test { TestTags Base::default_tags(const std::string& s) { + const bool check = matches_any_pattern(s, check_patterns); + const bool normal = matches_any_pattern(s, normal_patterns); TestTags tags(TestTag::normal); - if (matches_any_pattern(s, sweep_patterns)) + if (!check && !normal && matches_any_pattern(s, sweep_patterns)) tags = TestTags(TestTag::sweep); - if (matches_any_pattern(s, check_patterns)) + if (check) tags.add(TestTag::check); return tags; } From 6232f33e2e00f5384b6c92d1bb4f6ec2c45ad0a0 Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Sun, 6 Sep 2026 13:10:23 +0200 Subject: [PATCH 07/10] Integrate test tags with public harness --- CMakeLists.txt | 23 +- Makefile.in | 4 +- cmake/GecodeSources.cmake | 5 +- docs/public-test-harness.md | 26 +++ test/gecode-tags.cpp | 204 +++++++++++++++++ test/gecode-tags.hh | 46 ++++ .../verify-installed-test-component.py | 3 +- test/public-runner-smoke.cpp | 61 ++++- test/test-main.cpp | 4 +- test/test.cpp | 209 ++++-------------- test/test.hh | 4 +- test/test.hpp | 6 - 12 files changed, 397 insertions(+), 198 deletions(-) create mode 100644 test/gecode-tags.cpp create mode 100644 test/gecode-tags.hh diff --git a/CMakeLists.txt b/CMakeLists.txt index dee4d341dc..bfbb7f454d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -814,7 +814,10 @@ ${CONFIG_OUT}") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GecodeSources.cmake) if(GECODE_ENABLE_FAULT_INJECTION) list(APPEND GECODE_SUPPORT_SOURCES gecode/support/failpoint.cpp) - set(GECODE_FAULT_TEST_SOURCES ${GECODE_TEST_MAIN_SOURCE} test/fault.cpp) + set(GECODE_FAULT_TEST_SOURCES + test/test-main.cpp + test/gecode-tags.cpp + test/fault.cpp) endif() # --------------------------------------------------------------------------- @@ -1465,7 +1468,7 @@ if(BUILD_TESTING) endif() if(GECODE_CAN_BUILD_TESTS) - add_executable(gecode-test EXCLUDE_FROM_ALL ${GECODE_TEST_MAIN_SOURCE} ${GECODE_TEST_SOURCES_SELECTED}) + add_executable(gecode-test EXCLUDE_FROM_ALL ${GECODE_TEST_MAIN_SOURCES} ${GECODE_TEST_SOURCES_SELECTED}) set(GECODE_TEST_LINK_LIBS gecodetestint gecodeminimodel) if(GECODE_ENABLE_FLATZINC) list(APPEND GECODE_TEST_LINK_LIBS gecodeflatzinc) @@ -1536,6 +1539,14 @@ if(BUILD_TESTING) $ -tag normal DEPENDS ${GECODE_CHECK_DEPENDS} USES_TERMINAL) + add_custom_target(check-sweep + COMMAND ${CMAKE_COMMAND} -E env + GECODE_TEST_BLACKBOX_EXEC=$ + GECODE_TEST_BLACKBOX_DLL=$ + GECODE_TEST_BLACKBOX_LOG=${GECODE_TEST_BLACKBOX_LOG} + $ -tag sweep + DEPENDS ${GECODE_CHECK_DEPENDS} + USES_TERMINAL) else() add_custom_target(check COMMAND $ ${GECODE_CHECK_ARGS} @@ -1545,11 +1556,11 @@ if(BUILD_TESTING) COMMAND $ -tag normal DEPENDS gecode-test USES_TERMINAL) + add_custom_target(check-sweep + COMMAND $ -tag sweep + DEPENDS gecode-test + USES_TERMINAL) endif() - add_custom_target(check-sweep - COMMAND $ -tag sweep - DEPENDS gecode-test - USES_TERMINAL) if(GECODE_ENABLE_FAULT_INJECTION) set(GECODE_FAULT_CHECK_ARGS -iter 1 -threads 1 -test "^Fault::") add_test(NAME fault COMMAND gecode-fault-test ${GECODE_FAULT_CHECK_ARGS}) diff --git a/Makefile.in b/Makefile.in index 7d7fa154f9..96799ff83d 100755 --- a/Makefile.in +++ b/Makefile.in @@ -1279,7 +1279,7 @@ BLACKBOXSRC = $(BLACKBOXEXECSRC) $(BLACKBOXDLLSRC) TESTCORESRC = test/test.cpp TESTCOREOBJ = $(TESTCORESRC:%.cpp=%$(OBJSUFFIX)) -TESTMAINSRC = test/test-main.cpp +TESTMAINSRC = test/test-main.cpp test/gecode-tags.cpp TESTMAINOBJ = $(TESTMAINSRC:%.cpp=%$(OBJSUFFIX)) TESTINTSEAMSRC = test/int.cpp TESTINTSEAMOBJ = $(TESTINTSEAMSRC:%.cpp=%$(OBJSUFFIX)) @@ -1299,7 +1299,7 @@ TESTSRC = \ $(ARRAYTESTSRC0) $(FLATZINCTESTSRC0) $(BLACKBOXSRC) TESTHDR0 = \ - test.hh test.hpp int.hh int.hpp set.hh set.hpp float.hh float.hpp \ + test.hh test.hpp gecode-tags.hh int.hh int.hpp set.hh set.hpp float.hh float.hpp \ branch.hh assign.hh flatzinc.hh TESTHDR = $(TESTHDR0:%=test/%) diff --git a/cmake/GecodeSources.cmake b/cmake/GecodeSources.cmake index 1ddd513014..773e389246 100644 --- a/cmake/GecodeSources.cmake +++ b/cmake/GecodeSources.cmake @@ -252,7 +252,10 @@ set(GECODE_TEST_INT_SOURCES test/int.cpp ) -set(GECODE_TEST_MAIN_SOURCE test/test-main.cpp) +set(GECODE_TEST_MAIN_SOURCES + test/test-main.cpp + test/gecode-tags.cpp +) set(GECODE_TEST_PUBLIC_RUNNER_SMOKE_SOURCE test/public-runner-smoke.cpp) set(GECODE_TEST_PUBLIC_INT_SMOKE_SOURCE test/public-int-smoke.cpp) diff --git a/docs/public-test-harness.md b/docs/public-test-harness.md index 6798ed27c2..53ed48f5df 100644 --- a/docs/public-test-harness.md +++ b/docs/public-test-harness.md @@ -154,6 +154,32 @@ or `RM_PMI` when the propagator supports only part of the reification API. `testsearch` and `testfix` can disable the corresponding checks for constraints where those checks do not apply. +## Select tests by tag + +Tests created with the one-argument `Test::Base` constructor have the `normal` +tag. A test can instead provide an explicit tag: + +```c++ +ConsumerSmoke() + : Test::Base("Package::ConsumerSmoke", Test::TestTag::sweep) {} +``` + +The runner recognizes the `check`, `normal`, and `sweep` tags. Repeating +`-tag` selects their union: + +```bash +./consumer-smoke -tag normal +./consumer-smoke -tag normal -tag sweep +``` + +Use `-list-tags` to list the recognized tags and `-list-with-tags` to show the +tags assigned to every registered test. Gecode's tests declare their tags at +registration, just like downstream tests; test names do not trigger implicit +classification. + +The runner uses the same option model as Gecode's own `gecode-test` binary. +The supported public seam is the runner function, not a separate alternate CLI. + ## Run and reproduce tests List the registered tests: diff --git a/test/gecode-tags.cpp b/test/gecode-tags.cpp new file mode 100644 index 0000000000..5513ceb21d --- /dev/null +++ b/test/gecode-tags.cpp @@ -0,0 +1,204 @@ +/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + * Main authors: + * Christian Schulte + * + * Contributing authors: + * Mikael Lagerkvist + * + * Copyright: + * Christian Schulte, 2026 + * + * This file is part of Gecode, the generic constraint + * development environment: + * http://www.gecode.org + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#include "test/test.hh" +#include "test/gecode-tags.hh" + +#include + +namespace Test { + + /// Patterns that reproduce the historic make check selection + static const char* const check_patterns[] = { + "Branch::Int::Dense::3", + "FlatZinc::Options", + "FlatZinc::magic_square", + "FlatZinc::blackbox", + "Float::Arithmetic::PositiveNRootBounds", + "Float::Arithmetic::PowConsistency", + "Float::Arithmetic::MultZeroEndpoint", + "Float::Arithmetic::Pow::N::2::XY::Sol::C", + "Float::Arithmetic::NRoot::N::2::XY::Sol::C", + "Float::Arithmetic::Mult::XYZ::Sol::C", + "Int::Arithmetic::Abs", + "Int::Arithmetic::ArgMax", + "Int::Arithmetic::Max::Nary", + "Int::Cumulative::Man::Fix::0::4", + "Int::Distinct::Random", + "Int::Extensional::TupleSet::Sparse::IncrementalDelta", + "Int::Extensional::TupleSet::Auto::DefaultDispatch", + "Int::Linear::Bool::Int::Lq", + "Int::MiniModel::LinExpr::Bool::352", + "NoGoods::Queens", + "Search::DFS::Sol::Binary::Nary::Binary::1::1::1", + "Set::Dom::Dom::Gr", + "Set::RelOp::ConstSSI::Union", + "Set::Sequence::SeqU1", + "Set::Wait", + nullptr + }; + + /// Representative cases retained from otherwise exhaustive sweep families + static const char* const normal_patterns[] = { + "Float::Arithmetic::Abs::XX::A", + "Float::Arithmetic::Div::A", + "Float::Arithmetic::Max::Bin::XXX::A", + "Float::Arithmetic::Min::Bin::XXX::A", + "Float::Arithmetic::Sqr::XX::A", + "Float::Arithmetic::Sqrt::XX::A", + "Float::Linear::Float::Eq::11::0::1", + "Float::Linear::Var::Eq::11::1", + "Float::MiniModel::LinExpr::000", + "Float::Transcendental::Exp::XX::A", + "Float::Transcendental::Log::XX::A", + "Float::Transcendental::Pow::N::1.5::XX::A", + "Float::Trigonometric::ACos::XX::A", + "Float::Trigonometric::ASin::XX::A", + "Float::Trigonometric::ATan::XX::A", + "Float::Trigonometric::Cos::XX::A", + "Float::Trigonometric::Sin::XX::A", + "Float::Trigonometric::Tan::XX::A", + "Int::Arithmetic::Nroot::XX::1::Bnd::A", + "Int::Arithmetic::Pow::XX::0::Bnd::A", + "Int::Channel::Bool::Multi::A", + "Int::Circuit::Cost::Dom::4::0", + "Int::Count::Distinct::Bnd::Dense", + "Int::Cumulative::Opt::Fix::-2147483646::-1", + "Int::Cumulative::Opt::Flex::-2147483646::4::0::2", + "Int::Distinct::Bnd::Dense", + "Int::Distinct::Dom::Dense", + "Int::Distinct::Offset::Dense::Bnd", + "Int::GCC::Int::All::Max::Bnd", + "Int::Linear::Int::Int::Eq::Bnd::11::0::1", + "Int::MiniModel::SetExpr::Const::000::0::0", + "Int::MiniModel::SetExpr::Expr::000::000::0", + "Int::NValues::Int::Int::Eq::1::0", + "Int::NoOverlap::Int::2::2::[1,1,1,1]::[1,1,1,1]", + "Int::Path::Cost::Dom::3::0", + "Int::Rel::Int::Array::Eq::0::4", + "Int::Unary::Man::Fix::-2147483646::[2,2,0,2,2]::Def+A", + "Int::Unary::Man::Flex::-2147483646::4::0::2::Def+A", + "Int::Unary::Opt::Fix::-2147483646::[2,2,0,2,2]::Def+A", + "Int::Unary::Opt::Flex::-2147483646::4::0::2::Def+A", + "Search::BAB::Sol::BalGr::Binary::Binary::Binary::1::1::1", + "Set::Branch::Dense::3", + "Set::Channel::Bool::1", + "Set::Element::Disjoint", + "Set::Precede::Multi::[1,2,3]", + "Set::Rel::Bin::Cmpl::S0", + "Set::RelOp::ConstISI::DUnion::Cmpl::0::0", + nullptr + }; + + /// Patterns for tests that are too heavy for the normal suite + static const char* const sweep_patterns[] = { + "FlatZinc::oss", + "FlatZinc::packing", + "FlatZinc::radiation", + "FlatZinc::steiner_triples", + "FlatZinc::template_design", + "FlatZinc::tenpenki", + "FlatZinc::timetabling", + "FlatZinc::trucking", + "Float::Arithmetic", + "Float::Linear::Float", + "Float::Linear::Var", + "Float::MiniModel::LinExpr", + "Float::Transcendental", + "Float::Trigonometric", + "Int::Arithmetic::Nroot", + "Int::Arithmetic::Pow", + "Int::Channel", + "Int::Circuit", + "Int::Count::Distinct", + "Int::Cumulative::Man", + "Int::Cumulative::Opt", + "Int::Distinct::Bnd", + "Int::Distinct::Dom", + "Int::Distinct::Offset", + "Int::Distinct::Pathological", + "Int::Extensional::TupleSet", + "Int::GCC", + "Int::Linear::Bool", + "Int::Linear::Int", + "Int::MiniModel::LinExpr", + "Int::MiniModel::SetExpr", + "Int::NValues::Int", + "Int::NoOverlap", + "Int::Path", + "Int::Rel::Int", + "Int::Unary", + "Search::BAB::Sol", + "Search::DFS::Sol", + "Set::Branch", + "Set::Channel", + "Set::Dom", + "Set::Element", + "Set::Precede", + "Set::Rel", + "Set::RelOp", + nullptr + }; + + static bool + matches_any_pattern(const std::string& name, + const char* const patterns[]) { + for (int i=0; patterns[i] != nullptr; i++) + if (name.find(patterns[i]) != std::string::npos) + return true; + return false; + } + + void + apply_gecode_test_tags(void) { + for (Base* test = Base::tests(); test != nullptr; + test = test->next()) { + const std::string& name = test->name(); + const bool check = matches_any_pattern(name, check_patterns); + const bool representative = matches_any_pattern(name, normal_patterns); + if (!check && !representative && + matches_any_pattern(name, sweep_patterns)) { + test->remove_tags(TestTag::normal); + test->add_tags(TestTag::sweep); + } + if (check) + test->add_tags(TestTag::check); + } + } + +} + +// STATISTICS: test-core diff --git a/test/gecode-tags.hh b/test/gecode-tags.hh new file mode 100644 index 0000000000..aea4e19c93 --- /dev/null +++ b/test/gecode-tags.hh @@ -0,0 +1,46 @@ +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + * Main authors: + * Mikael Lagerkvist + * + * Copyright: + * Mikael Lagerkvist, 2026 + * + * This file is part of Gecode, the generic constraint + * development environment: + * http://www.gecode.org + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef GECODE_TEST_GECODE_TAGS_HH +#define GECODE_TEST_GECODE_TAGS_HH + +namespace Test { + + /// Apply Gecode's suite classification to its registered tests + void apply_gecode_test_tags(void); + +} + +#endif + +// STATISTICS: test-core diff --git a/test/package/verify-installed-test-component.py b/test/package/verify-installed-test-component.py index 8aee630f5e..1ad568b9d1 100644 --- a/test/package/verify-installed-test-component.py +++ b/test/package/verify-installed-test-component.py @@ -232,7 +232,8 @@ def run_list_phase(consumer_binary: Path) -> None: def run_filtered_phase(consumer_binary: Path) -> None: result = run_phase( "filtered-run", - [str(consumer_binary), "-test", EXPECTED_TEST_NAME, "-iter", "1", "-stop", "true"], + [str(consumer_binary), "-tag", "normal", "-test", EXPECTED_TEST_NAME, + "-iter", "1", "-stop", "true"], ) assert_phase(EXPECTED_TEST_NAME in result.stdout, "filtered-run", "filtered run did not print the selected downstream test") assert_phase("+" in result.stdout, "filtered-run", "filtered run did not report success") diff --git a/test/public-runner-smoke.cpp b/test/public-runner-smoke.cpp index e359bc3ce2..cc088a3044 100644 --- a/test/public-runner-smoke.cpp +++ b/test/public-runner-smoke.cpp @@ -51,7 +51,7 @@ namespace { class PassingSmokeTest : public Test::Base { public: PassingSmokeTest(void) - : Test::Base("Smoke::A-Pass") {} + : Test::Base("Int::Linear::Int::Smoke::A-Pass") {} bool run(void) override { passing_runs++; @@ -62,7 +62,7 @@ namespace { class FailingSmokeTest : public Test::Base { public: FailingSmokeTest(void) - : Test::Base("Smoke::B-Fail") {} + : Test::Base("Smoke::B-Fail", Test::TestTag::sweep) {} bool run(void) override { failing_runs++; @@ -102,7 +102,7 @@ main(void) { "-list should succeed")) { return EXIT_FAILURE; } - const std::string pass_name = "Smoke::A-Pass"; + const std::string pass_name = "Int::Linear::Int::Smoke::A-Pass"; const std::string fail_name = "Smoke::B-Fail"; const std::size_t pass_pos = list_output.find(pass_name); const std::size_t fail_pos = list_output.find(fail_name); @@ -120,8 +120,40 @@ main(void) { return EXIT_FAILURE; } + std::string tagged_list_output; + if (!require(run_and_capture({"public-runner-smoke", "-list-with-tags"}, + tagged_list_output) == EXIT_SUCCESS, + "-list-with-tags should succeed")) { + return EXIT_FAILURE; + } + if (!require(tagged_list_output.find(pass_name + " [normal]") != std::string::npos, + "default test should have the normal tag")) { + return EXIT_FAILURE; + } + if (!require(tagged_list_output.find("Smoke::B-Fail [sweep]") != std::string::npos, + "explicit test tag should be listed")) { + return EXIT_FAILURE; + } + + std::string normal_output; + if (!require(run_and_capture({"public-runner-smoke", "-tag", "normal", + "-iter", "1", "-stop", "true"}, + normal_output) == EXIT_SUCCESS, + "normal tag selection should succeed")) { + return EXIT_FAILURE; + } + if (!require(normal_output.find(pass_name) != std::string::npos && + normal_output.find(fail_name) == std::string::npos, + "normal tag selection chose the wrong tests")) { + return EXIT_FAILURE; + } + if (!require(passing_runs == 1 && failing_runs == 0, + "normal tag selection run counts are wrong")) { + return EXIT_FAILURE; + } + std::string pass_output; - if (!require(run_and_capture({"public-runner-smoke", "-test", "Smoke::A-Pass", "-iter", "1", "-stop", "true"}, + if (!require(run_and_capture({"public-runner-smoke", "-test", "Int::Linear::Int::Smoke::A-Pass", "-iter", "1", "-stop", "true"}, pass_output) == EXIT_SUCCESS, "filtered passing run should succeed")) { return EXIT_FAILURE; @@ -138,7 +170,7 @@ main(void) { "filtered passing run did not report success")) { return EXIT_FAILURE; } - if (!require(passing_runs == 1 && failing_runs == 0, + if (!require(passing_runs == 2 && failing_runs == 0, "filtered passing run counts are wrong")) { return EXIT_FAILURE; } @@ -161,11 +193,28 @@ main(void) { "filtered failing run did not preserve test diagnostics")) { return EXIT_FAILURE; } - if (!require(passing_runs == 1 && failing_runs == 1, + if (!require(passing_runs == 2 && failing_runs == 1, "filtered failing run counts are wrong")) { return EXIT_FAILURE; } + std::string combined_output; + if (!require(run_and_capture({"public-runner-smoke", "-tag", "normal", + "-tag", "sweep", "-iter", "1", "-stop", "true"}, + combined_output) == EXIT_FAILURE, + "multiple tags should select their union")) { + return EXIT_FAILURE; + } + if (!require(combined_output.find(pass_name) != std::string::npos && + combined_output.find(fail_name) != std::string::npos, + "multiple tag selection did not run both tags")) { + return EXIT_FAILURE; + } + if (!require(passing_runs == 3 && failing_runs == 2, + "multiple tag selection run counts are wrong")) { + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } diff --git a/test/test-main.cpp b/test/test-main.cpp index e1451d93fa..433d454f9f 100644 --- a/test/test-main.cpp +++ b/test/test-main.cpp @@ -1,4 +1,4 @@ -/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* * Main authors: * Christian Schulte @@ -35,6 +35,7 @@ */ #include "test/test.hh" +#include "test/gecode-tags.hh" #ifdef GECODE_HAS_MTRACE #include @@ -45,6 +46,7 @@ main(int argc, char* argv[]) { #ifdef GECODE_HAS_MTRACE mtrace(); #endif + Test::apply_gecode_test_tags(); return Test::run_registered_tests(argc, argv); } diff --git a/test/test.cpp b/test/test.cpp index f00c70bfc0..85d7be0542 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -52,168 +52,33 @@ namespace Test { // Log stream std::ostringstream olog; - /// Names of tags supported by the test runner - static const char* tag_names[] = { - "check", - "normal", - "sweep", - nullptr + /// A command-line name and its corresponding test tag + struct TestTagDescription { + const char* name; + TestTag tag; }; - /// Masks of tags supported by the test runner - static const TestTag tag_values[] = { - TestTag::check, - TestTag::normal, - TestTag::sweep + /// Tags supported by the test runner + static const TestTagDescription test_tag_descriptions[] = { + {"check", TestTag::check}, + {"normal", TestTag::normal}, + {"sweep", TestTag::sweep} }; - /// Patterns that reproduce the historic make check selection - static const char* check_patterns[] = { - "Branch::Int::Dense::3", - "FlatZinc::Options", - "FlatZinc::magic_square", - "FlatZinc::blackbox", - "Float::Arithmetic::PositiveNRootBounds", - "Float::Arithmetic::PowConsistency", - "Float::Arithmetic::MultZeroEndpoint", - "Float::Arithmetic::Pow::N::2::XY::Sol::C", - "Float::Arithmetic::NRoot::N::2::XY::Sol::C", - "Float::Arithmetic::Mult::XYZ::Sol::C", - "Int::Arithmetic::Abs", - "Int::Arithmetic::ArgMax", - "Int::Arithmetic::Max::Nary", - "Int::Cumulative::Man::Fix::0::4", - "Int::Distinct::Random", - "Int::Extensional::TupleSet::Sparse::IncrementalDelta", - "Int::Extensional::TupleSet::Auto::DefaultDispatch", - "Int::Linear::Bool::Int::Lq", - "Int::MiniModel::LinExpr::Bool::352", - "NoGoods::Queens", - "Search::DFS::Sol::Binary::Nary::Binary::1::1::1", - "Set::Dom::Dom::Gr", - "Set::RelOp::ConstSSI::Union", - "Set::Sequence::SeqU1", - "Set::Wait", - nullptr - }; - - /// Representative cases retained from otherwise exhaustive sweep families - static const char* normal_patterns[] = { - "Float::Arithmetic::Abs::XX::A", - "Float::Arithmetic::Div::A", - "Float::Arithmetic::Max::Bin::XXX::A", - "Float::Arithmetic::Min::Bin::XXX::A", - "Float::Arithmetic::Sqr::XX::A", - "Float::Arithmetic::Sqrt::XX::A", - "Float::Linear::Float::Eq::11::0::1", - "Float::Linear::Var::Eq::11::1", - "Float::MiniModel::LinExpr::000", - "Float::Transcendental::Exp::XX::A", - "Float::Transcendental::Log::XX::A", - "Float::Transcendental::Pow::N::1.5::XX::A", - "Float::Trigonometric::ACos::XX::A", - "Float::Trigonometric::ASin::XX::A", - "Float::Trigonometric::ATan::XX::A", - "Float::Trigonometric::Cos::XX::A", - "Float::Trigonometric::Sin::XX::A", - "Float::Trigonometric::Tan::XX::A", - "Int::Arithmetic::Nroot::XX::1::Bnd::A", - "Int::Arithmetic::Pow::XX::0::Bnd::A", - "Int::Channel::Bool::Multi::A", - "Int::Circuit::Cost::Dom::4::0", - "Int::Count::Distinct::Bnd::Dense", - "Int::Cumulative::Opt::Fix::-2147483646::-1", - "Int::Cumulative::Opt::Flex::-2147483646::4::0::2", - "Int::Distinct::Bnd::Dense", - "Int::Distinct::Dom::Dense", - "Int::Distinct::Offset::Dense::Bnd", - "Int::GCC::Int::All::Max::Bnd", - "Int::Linear::Int::Int::Eq::Bnd::11::0::1", - "Int::MiniModel::SetExpr::Const::000::0::0", - "Int::MiniModel::SetExpr::Expr::000::000::0", - "Int::NValues::Int::Int::Eq::1::0", - "Int::NoOverlap::Int::2::2::[1,1,1,1]::[1,1,1,1]", - "Int::Path::Cost::Dom::3::0", - "Int::Rel::Int::Array::Eq::0::4", - "Int::Unary::Man::Fix::-2147483646::[2,2,0,2,2]::Def+A", - "Int::Unary::Man::Flex::-2147483646::4::0::2::Def+A", - "Int::Unary::Opt::Fix::-2147483646::[2,2,0,2,2]::Def+A", - "Int::Unary::Opt::Flex::-2147483646::4::0::2::Def+A", - "Search::BAB::Sol::BalGr::Binary::Binary::Binary::1::1::1", - "Set::Branch::Dense::3", - "Set::Channel::Bool::1", - "Set::Element::Disjoint", - "Set::Precede::Multi::[1,2,3]", - "Set::Rel::Bin::Cmpl::S0", - "Set::RelOp::ConstISI::DUnion::Cmpl::0::0", - nullptr - }; - - /// Patterns for tests that are too heavy for the normal suite - static const char* sweep_patterns[] = { - "FlatZinc::oss", - "FlatZinc::packing", - "FlatZinc::radiation", - "FlatZinc::steiner_triples", - "FlatZinc::template_design", - "FlatZinc::tenpenki", - "FlatZinc::timetabling", - "FlatZinc::trucking", - "Float::Arithmetic", - "Float::Linear::Float", - "Float::Linear::Var", - "Float::MiniModel::LinExpr", - "Float::Transcendental", - "Float::Trigonometric", - "Int::Arithmetic::Nroot", - "Int::Arithmetic::Pow", - "Int::Channel", - "Int::Circuit", - "Int::Count::Distinct", - "Int::Cumulative::Man", - "Int::Cumulative::Opt", - "Int::Distinct::Bnd", - "Int::Distinct::Dom", - "Int::Distinct::Offset", - "Int::Distinct::Pathological", - "Int::Extensional::TupleSet", - "Int::GCC", - "Int::Linear::Bool", - "Int::Linear::Int", - "Int::MiniModel::LinExpr", - "Int::MiniModel::SetExpr", - "Int::NValues::Int", - "Int::NoOverlap", - "Int::Path", - "Int::Rel::Int", - "Int::Unary", - "Search::BAB::Sol", - "Search::DFS::Sol", - "Set::Branch", - "Set::Channel", - "Set::Dom", - "Set::Element", - "Set::Precede", - "Set::Rel", - "Set::RelOp", - nullptr - }; - - /// Test whether \a s matches one of \a patterns as a substring - static bool - matches_any_pattern(const std::string& s, const char* patterns[]) { - for (int i=0; patterns[i] != nullptr; i++) - if (s.find(patterns[i]) != std::string::npos) - return true; - return false; + TestTags + TestTags::all(void) { + TestTags tags; + for (const TestTagDescription& description : test_tag_descriptions) + tags.add(description.tag); + return tags; } /// Return the tag set for \a name, or an empty set if not known static TestTags tag_set(const char* name) { - for (int i=0; tag_names[i] != nullptr; i++) - if (!strcmp(name, tag_names[i])) - return TestTags(tag_values[i]); + for (const TestTagDescription& description : test_tag_descriptions) + if (!strcmp(name, description.name)) + return TestTags(description.tag); if (!strcmp(name, "all")) return TestTags::all(); return TestTags(); @@ -222,19 +87,31 @@ namespace Test { /// Print all tag names static void print_tags(std::ostream& os) { - for (int i=0; tag_names[i] != nullptr; i++) - os << tag_names[i] << std::endl; + for (const TestTagDescription& description : test_tag_descriptions) + os << description.name << std::endl; + } + + /// Convert the known tag names to a command-line choice list + static std::string + tag_choices(void) { + std::string choices; + for (const TestTagDescription& description : test_tag_descriptions) { + if (!choices.empty()) + choices += "|"; + choices += description.name; + } + return choices + "|all"; } /// Convert \a tags to a comma-separated string static std::string tags_to_string(TestTags tags) { std::string s; - for (int i=0; tag_names[i] != nullptr; i++) { - if (tags.overlaps(TestTags(tag_values[i]))) { + for (const TestTagDescription& description : test_tag_descriptions) { + if (tags.overlaps(TestTags(description.tag))) { if (!s.empty()) s += ","; - s += tag_names[i]; + s += description.name; } } return s; @@ -245,7 +122,7 @@ namespace Test { * */ Base::Base(std::string s) - : Base(s, default_tags(s)) {} + : Base(s, TestTag::normal) {} Base::Base(std::string s, TestTags t) : _name(std::move(s)), _tags(t), _next(_tests), _rand(Gecode::Support::RandomGenerator()) { @@ -282,18 +159,6 @@ namespace Test { Base::~Base() = default; - TestTags - Base::default_tags(const std::string& s) { - const bool check = matches_any_pattern(s, check_patterns); - const bool normal = matches_any_pattern(s, normal_patterns); - TestTags tags(TestTag::normal); - if (!check && !normal && matches_any_pattern(s, sweep_patterns)) - tags = TestTags(TestTag::sweep); - if (check) - tags.add(TestTag::check); - return tags; - } - Options opt; void report_error(const std::string& name, unsigned int seed, const Options& options, std::ostream& ostream) { @@ -333,7 +198,7 @@ namespace Test { << "\t\tprefixing with \"^\" requires a match at the beginning" << std::endl << "\t\tmultiple pattern-options may be given" << std::endl - << "\t-tag (check|normal|sweep|all) default: (none)" << std::endl + << "\t-tag (" << tag_choices() << ") default: (none)" << std::endl << "\t\ttag for the tests to run" << std::endl << "\t\tmultiple tag-options may be given" << std::endl diff --git a/test/test.hh b/test/test.hh index 0507db8279..e1659eebd9 100755 --- a/test/test.hh +++ b/test/test.hh @@ -173,7 +173,7 @@ namespace Test { /// How many tests static unsigned int _n_tests; public: - /// Create and register test with name \a s + /// Create and register a normal test with name \a s Base(std::string s); /// Create and register test with name \a s and tags \a t Base(std::string s, TestTags t); @@ -187,8 +187,6 @@ namespace Test { void add_tags(TestTags t); /// Remove tags \a t from test void remove_tags(TestTags t); - /// Return default tags for test named \a s - static TestTags default_tags(const std::string& s); /// Return all tests static Base* tests(void); /// Return next test diff --git a/test/test.hpp b/test/test.hpp index 889004305d..7f77ae7ffc 100755 --- a/test/test.hpp +++ b/test/test.hpp @@ -46,12 +46,6 @@ namespace Test { inline TestTags::TestTags(TestTag t) : _mask(static_cast(t)) {} - inline TestTags - TestTags::all(void) { - return TestTags(static_cast(TestTag::check) | - static_cast(TestTag::normal) | - static_cast(TestTag::sweep)); - } inline bool TestTags::empty(void) const { return _mask == 0; From 6a114c13ce02e4373cc4aa93222aa5b9afefc03f Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Sun, 6 Sep 2026 14:37:47 +0200 Subject: [PATCH 08/10] Declare test tags with test definitions --- CMakeLists.txt | 1 - Makefile.in | 4 +- cmake/GecodeSources.cmake | 1 - test/branch/set.cpp | 4 +- test/flatzinc.cpp | 25 +++- test/flatzinc.hh | 12 ++ test/flatzinc/blackbox.cpp | 42 +++--- test/flatzinc/magicsq_3.cpp | 2 +- test/flatzinc/magicsq_4.cpp | 2 +- test/flatzinc/magicsq_5.cpp | 2 +- test/flatzinc/oss.cpp | 2 +- test/flatzinc/packing.cpp | 2 +- test/flatzinc/radiation.cpp | 2 +- test/flatzinc/steiner_triples.cpp | 2 +- test/flatzinc/template_design.cpp | 2 +- test/flatzinc/tenpenki_1.cpp | 2 +- test/flatzinc/tenpenki_2.cpp | 2 +- test/flatzinc/tenpenki_3.cpp | 2 +- test/flatzinc/tenpenki_4.cpp | 2 +- test/flatzinc/tenpenki_5.cpp | 2 +- test/flatzinc/tenpenki_6.cpp | 2 +- test/flatzinc/timetabling.cpp | 2 +- test/flatzinc/trucking.cpp | 2 +- test/float.hh | 9 +- test/float.hpp | 33 +++-- test/float/arithmetic.cpp | 107 ++++++++++------ test/float/linear.cpp | 8 +- test/float/mm-lin.cpp | 3 +- test/float/transcendental.cpp | 29 +++-- test/float/trigonometric.cpp | 42 +++--- test/gecode-tags.cpp | 204 ------------------------------ test/gecode-tags.hh | 46 ------- test/int.hh | 17 ++- test/int.hpp | 40 ++++-- test/int/arithmetic.cpp | 40 ++++-- test/int/channel.cpp | 12 +- test/int/circuit.cpp | 14 +- test/int/cumulative.cpp | 17 ++- test/int/distinct.cpp | 18 ++- test/int/extensional.cpp | 62 +++++---- test/int/gcc.cpp | 13 +- test/int/linear.cpp | 15 ++- test/int/mm-lin.cpp | 11 +- test/int/no-overlap.cpp | 14 +- test/int/nvalues.cpp | 8 +- test/int/rel.cpp | 18 +-- test/int/unary.cpp | 22 +++- test/nogoods.cpp | 5 +- test/search.cpp | 22 +++- test/set.hh | 6 +- test/set/channel.cpp | 10 +- test/set/dom.cpp | 18 ++- test/set/element.cpp | 16 +-- test/set/exec.cpp | 4 +- test/set/mm-set.cpp | 8 +- test/set/precede.cpp | 6 +- test/set/rel-op-const.cpp | 17 ++- test/set/rel-op.cpp | 6 +- test/set/rel.cpp | 4 +- test/set/sequence.cpp | 5 +- test/test-main.cpp | 2 - test/test.hh | 4 + test/test.hpp | 8 ++ 63 files changed, 548 insertions(+), 516 deletions(-) delete mode 100644 test/gecode-tags.cpp delete mode 100644 test/gecode-tags.hh diff --git a/CMakeLists.txt b/CMakeLists.txt index bfbb7f454d..217729001e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -816,7 +816,6 @@ if(GECODE_ENABLE_FAULT_INJECTION) list(APPEND GECODE_SUPPORT_SOURCES gecode/support/failpoint.cpp) set(GECODE_FAULT_TEST_SOURCES test/test-main.cpp - test/gecode-tags.cpp test/fault.cpp) endif() diff --git a/Makefile.in b/Makefile.in index 96799ff83d..7d7fa154f9 100755 --- a/Makefile.in +++ b/Makefile.in @@ -1279,7 +1279,7 @@ BLACKBOXSRC = $(BLACKBOXEXECSRC) $(BLACKBOXDLLSRC) TESTCORESRC = test/test.cpp TESTCOREOBJ = $(TESTCORESRC:%.cpp=%$(OBJSUFFIX)) -TESTMAINSRC = test/test-main.cpp test/gecode-tags.cpp +TESTMAINSRC = test/test-main.cpp TESTMAINOBJ = $(TESTMAINSRC:%.cpp=%$(OBJSUFFIX)) TESTINTSEAMSRC = test/int.cpp TESTINTSEAMOBJ = $(TESTINTSEAMSRC:%.cpp=%$(OBJSUFFIX)) @@ -1299,7 +1299,7 @@ TESTSRC = \ $(ARRAYTESTSRC0) $(FLATZINCTESTSRC0) $(BLACKBOXSRC) TESTHDR0 = \ - test.hh test.hpp gecode-tags.hh int.hh int.hpp set.hh set.hpp float.hh float.hpp \ + test.hh test.hpp int.hh int.hpp set.hh set.hpp float.hh float.hpp \ branch.hh assign.hh flatzinc.hh TESTHDR = $(TESTHDR0:%=test/%) diff --git a/cmake/GecodeSources.cmake b/cmake/GecodeSources.cmake index 773e389246..264fb747c1 100644 --- a/cmake/GecodeSources.cmake +++ b/cmake/GecodeSources.cmake @@ -254,7 +254,6 @@ set(GECODE_TEST_INT_SOURCES set(GECODE_TEST_MAIN_SOURCES test/test-main.cpp - test/gecode-tags.cpp ) set(GECODE_TEST_PUBLIC_RUNNER_SMOKE_SOURCE test/public-runner-smoke.cpp) set(GECODE_TEST_PUBLIC_INT_SMOKE_SOURCE test/public-int-smoke.cpp) diff --git a/test/branch/set.cpp b/test/branch/set.cpp index 2ec3d914bb..401a6e6c68 100644 --- a/test/branch/set.cpp +++ b/test/branch/set.cpp @@ -42,7 +42,9 @@ namespace Test { namespace Branch { public: /// Create and register test Set(const std::string& s, const Gecode::IntSet& d, int n) - : SetTest(s,n,d) {} + : SetTest(s,n,d) { + tags(s == "Dense::3" ? TestTag::normal : TestTag::sweep); + } /// Post propagators on variables \a x virtual void post(Gecode::Space& home, Gecode::SetVarArray& x) { Gecode::SetVarArgs xx(x.size()-1); diff --git a/test/flatzinc.cpp b/test/flatzinc.cpp index b7c1873b0b..5417997651 100755 --- a/test/flatzinc.cpp +++ b/test/flatzinc.cpp @@ -81,7 +81,9 @@ namespace Test { namespace FlatZinc { } public: GistStatisticsMode(void) - : Base("FlatZinc::Options::GistStatisticsMode") {} + : Base("FlatZinc::Options::GistStatisticsMode") { + add_tags(TestTag::check); + } virtual bool run(void) { return @@ -96,6 +98,7 @@ namespace Test { namespace FlatZinc { #ifndef GECODE_HAS_GIST /// Verify that unavailable Gist mode is rejected instead of running search. FlatZincErrorTest gist_unavailable( + TestTags(TestTag::normal,TestTag::check), "Options::GistUnavailable", "var 1..1: x :: output_var;\nsolve satisfy;\n", {"-mode", "gist", "-s"}, @@ -108,7 +111,16 @@ namespace Test { namespace FlatZinc { const std::string& expected, bool allSolutions, std::vector cmdlineOpt, OutputCheck check, BeforeRun before) - : Base("FlatZinc::"+name), _name(name), _source(source), _expected(expected), + : FlatZincTest(TestTag::normal, name, source, expected, allSolutions, + cmdlineOpt, check, before) {} + + FlatZincTest::FlatZincTest(TestTags tags, const std::string& name, + const std::string& source, + const std::string& expected, bool allSolutions, + std::vector cmdlineOpt, + OutputCheck check, BeforeRun before) + : Base("FlatZinc::"+name, tags), _name(name), _source(source), + _expected(expected), _allSolutions(allSolutions), _cmdlineOpt(cmdlineOpt), _check(check), _before(before) {} @@ -116,7 +128,14 @@ namespace Test { namespace FlatZinc { const std::string& source, std::vector cmdlineOpt, std::string expectedMessage) - : FlatZincTest(name, source, "", false, cmdlineOpt), + : FlatZincErrorTest(TestTag::normal, name, source, cmdlineOpt, + expectedMessage) {} + + FlatZincErrorTest::FlatZincErrorTest(TestTags tags, const std::string& name, + const std::string& source, + std::vector cmdlineOpt, + std::string expectedMessage) + : FlatZincTest(tags, name, source, "", false, cmdlineOpt), _expectedMessage(expectedMessage) {} bool diff --git a/test/flatzinc.hh b/test/flatzinc.hh index 4295a007e8..98716ba380 100644 --- a/test/flatzinc.hh +++ b/test/flatzinc.hh @@ -70,6 +70,13 @@ namespace Test { std::vector cmdlineOpt = {}, OutputCheck check = OutputCheck(), BeforeRun before = BeforeRun()); + /// Construct and register a test with explicitly assigned tags + FlatZincTest(TestTags tags, const std::string& name, + const std::string& source, const std::string& expected, + bool allSolutions = false, + std::vector cmdlineOpt = {}, + OutputCheck check = OutputCheck(), + BeforeRun before = BeforeRun()); /// Perform test virtual bool run(void); }; @@ -82,6 +89,11 @@ namespace Test { FlatZincErrorTest(const std::string& name, const std::string& source, std::vector cmdlineOpt = {}, std::string expectedMessage = ""); + /// Construct and register an error test with explicitly assigned tags + FlatZincErrorTest(TestTags tags, const std::string& name, + const std::string& source, + std::vector cmdlineOpt = {}, + std::string expectedMessage = ""); /// Perform test virtual bool run(void); }; diff --git a/test/flatzinc/blackbox.cpp b/test/flatzinc/blackbox.cpp index 9f6acbe696..7a1d443f77 100644 --- a/test/flatzinc/blackbox.cpp +++ b/test/flatzinc/blackbox.cpp @@ -256,7 +256,9 @@ namespace Test { namespace FlatZinc { namespace Blackbox { class NativeProtocol : public Base { public: - NativeProtocol(void) : Base("FlatZinc::blackbox::native_protocol") {} + NativeProtocol(void) : Base("FlatZinc::blackbox::native_protocol") { + add_tags(TestTag::check); + } virtual bool run(void) { std::vector int_input{-2}; std::vector float_input{1.25}; @@ -372,7 +374,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { (void) new NativeProtocol; - (void) new FlatZincErrorTest("blackbox::malformed_annotation", + (void) new FlatZincErrorTest(TestTags(TestTag::normal,TestTag::check),"blackbox::malformed_annotation", std::string(blackbox_decl) + "var 0..1: y;\n" "constraint gecode_blackbox([], [], [y], []) :: " @@ -384,7 +386,7 @@ namespace Test { namespace FlatZinc { const char* exec = std::getenv("GECODE_TEST_BLACKBOX_EXEC"); if (exec != nullptr) { const std::string executable(exec); - (void) new FlatZincTest("blackbox::constant_value", + (void) new FlatZincTest(TestTags(TestTag::normal,TestTag::check),"blackbox::constant_value", std::string(blackbox_decl) + "var 7..7: y :: output_var;\n" "constraint gecode_blackbox([], [], [y], []) :: " + @@ -392,7 +394,7 @@ namespace Test { namespace FlatZinc { "solve satisfy;\n", "y = 7;\n----------\n"); - (void) new FlatZincTest("blackbox::constant_value_unsat", + (void) new FlatZincTest(TestTags(TestTag::normal,TestTag::check),"blackbox::constant_value_unsat", std::string(blackbox_decl) + "var 8..8: y;\n" "constraint gecode_blackbox([], [], [y], []) :: " + @@ -400,7 +402,7 @@ namespace Test { namespace FlatZinc { "solve satisfy;\n", "=====UNSATISFIABLE=====\n"); - (void) new FlatZincTest("blackbox::reason_independent_bounds", + (void) new FlatZincTest(TestTags(TestTag::normal,TestTag::check),"blackbox::reason_independent_bounds", std::string(blackbox_bounds_decl) + "var 5..5: x :: output_var;\n" "constraint gecode_blackbox_bounds([x], [], [1,0,0]) :: " + @@ -408,7 +410,7 @@ namespace Test { namespace FlatZinc { "solve satisfy;\n", "x = 5;\n----------\n"); - (void) new FlatZincTest("blackbox::reason_independent_bounds_unsat", + (void) new FlatZincTest(TestTags(TestTag::normal,TestTag::check),"blackbox::reason_independent_bounds_unsat", std::string(blackbox_bounds_decl) + "var 6..6: x;\n" "constraint gecode_blackbox_bounds([x], [], [1,0,0]) :: " + @@ -416,7 +418,7 @@ namespace Test { namespace FlatZinc { "solve satisfy;\n", "=====UNSATISFIABLE=====\n"); - (void) new FlatZincTest("blackbox::reason_dependent_bounds", + (void) new FlatZincTest(TestTags(TestTag::normal,TestTag::check),"blackbox::reason_dependent_bounds", std::string(blackbox_bounds_decl) + "var 5..5: x :: output_var;\n" "constraint gecode_blackbox_bounds([x], [], [1,1,1,1,0]) :: " + @@ -424,7 +426,7 @@ namespace Test { namespace FlatZinc { "solve satisfy;\n", "x = 5;\n----------\n"); - (void) new FlatZincTest("blackbox::bounds_rescheduled_after_branch", + (void) new FlatZincTest(TestTags(TestTag::normal,TestTag::check),"blackbox::bounds_rescheduled_after_branch", std::string(blackbox_bounds_decl) + "var 0..1: x :: output_var;\n" "var 0..5: y :: output_var;\n" @@ -438,7 +440,7 @@ namespace Test { namespace FlatZinc { false, {"-a"}); #ifdef GECODE_HAS_FLOAT_VARS - (void) new FlatZincErrorTest("blackbox::missing_bounds_reason_entry", + (void) new FlatZincErrorTest(TestTags(TestTag::normal,TestTag::check),"blackbox::missing_bounds_reason_entry", std::string(blackbox_bounds_decl) + "var 0..10: x;\n" "var 0.0..10.0: y;\n" @@ -447,7 +449,7 @@ namespace Test { namespace FlatZinc { "solve satisfy;\n", {}, "missing explained variable entry"); #endif - (void) new FlatZincErrorTest("blackbox::duplicate_bounds_reason_entry", + (void) new FlatZincErrorTest(TestTags(TestTag::normal,TestTag::check),"blackbox::duplicate_bounds_reason_entry", std::string(blackbox_bounds_decl) + "var 0..10: x;\n" "var 0..10: y;\n" @@ -455,7 +457,7 @@ namespace Test { namespace FlatZinc { fixture_annotation("exec", executable, {"bounds4"}) + ";\n" "solve satisfy;\n", {}, "duplicate explained variable index"); - (void) new FlatZincErrorTest("blackbox::invalid_bounds_reason_code", + (void) new FlatZincErrorTest(TestTags(TestTag::normal,TestTag::check),"blackbox::invalid_bounds_reason_code", std::string(blackbox_bounds_decl) + "var 0..10: x;\n" "constraint gecode_blackbox_bounds([x], [], [1,1,1,0,0]) :: " + @@ -463,7 +465,7 @@ namespace Test { namespace FlatZinc { "solve satisfy;\n", {}, "dependency bound code is out of range"); #ifdef GECODE_HAS_FLOAT_VARS - (void) new FlatZincErrorTest("blackbox::invalid_float_output", + (void) new FlatZincErrorTest(TestTags(TestTag::normal,TestTag::check),"blackbox::invalid_float_output", std::string(blackbox_decl) + "var 0.0..10.0: y;\n" "constraint gecode_blackbox([], [], [], [y]) :: " + @@ -471,13 +473,13 @@ namespace Test { namespace FlatZinc { "solve satisfy;\n", {}, "Failed to read output float 0"); #endif - (void) new FlatZincErrorTest("blackbox::nul_output", + (void) new FlatZincErrorTest(TestTags(TestTag::normal,TestTag::check),"blackbox::nul_output", std::string(blackbox_decl) + "constraint gecode_blackbox([], [], [], []) :: " + fixture_annotation("exec", executable, {"nul"}) + ";\n" "solve satisfy;\n", {}, "response contains NUL data"); - (void) new FlatZincErrorTest("blackbox::malformed_exec_parallel", + (void) new FlatZincErrorTest(TestTags(TestTag::normal,TestTag::check),"blackbox::malformed_exec_parallel", std::string(blackbox_decl) + "var 0..1: x :: output_var;\n" "var 0..1: y :: output_var;\n" @@ -506,7 +508,7 @@ namespace Test { namespace FlatZinc { expected = "integer 0 is outside Gecode's integer range"; break; } - (void) new FlatZincErrorTest( + (void) new FlatZincErrorTest(TestTags(TestTag::normal,TestTag::check), "blackbox::native_exec_fault_" + std::to_string(kind), std::string(blackbox_decl) + "var " + std::to_string(kind) + ".." + std::to_string(kind) + @@ -526,7 +528,7 @@ namespace Test { namespace FlatZinc { #if defined(GECODE_HAS_POSIX_BLACKBOX_EXEC) const std::string descendant_log = fixture_log("exec_descendant"); if (!descendant_log.empty()) { - (void) new FlatZincTest("blackbox::native_exec_descendant_cleanup", + (void) new FlatZincTest(TestTags(TestTag::normal,TestTag::check),"blackbox::native_exec_descendant_cleanup", std::string(blackbox_decl) + "var 1..1: y :: output_var;\n" "constraint gecode_blackbox([], [], [y], []) :: " + @@ -542,7 +544,7 @@ namespace Test { namespace FlatZinc { #endif } - (void) new FlatZincErrorTest("blackbox::missing_exec_parallel", + (void) new FlatZincErrorTest(TestTags(TestTag::normal,TestTag::check),"blackbox::missing_exec_parallel", std::string(blackbox_decl) + "var 0..1: x :: output_var;\n" "var 0..1: y :: output_var;\n" @@ -552,7 +554,7 @@ namespace Test { namespace FlatZinc { "satisfy;\n", {"-p", "2"}, "starting blackbox process failed"); - (void) new FlatZincErrorTest("blackbox::missing_exec_root_status", + (void) new FlatZincErrorTest(TestTags(TestTag::normal,TestTag::check),"blackbox::missing_exec_root_status", std::string(blackbox_decl) + "var 0..0: x :: output_var;\n" "var 0..1: y :: output_var;\n" @@ -567,7 +569,7 @@ namespace Test { namespace FlatZinc { const std::string library(dll); const std::string dll_model_log = fixture_log("dll_model"); if (!dll_model_log.empty()) { - (void) new FlatZincTest("blackbox::native_dll_per_constraint", + (void) new FlatZincTest(TestTags(TestTag::normal,TestTag::check),"blackbox::native_dll_per_constraint", std::string(blackbox_decl) + "var 1..1: a :: output_var;\n" "var 1..1: b :: output_var;\n" @@ -594,7 +596,7 @@ namespace Test { namespace FlatZinc { #endif #ifdef GECODE_HAS_FLOAT_VARS - (void) new FlatZincErrorTest("blackbox::native_dll_nonfinite", + (void) new FlatZincErrorTest(TestTags(TestTag::normal,TestTag::check),"blackbox::native_dll_nonfinite", std::string(blackbox_decl) + "var 0.0..1.0: y;\n" "constraint gecode_blackbox([], [], [], [y]) :: " + diff --git a/test/flatzinc/magicsq_3.cpp b/test/flatzinc/magicsq_3.cpp index 6a6e34c48e..27f40f7737 100755 --- a/test/flatzinc/magicsq_3.cpp +++ b/test/flatzinc/magicsq_3.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("magic_square::3", + (void) new FlatZincTest(TestTags(TestTag::normal,TestTag::check),"magic_square::3", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ predicate among(var int: n, array [int] of var int: x, set of int: v);\n\ diff --git a/test/flatzinc/magicsq_4.cpp b/test/flatzinc/magicsq_4.cpp index 2bea231a5e..807200b1e4 100755 --- a/test/flatzinc/magicsq_4.cpp +++ b/test/flatzinc/magicsq_4.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("magic_square::4", + (void) new FlatZincTest(TestTags(TestTag::normal,TestTag::check),"magic_square::4", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ predicate among(var int: n, array [int] of var int: x, set of int: v);\n\ diff --git a/test/flatzinc/magicsq_5.cpp b/test/flatzinc/magicsq_5.cpp index 67d7f0679b..6ab2b86e1a 100644 --- a/test/flatzinc/magicsq_5.cpp +++ b/test/flatzinc/magicsq_5.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("magic_square::5", + (void) new FlatZincTest(TestTags(TestTag::normal,TestTag::check),"magic_square::5", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ predicate among(var int: n, array [int] of var int: x, set of int: v);\n\ diff --git a/test/flatzinc/oss.cpp b/test/flatzinc/oss.cpp index bbd0fdbf63..541e206b61 100644 --- a/test/flatzinc/oss.cpp +++ b/test/flatzinc/oss.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("oss", + (void) new FlatZincTest(TestTag::sweep,"oss", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ diff --git a/test/flatzinc/packing.cpp b/test/flatzinc/packing.cpp index 973cfac414..cce832a6e4 100644 --- a/test/flatzinc/packing.cpp +++ b/test/flatzinc/packing.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("packing", + (void) new FlatZincTest(TestTag::sweep,"packing", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ diff --git a/test/flatzinc/radiation.cpp b/test/flatzinc/radiation.cpp index 29589d59d4..c583d75875 100644 --- a/test/flatzinc/radiation.cpp +++ b/test/flatzinc/radiation.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("radiation", + (void) new FlatZincTest(TestTag::sweep,"radiation", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ diff --git a/test/flatzinc/steiner_triples.cpp b/test/flatzinc/steiner_triples.cpp index 55c513c6a5..7beee4cd38 100644 --- a/test/flatzinc/steiner_triples.cpp +++ b/test/flatzinc/steiner_triples.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("steiner_triples", + (void) new FlatZincTest(TestTag::sweep,"steiner_triples", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ diff --git a/test/flatzinc/template_design.cpp b/test/flatzinc/template_design.cpp index 7c089981cf..e3c33c16af 100644 --- a/test/flatzinc/template_design.cpp +++ b/test/flatzinc/template_design.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("template_design", + (void) new FlatZincTest(TestTag::sweep,"template_design", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ predicate among(var int: n, array [int] of var int: x, set of int: v);\n\ diff --git a/test/flatzinc/tenpenki_1.cpp b/test/flatzinc/tenpenki_1.cpp index 68890a63b3..9e9521a4f3 100644 --- a/test/flatzinc/tenpenki_1.cpp +++ b/test/flatzinc/tenpenki_1.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("tenpenki::1", + (void) new FlatZincTest(TestTag::sweep,"tenpenki::1", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ diff --git a/test/flatzinc/tenpenki_2.cpp b/test/flatzinc/tenpenki_2.cpp index c244be6c8c..791a1b88ba 100644 --- a/test/flatzinc/tenpenki_2.cpp +++ b/test/flatzinc/tenpenki_2.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("tenpenki::1", + (void) new FlatZincTest(TestTag::sweep,"tenpenki::1", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ diff --git a/test/flatzinc/tenpenki_3.cpp b/test/flatzinc/tenpenki_3.cpp index d56e56dff1..bbceae472b 100644 --- a/test/flatzinc/tenpenki_3.cpp +++ b/test/flatzinc/tenpenki_3.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("tenpenki::3", + (void) new FlatZincTest(TestTag::sweep,"tenpenki::3", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ diff --git a/test/flatzinc/tenpenki_4.cpp b/test/flatzinc/tenpenki_4.cpp index 06b516ca30..ee9e2e6b47 100644 --- a/test/flatzinc/tenpenki_4.cpp +++ b/test/flatzinc/tenpenki_4.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("tenpenki::4", + (void) new FlatZincTest(TestTag::sweep,"tenpenki::4", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ diff --git a/test/flatzinc/tenpenki_5.cpp b/test/flatzinc/tenpenki_5.cpp index 6227db4c82..bffbd629fe 100644 --- a/test/flatzinc/tenpenki_5.cpp +++ b/test/flatzinc/tenpenki_5.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("tenpenki::5", + (void) new FlatZincTest(TestTag::sweep,"tenpenki::5", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ diff --git a/test/flatzinc/tenpenki_6.cpp b/test/flatzinc/tenpenki_6.cpp index f2eb06cdd7..9bb7904425 100644 --- a/test/flatzinc/tenpenki_6.cpp +++ b/test/flatzinc/tenpenki_6.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("tenpenki::6", + (void) new FlatZincTest(TestTag::sweep,"tenpenki::6", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ diff --git a/test/flatzinc/timetabling.cpp b/test/flatzinc/timetabling.cpp index 06ac050619..f02ce689e8 100644 --- a/test/flatzinc/timetabling.cpp +++ b/test/flatzinc/timetabling.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("timetabling", + (void) new FlatZincTest(TestTag::sweep,"timetabling", std::string("predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ predicate among(var int: n, array [int] of var int: x, set of int: v);\n\ diff --git a/test/flatzinc/trucking.cpp b/test/flatzinc/trucking.cpp index 06fb86ccae..fa9394cae4 100644 --- a/test/flatzinc/trucking.cpp +++ b/test/flatzinc/trucking.cpp @@ -42,7 +42,7 @@ namespace Test { namespace FlatZinc { /// Perform creation and registration Create(void) { - (void) new FlatZincTest("trucking", + (void) new FlatZincTest(TestTag::sweep,"trucking", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ diff --git a/test/float.hh b/test/float.hh index 84ccb562b6..e5431693e3 100644 --- a/test/float.hh +++ b/test/float.hh @@ -282,6 +282,10 @@ namespace Test { Test(const std::string& s, int a, const Gecode::FloatVal& d, Gecode::FloatNum st, AssignmentType at, bool r); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& s, int a, + const Gecode::FloatVal& d, Gecode::FloatNum st, + AssignmentType at, bool r); /** * \brief Constructor * @@ -293,6 +297,10 @@ namespace Test { Gecode::FloatNum min, Gecode::FloatNum max, Gecode::FloatNum st, AssignmentType at, bool r); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& s, int a, + Gecode::FloatNum min, Gecode::FloatNum max, + Gecode::FloatNum st, AssignmentType at, bool r); /// Create assignment virtual Assignment* assignment(void) const; /// Complete the current assignment to get a feasible one (which satisfies all constraint). @@ -370,4 +378,3 @@ std::ostream& operator<<(std::ostream& os, const Test::Float::Assignment& a); #endif // STATISTICS: test-float - diff --git a/test/float.hpp b/test/float.hpp index f84273e509..4a05788233 100755 --- a/test/float.hpp +++ b/test/float.hpp @@ -170,25 +170,37 @@ namespace Test { namespace Float { return reified && ((rms & (1 << Gecode::RM_PMI)) != 0); } inline - Test::Test(const std::string& s, int a, const Gecode::FloatVal& d, - Gecode::FloatNum st, AssignmentType at, - bool r) - : Base("Float::"+s), arity(a), dom(d), step(st), assignmentType(at), + Test::Test(TestTags tags, const std::string& s, int a, + const Gecode::FloatVal& d, Gecode::FloatNum st, + AssignmentType at, bool r) + : Base("Float::"+s, tags), arity(a), dom(d), step(st), assignmentType(at), reified(r), rms((1 << Gecode::RM_EQV) | (1 << Gecode::RM_IMP) | (1 << Gecode::RM_PMI)), testsearch(true), testfix(true), testsubsumed(true) {} + inline + Test::Test(const std::string& s, int a, const Gecode::FloatVal& d, + Gecode::FloatNum st, AssignmentType at, + bool r) + : Test(TestTag::normal,s,a,d,st,at,r) {} + + inline + Test::Test(TestTags tags, const std::string& s, int a, + Gecode::FloatNum min, Gecode::FloatNum max, + Gecode::FloatNum st, AssignmentType at, bool r) + : Base("Float::"+s, tags), arity(a), dom(min,max), step(st), + assignmentType(at), reified(r), + rms((1 << Gecode::RM_EQV) | + (1 << Gecode::RM_IMP) | + (1 << Gecode::RM_PMI)), + testsearch(true), testfix(true), testsubsumed(true) {} + inline Test::Test(const std::string& s, int a, Gecode::FloatNum min, Gecode::FloatNum max, Gecode::FloatNum st, AssignmentType at, bool r) - : Base("Float::"+s), arity(a), dom(min,max), step(st), - assignmentType(at), reified(r), - rms((1 << Gecode::RM_EQV) | - (1 << Gecode::RM_IMP) | - (1 << Gecode::RM_PMI)), - testsearch(true), testfix(true), testsubsumed(true) {} + : Test(TestTag::normal,s,a,min,max,st,at,r) {} inline std::string @@ -309,4 +321,3 @@ namespace Test { namespace Float { }} // STATISTICS: test-float - diff --git a/test/float/arithmetic.cpp b/test/float/arithmetic.cpp index 7044a2543a..d438b959c8 100755 --- a/test/float/arithmetic.cpp +++ b/test/float/arithmetic.cpp @@ -134,7 +134,9 @@ namespace Test { namespace Float { public: /// Create and register test PositiveNRootBounds(void) - : Base("Float::Arithmetic::PositiveNRootBounds") {} + : Base("Float::Arithmetic::PositiveNRootBounds") { + add_tags(TestTag::check); + } /// Run test under every supported IEEE-754 rounding mode virtual bool run(void) { const int oldMode = std::fegetround(); @@ -364,7 +366,9 @@ namespace Test { namespace Float { } public: /// Create and register test - PowConsistency(void) : Base("Float::Arithmetic::PowConsistency") {} + PowConsistency(void) : Base("Float::Arithmetic::PowConsistency") { + add_tags(TestTag::check); + } /// Run zero and fixpoint regressions virtual bool run(void) { bool result = true; @@ -486,7 +490,9 @@ namespace Test { namespace Float { public: /// Create and register test MultZeroEndpoint(void) - : Base("Float::Arithmetic::MultZeroEndpoint") {} + : Base("Float::Arithmetic::MultZeroEndpoint") { + add_tags(TestTag::check); + } /// Run sign, symmetry, signed-zero, and zero-product cases virtual bool run(void) { bool result = true; @@ -525,7 +531,7 @@ namespace Test { namespace Float { public: /// Create and register test MultXYZ(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Mult::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Mult::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[1], x[2]); @@ -544,7 +550,12 @@ namespace Test { namespace Float { public: /// Create and register test MultXYZSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Mult::XYZ::Sol::"+s,3,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Mult::XYZ::Sol::"+s,3,d,st,EXTEND_ASSIGNMENT,false) { + if (s == "C") { + tags(TestTag::normal); + add_tags(TestTag::check); + } + } /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[1], x[2]); @@ -570,7 +581,7 @@ namespace Test { namespace Float { public: /// Create and register test MultXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Mult::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Mult::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[0], x[1]); @@ -586,7 +597,7 @@ namespace Test { namespace Float { public: /// Create and register test MultXXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Mult::XXY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Mult::XXY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[0], x[1]); @@ -612,7 +623,7 @@ namespace Test { namespace Float { public: /// Create and register test MultXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Mult::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Mult::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[1], x[0]); @@ -628,7 +639,7 @@ namespace Test { namespace Float { public: /// Create and register test MultXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Mult::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Mult::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[1], x[1]); @@ -644,7 +655,7 @@ namespace Test { namespace Float { public: /// Create and register test MultXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Mult::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Mult::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[0], x[0]); @@ -660,7 +671,8 @@ namespace Test { namespace Float { public: /// Create and register test Div(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Div::"+s,3,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Arithmetic::Div::"+s,3,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] / x[1], x[2]); @@ -679,7 +691,7 @@ namespace Test { namespace Float { public: /// Create and register test DivSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Div::Sol::"+s,3,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Div::Sol::"+s,3,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] / x[1], x[2]); @@ -705,7 +717,7 @@ namespace Test { namespace Float { public: /// Create and register test SqrXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Sqr::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Sqr::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[0], x[1]); @@ -724,7 +736,7 @@ namespace Test { namespace Float { public: /// Create and register test SqrXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Sqr::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Sqr::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[0], x[1]); @@ -750,7 +762,8 @@ namespace Test { namespace Float { public: /// Create and register test SqrXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Sqr::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Arithmetic::Sqr::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[0], x[0]); @@ -766,7 +779,7 @@ namespace Test { namespace Float { public: /// Create and register test SqrtXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Sqrt::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Sqrt::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) { @@ -790,7 +803,7 @@ namespace Test { namespace Float { public: /// Create and register test SqrtXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Sqrt::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Sqrt::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) { @@ -821,7 +834,8 @@ namespace Test { namespace Float { public: /// Create and register test SqrtXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Sqrt::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Arithmetic::Sqrt::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) { @@ -843,7 +857,7 @@ namespace Test { namespace Float { public: /// Create and register test PowXY(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test("Arithmetic::Pow::N::"+str(_n)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), n(_n) {} + : Test(TestTag::sweep,"Arithmetic::Pow::N::"+str(_n)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), n(_n) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(pow(x[0],n), x[1]); @@ -863,7 +877,12 @@ namespace Test { namespace Float { public: /// Create and register test PowXYSol(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test("Arithmetic::Pow::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) {} + : Test(TestTag::sweep,"Arithmetic::Pow::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) { + if ((_n == 2) && (s == "C")) { + tags(TestTag::normal); + add_tags(TestTag::check); + } + } /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(pow(x[0],n), x[1]); @@ -890,7 +909,7 @@ namespace Test { namespace Float { public: /// Create and register test PowXX(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test("Arithmetic::Pow::N::"+str(_n)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false), n(_n) {} + : Test(TestTag::sweep,"Arithmetic::Pow::N::"+str(_n)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false), n(_n) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(pow(x[0],n), x[0]); @@ -907,7 +926,7 @@ namespace Test { namespace Float { public: /// Create and register test NRootXY(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test("Arithmetic::NRoot::N::"+str(_n)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), n(_n) {} + : Test(TestTag::sweep,"Arithmetic::NRoot::N::"+str(_n)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), n(_n) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((n == 0) || (x[0].min() < 0.0)) @@ -929,7 +948,12 @@ namespace Test { namespace Float { public: /// Create and register test NRootXYSol(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test("Arithmetic::NRoot::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) {} + : Test(TestTag::sweep,"Arithmetic::NRoot::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) { + if ((_n == 2) && (s == "C")) { + tags(TestTag::normal); + add_tags(TestTag::check); + } + } /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((n == 0) || (x[0].min() < 0.0)) @@ -960,7 +984,7 @@ namespace Test { namespace Float { public: /// Create and register test NRootXX(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test("Arithmetic::NRoot::N::"+str(_n)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false), n(_n) {} + : Test(TestTag::sweep,"Arithmetic::NRoot::N::"+str(_n)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false), n(_n) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((n == 0) || (x[0].min() < 0)) @@ -978,7 +1002,7 @@ namespace Test { namespace Float { public: /// Create and register test AbsXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Abs::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Abs::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(abs(x[0]), x[1]); @@ -997,7 +1021,8 @@ namespace Test { namespace Float { public: /// Create and register test AbsXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Abs::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Arithmetic::Abs::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(abs(x[0]), x[0]); @@ -1013,7 +1038,7 @@ namespace Test { namespace Float { public: /// Create and register test MinXYZ(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Min::Bin::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Min::Bin::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(min(x[0],x[1]), x[2]); @@ -1032,7 +1057,7 @@ namespace Test { namespace Float { public: /// Create and register test MinXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Min::Bin::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Min::Bin::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(min(x[0],x[0]), x[1]); @@ -1048,7 +1073,7 @@ namespace Test { namespace Float { public: /// Create and register test MinXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Min::Bin::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Min::Bin::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(min(x[0],x[1]), x[0]); @@ -1064,7 +1089,7 @@ namespace Test { namespace Float { public: /// Create and register test MinXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Min::Bin::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Min::Bin::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(min(x[0],x[1]), x[1]); @@ -1080,7 +1105,8 @@ namespace Test { namespace Float { public: /// Create and register test MinXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Min::Bin::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Arithmetic::Min::Bin::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(min(x[0],x[0]), x[0]); @@ -1096,7 +1122,7 @@ namespace Test { namespace Float { public: /// Create and register test MaxXYZ(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Max::Bin::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Max::Bin::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(max(x[0],x[1]), x[2]); @@ -1115,7 +1141,7 @@ namespace Test { namespace Float { public: /// Create and register test MaxXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Max::Bin::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Max::Bin::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(max(x[0],x[0]), x[1]); @@ -1131,7 +1157,7 @@ namespace Test { namespace Float { public: /// Create and register test MaxXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Max::Bin::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Max::Bin::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(max(x[0],x[1]), x[0]); @@ -1147,7 +1173,7 @@ namespace Test { namespace Float { public: /// Create and register test MaxXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Max::Bin::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Max::Bin::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(max(x[0],x[1]), x[1]); @@ -1163,7 +1189,8 @@ namespace Test { namespace Float { public: /// Create and register test MaxXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Arithmetic::Max::Bin::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Arithmetic::Max::Bin::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(max(x[0],x[0]), x[0]); @@ -1179,7 +1206,7 @@ namespace Test { namespace Float { public: /// Create and register test MinNary(void) - : Test("Arithmetic::Min::Nary",4,-4,4,0.5,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Min::Nary",4,-4,4,0.5,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(min(min(x[0],x[1]),x[2]), x[3]); @@ -1200,7 +1227,7 @@ namespace Test { namespace Float { public: /// Create and register test MinNaryShared(void) - : Test("Arithmetic::Min::Nary::Shared",3,-4,4,0.5,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Min::Nary::Shared",3,-4,4,0.5,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(min(min(x[0],x[1]),x[2]), x[1]); @@ -1218,7 +1245,7 @@ namespace Test { namespace Float { public: /// Create and register test MaxNary(void) - : Test("Arithmetic::Max::Nary",4,-4,4,0.5,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Max::Nary",4,-4,4,0.5,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(max(max(x[0],x[1]),x[2]), x[3]); @@ -1239,7 +1266,7 @@ namespace Test { namespace Float { public: /// Create and register test MaxNaryShared(void) - : Test("Arithmetic::Max::Nary::Shared",3,-4,4,0.5,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Arithmetic::Max::Nary::Shared",3,-4,4,0.5,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(max(max(x[0],x[1]),x[2]), x[1]); diff --git a/test/float/linear.cpp b/test/float/linear.cpp index a20cc39276..8111250674 100644 --- a/test/float/linear.cpp +++ b/test/float/linear.cpp @@ -69,7 +69,9 @@ namespace Test { namespace Float { FloatFloat(const std::string& s, const Gecode::FloatVal& d, const Gecode::FloatValArgs& a0, Gecode::FloatRelType frt0, Gecode::FloatNum c0, Gecode::FloatNum st) - : Test("Linear::Float::"+ + : Test((s == "11") && (frt0 == Gecode::FRT_EQ) && + (c0 == 0.0) && (a0.size() == 1) + ? TestTag::normal : TestTag::sweep,"Linear::Float::"+ str(frt0)+"::"+s+"::"+str(c0)+"::" +str(a0.size()), a0.size(),d,st,CPLT_ASSIGNMENT,true), @@ -130,7 +132,9 @@ namespace Test { namespace Float { /// Create and register test FloatVar(const std::string& s, const Gecode::FloatVal& d, const Gecode::FloatValArgs& a0, Gecode::FloatRelType frt0, Gecode::FloatNum st) - : Test("Linear::Var::"+ + : Test((s == "11") && (frt0 == Gecode::FRT_EQ) && + (a0.size() == 1) ? TestTag::normal : TestTag::sweep, + "Linear::Var::"+ str(frt0)+"::"+s+"::"+str(a0.size()), a0.size()+1,d,st,CPLT_ASSIGNMENT,true), a(a0), frt(frt0) { diff --git a/test/float/mm-lin.cpp b/test/float/mm-lin.cpp index 1007b9826e..0168e67a0a 100644 --- a/test/float/mm-lin.cpp +++ b/test/float/mm-lin.cpp @@ -99,7 +99,8 @@ namespace Test { namespace Float { public: /// Create and register test LinExpr(const LinInstr* lis0, const std::string& s) - : Test("Float::","MiniModel::LinExpr::"+s,4,-3,3), + : Test(s == "000" ? TestTag::normal : TestTag::sweep, + "Float::","MiniModel::LinExpr::"+s,4,-3,3), lis(lis0) { testfix = false; } diff --git a/test/float/transcendental.cpp b/test/float/transcendental.cpp index 2f69d11371..367f66e64d 100644 --- a/test/float/transcendental.cpp +++ b/test/float/transcendental.cpp @@ -51,7 +51,7 @@ namespace Test { namespace Float { public: /// Create and register test ExpXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Transcendental::Exp::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Transcendental::Exp::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(exp(x[0]), x[1]); @@ -70,7 +70,7 @@ namespace Test { namespace Float { public: /// Create and register test ExpXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Transcendental::Exp::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Transcendental::Exp::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(exp(x[0]), x[1]); @@ -96,7 +96,8 @@ namespace Test { namespace Float { public: /// Create and register test ExpXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Transcendental::Exp::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Transcendental::Exp::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(exp(x[0]), x[0]); @@ -112,7 +113,7 @@ namespace Test { namespace Float { public: /// Create and register test LogXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Transcendental::Log::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Transcendental::Log::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if (x[0].max() < 0.0) @@ -133,7 +134,7 @@ namespace Test { namespace Float { public: /// Create and register test LogXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Transcendental::Log::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Transcendental::Log::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if (x[0].max() < 0.0) @@ -162,7 +163,8 @@ namespace Test { namespace Float { public: /// Create and register test LogXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Transcendental::Log::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Transcendental::Log::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if (x[0].max() < 0.0) @@ -181,7 +183,7 @@ namespace Test { namespace Float { public: /// Create and register test LogNXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) - : Test("Transcendental::Log::N::"+str(_base)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), base(_base) {} + : Test(TestTag::sweep,"Transcendental::Log::N::"+str(_base)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), base(_base) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((x[0].max() <= 0.0) || (base <= 0.0)) @@ -200,7 +202,7 @@ namespace Test { namespace Float { public: /// Create and register test LogNXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) - : Test("Transcendental::Log::N::"+str(_base)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), base(_base) {} + : Test(TestTag::sweep,"Transcendental::Log::N::"+str(_base)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), base(_base) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((x[0].max() <= 0.0) || (base <= 0.0)) @@ -231,7 +233,7 @@ namespace Test { namespace Float { public: /// Create and register test LogNXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) - : Test("Transcendental::Log::N::"+str(_base)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false), base(_base) {} + : Test(TestTag::sweep,"Transcendental::Log::N::"+str(_base)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false), base(_base) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((x[0].max() <= 0.0) || (base <= 0.0)) @@ -250,7 +252,7 @@ namespace Test { namespace Float { public: /// Create and register test PowXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) - : Test("Transcendental::Pow::N::"+str(_base)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), base(_base) {} + : Test(TestTag::sweep,"Transcendental::Pow::N::"+str(_base)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), base(_base) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if (base <= 0.0) @@ -269,7 +271,7 @@ namespace Test { namespace Float { public: /// Create and register test PowXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) - : Test("Transcendental::Pow::N::"+str(_base)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), base(_base) {} + : Test(TestTag::sweep,"Transcendental::Pow::N::"+str(_base)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), base(_base) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if (base <= 0.0) @@ -299,7 +301,10 @@ namespace Test { namespace Float { public: /// Create and register test PowXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) - : Test("Transcendental::Pow::N::"+str(_base)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false), base(_base) {} + : Test((_base == 1.5) && (s == "A") + ? TestTag::normal : TestTag::sweep, + "Transcendental::Pow::N::"+str(_base)+"::XX::"+s, + 1,d,st,CPLT_ASSIGNMENT,false), base(_base) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((x[0].max() <= 0.0) || (base <= 0.0)) diff --git a/test/float/trigonometric.cpp b/test/float/trigonometric.cpp index 97381d3a73..61a49dd814 100644 --- a/test/float/trigonometric.cpp +++ b/test/float/trigonometric.cpp @@ -51,7 +51,7 @@ namespace Test { namespace Float { public: /// Create and register test SinXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::Sin::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::Sin::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(sin(x[0]), x[1]); @@ -70,7 +70,7 @@ namespace Test { namespace Float { public: /// Create and register test SinXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::Sin::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::Sin::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(sin(x[0]), x[1]); @@ -96,7 +96,8 @@ namespace Test { namespace Float { public: /// Create and register test SinXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::Sin::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Trigonometric::Sin::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(sin(x[0]), x[0]); @@ -112,7 +113,7 @@ namespace Test { namespace Float { public: /// Create and register test CosXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::Cos::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::Cos::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(cos(x[0]), x[1]); @@ -131,7 +132,7 @@ namespace Test { namespace Float { public: /// Create and register test CosXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::Cos::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::Cos::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(cos(x[0]), x[1]); @@ -157,7 +158,8 @@ namespace Test { namespace Float { public: /// Create and register test CosXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::Cos::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Trigonometric::Cos::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(cos(x[0]), x[0]); @@ -173,7 +175,7 @@ namespace Test { namespace Float { public: /// Create and register test TanXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::Tan::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::Tan::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(tan(x[0]), x[1]); @@ -192,7 +194,7 @@ namespace Test { namespace Float { public: /// Create and register test TanXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::Tan::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::Tan::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(tan(x[0]), x[1]); @@ -218,7 +220,8 @@ namespace Test { namespace Float { public: /// Create and register test TanXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::Tan::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Trigonometric::Tan::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(tan(x[0]), x[0]); @@ -234,7 +237,7 @@ namespace Test { namespace Float { public: /// Create and register test ASinXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::ASin::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::ASin::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) @@ -255,7 +258,7 @@ namespace Test { namespace Float { public: /// Create and register test ASinXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::ASin::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::ASin::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) @@ -285,7 +288,8 @@ namespace Test { namespace Float { public: /// Create and register test ASinXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::ASin::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Trigonometric::ASin::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) @@ -303,7 +307,7 @@ namespace Test { namespace Float { public: /// Create and register test ACosXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::ACos::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::ACos::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) @@ -324,7 +328,7 @@ namespace Test { namespace Float { public: /// Create and register test ACosXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::ACos::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::ACos::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) @@ -354,7 +358,8 @@ namespace Test { namespace Float { public: /// Create and register test ACosXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::ACos::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Trigonometric::ACos::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) @@ -372,7 +377,7 @@ namespace Test { namespace Float { public: /// Create and register test ATanXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::ATan::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::ATan::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(atan(x[0]), x[1]); @@ -391,7 +396,7 @@ namespace Test { namespace Float { public: /// Create and register test ATanXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::ATan::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} + : Test(TestTag::sweep,"Trigonometric::ATan::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(atan(x[0]), x[1]); @@ -417,7 +422,8 @@ namespace Test { namespace Float { public: /// Create and register test ATanXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test("Trigonometric::ATan::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Trigonometric::ATan::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(atan(x[0]), x[0]); diff --git a/test/gecode-tags.cpp b/test/gecode-tags.cpp deleted file mode 100644 index 5513ceb21d..0000000000 --- a/test/gecode-tags.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ -/* - * Main authors: - * Christian Schulte - * - * Contributing authors: - * Mikael Lagerkvist - * - * Copyright: - * Christian Schulte, 2026 - * - * This file is part of Gecode, the generic constraint - * development environment: - * http://www.gecode.org - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#include "test/test.hh" -#include "test/gecode-tags.hh" - -#include - -namespace Test { - - /// Patterns that reproduce the historic make check selection - static const char* const check_patterns[] = { - "Branch::Int::Dense::3", - "FlatZinc::Options", - "FlatZinc::magic_square", - "FlatZinc::blackbox", - "Float::Arithmetic::PositiveNRootBounds", - "Float::Arithmetic::PowConsistency", - "Float::Arithmetic::MultZeroEndpoint", - "Float::Arithmetic::Pow::N::2::XY::Sol::C", - "Float::Arithmetic::NRoot::N::2::XY::Sol::C", - "Float::Arithmetic::Mult::XYZ::Sol::C", - "Int::Arithmetic::Abs", - "Int::Arithmetic::ArgMax", - "Int::Arithmetic::Max::Nary", - "Int::Cumulative::Man::Fix::0::4", - "Int::Distinct::Random", - "Int::Extensional::TupleSet::Sparse::IncrementalDelta", - "Int::Extensional::TupleSet::Auto::DefaultDispatch", - "Int::Linear::Bool::Int::Lq", - "Int::MiniModel::LinExpr::Bool::352", - "NoGoods::Queens", - "Search::DFS::Sol::Binary::Nary::Binary::1::1::1", - "Set::Dom::Dom::Gr", - "Set::RelOp::ConstSSI::Union", - "Set::Sequence::SeqU1", - "Set::Wait", - nullptr - }; - - /// Representative cases retained from otherwise exhaustive sweep families - static const char* const normal_patterns[] = { - "Float::Arithmetic::Abs::XX::A", - "Float::Arithmetic::Div::A", - "Float::Arithmetic::Max::Bin::XXX::A", - "Float::Arithmetic::Min::Bin::XXX::A", - "Float::Arithmetic::Sqr::XX::A", - "Float::Arithmetic::Sqrt::XX::A", - "Float::Linear::Float::Eq::11::0::1", - "Float::Linear::Var::Eq::11::1", - "Float::MiniModel::LinExpr::000", - "Float::Transcendental::Exp::XX::A", - "Float::Transcendental::Log::XX::A", - "Float::Transcendental::Pow::N::1.5::XX::A", - "Float::Trigonometric::ACos::XX::A", - "Float::Trigonometric::ASin::XX::A", - "Float::Trigonometric::ATan::XX::A", - "Float::Trigonometric::Cos::XX::A", - "Float::Trigonometric::Sin::XX::A", - "Float::Trigonometric::Tan::XX::A", - "Int::Arithmetic::Nroot::XX::1::Bnd::A", - "Int::Arithmetic::Pow::XX::0::Bnd::A", - "Int::Channel::Bool::Multi::A", - "Int::Circuit::Cost::Dom::4::0", - "Int::Count::Distinct::Bnd::Dense", - "Int::Cumulative::Opt::Fix::-2147483646::-1", - "Int::Cumulative::Opt::Flex::-2147483646::4::0::2", - "Int::Distinct::Bnd::Dense", - "Int::Distinct::Dom::Dense", - "Int::Distinct::Offset::Dense::Bnd", - "Int::GCC::Int::All::Max::Bnd", - "Int::Linear::Int::Int::Eq::Bnd::11::0::1", - "Int::MiniModel::SetExpr::Const::000::0::0", - "Int::MiniModel::SetExpr::Expr::000::000::0", - "Int::NValues::Int::Int::Eq::1::0", - "Int::NoOverlap::Int::2::2::[1,1,1,1]::[1,1,1,1]", - "Int::Path::Cost::Dom::3::0", - "Int::Rel::Int::Array::Eq::0::4", - "Int::Unary::Man::Fix::-2147483646::[2,2,0,2,2]::Def+A", - "Int::Unary::Man::Flex::-2147483646::4::0::2::Def+A", - "Int::Unary::Opt::Fix::-2147483646::[2,2,0,2,2]::Def+A", - "Int::Unary::Opt::Flex::-2147483646::4::0::2::Def+A", - "Search::BAB::Sol::BalGr::Binary::Binary::Binary::1::1::1", - "Set::Branch::Dense::3", - "Set::Channel::Bool::1", - "Set::Element::Disjoint", - "Set::Precede::Multi::[1,2,3]", - "Set::Rel::Bin::Cmpl::S0", - "Set::RelOp::ConstISI::DUnion::Cmpl::0::0", - nullptr - }; - - /// Patterns for tests that are too heavy for the normal suite - static const char* const sweep_patterns[] = { - "FlatZinc::oss", - "FlatZinc::packing", - "FlatZinc::radiation", - "FlatZinc::steiner_triples", - "FlatZinc::template_design", - "FlatZinc::tenpenki", - "FlatZinc::timetabling", - "FlatZinc::trucking", - "Float::Arithmetic", - "Float::Linear::Float", - "Float::Linear::Var", - "Float::MiniModel::LinExpr", - "Float::Transcendental", - "Float::Trigonometric", - "Int::Arithmetic::Nroot", - "Int::Arithmetic::Pow", - "Int::Channel", - "Int::Circuit", - "Int::Count::Distinct", - "Int::Cumulative::Man", - "Int::Cumulative::Opt", - "Int::Distinct::Bnd", - "Int::Distinct::Dom", - "Int::Distinct::Offset", - "Int::Distinct::Pathological", - "Int::Extensional::TupleSet", - "Int::GCC", - "Int::Linear::Bool", - "Int::Linear::Int", - "Int::MiniModel::LinExpr", - "Int::MiniModel::SetExpr", - "Int::NValues::Int", - "Int::NoOverlap", - "Int::Path", - "Int::Rel::Int", - "Int::Unary", - "Search::BAB::Sol", - "Search::DFS::Sol", - "Set::Branch", - "Set::Channel", - "Set::Dom", - "Set::Element", - "Set::Precede", - "Set::Rel", - "Set::RelOp", - nullptr - }; - - static bool - matches_any_pattern(const std::string& name, - const char* const patterns[]) { - for (int i=0; patterns[i] != nullptr; i++) - if (name.find(patterns[i]) != std::string::npos) - return true; - return false; - } - - void - apply_gecode_test_tags(void) { - for (Base* test = Base::tests(); test != nullptr; - test = test->next()) { - const std::string& name = test->name(); - const bool check = matches_any_pattern(name, check_patterns); - const bool representative = matches_any_pattern(name, normal_patterns); - if (!check && !representative && - matches_any_pattern(name, sweep_patterns)) { - test->remove_tags(TestTag::normal); - test->add_tags(TestTag::sweep); - } - if (check) - test->add_tags(TestTag::check); - } - } - -} - -// STATISTICS: test-core diff --git a/test/gecode-tags.hh b/test/gecode-tags.hh deleted file mode 100644 index aea4e19c93..0000000000 --- a/test/gecode-tags.hh +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ -/* - * Main authors: - * Mikael Lagerkvist - * - * Copyright: - * Mikael Lagerkvist, 2026 - * - * This file is part of Gecode, the generic constraint - * development environment: - * http://www.gecode.org - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef GECODE_TEST_GECODE_TAGS_HH -#define GECODE_TEST_GECODE_TAGS_HH - -namespace Test { - - /// Apply Gecode's suite classification to its registered tests - void apply_gecode_test_tags(void); - -} - -#endif - -// STATISTICS: test-core diff --git a/test/int.hh b/test/int.hh index 2adc40dab3..08f87a1618 100755 --- a/test/int.hh +++ b/test/int.hh @@ -259,6 +259,10 @@ namespace Test { Test(const std::string& p, const std::string& s, int a, const Gecode::IntSet& d, bool r=false, Gecode::IntPropLevel i=Gecode::IPL_DEF); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& p, const std::string& s, + int a, const Gecode::IntSet& d, bool r=false, + Gecode::IntPropLevel i=Gecode::IPL_DEF); /** * \brief Constructor * @@ -270,6 +274,10 @@ namespace Test { Test(const std::string& s, int a, const Gecode::IntSet& d, bool r=false, Gecode::IntPropLevel i=Gecode::IPL_DEF); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& s, + int a, const Gecode::IntSet& d, bool r=false, + Gecode::IntPropLevel i=Gecode::IPL_DEF); /** * \brief Constructor * @@ -281,6 +289,10 @@ namespace Test { Test(const std::string& p, const std::string& s, int a, int min, int max, bool r=false, Gecode::IntPropLevel i=Gecode::IPL_DEF); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& p, const std::string& s, + int a, int min, int max, bool r=false, + Gecode::IntPropLevel i=Gecode::IPL_DEF); /** * \brief Constructor * @@ -292,6 +304,10 @@ namespace Test { Test(const std::string& s, int a, int min, int max, bool r=false, Gecode::IntPropLevel i=Gecode::IPL_DEF); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& s, + int a, int min, int max, bool r=false, + Gecode::IntPropLevel i=Gecode::IPL_DEF); /// Create assignment virtual Assignment* assignment(void) const; /// Check for solution @@ -416,4 +432,3 @@ std::ostream& operator<<(std::ostream& os, const Test::Int::Assignment& a); #endif // STATISTICS: test-int - diff --git a/test/int.hpp b/test/int.hpp index 65a0e828ef..a4324232eb 100755 --- a/test/int.hpp +++ b/test/int.hpp @@ -161,10 +161,10 @@ namespace Test { namespace Int { return reified && ((rms & (1 << Gecode::RM_PMI)) != 0); } inline - Test::Test(const std::string& p, const std::string& s, + Test::Test(TestTags tags, const std::string& p, const std::string& s, int a, const Gecode::IntSet& d, bool r, Gecode::IntPropLevel i) - : Base(p+s), arity(a), dom(d), + : Base(p+s, tags), arity(a), dom(d), reified(r), rms((1 << Gecode::RM_EQV) | (1 << Gecode::RM_IMP) | (1 << Gecode::RM_PMI)), @@ -172,10 +172,16 @@ namespace Test { namespace Int { testsearch(true), testfix(true) {} inline - Test::Test(const std::string& s, + Test::Test(const std::string& p, const std::string& s, + int a, const Gecode::IntSet& d, bool r, + Gecode::IntPropLevel i) + : Test(TestTag::normal,p,s,a,d,r,i) {} + + inline + Test::Test(TestTags tags, const std::string& s, int a, const Gecode::IntSet& d, bool r, Gecode::IntPropLevel i) - : Base("Int::"+s), arity(a), dom(d), + : Base("Int::"+s, tags), arity(a), dom(d), reified(r), rms((1 << Gecode::RM_EQV) | (1 << Gecode::RM_IMP) | (1 << Gecode::RM_PMI)), @@ -183,10 +189,16 @@ namespace Test { namespace Int { testsearch(true), testfix(true) {} inline - Test::Test(const std::string& p, const std::string& s, + Test::Test(const std::string& s, + int a, const Gecode::IntSet& d, bool r, + Gecode::IntPropLevel i) + : Test(TestTag::normal,s,a,d,r,i) {} + + inline + Test::Test(TestTags tags, const std::string& p, const std::string& s, int a, int min, int max, bool r, Gecode::IntPropLevel i) - : Base(p+s), arity(a), dom(min,max), + : Base(p+s, tags), arity(a), dom(min,max), reified(r), rms((1 << Gecode::RM_EQV) | (1 << Gecode::RM_IMP) | (1 << Gecode::RM_PMI)), @@ -194,15 +206,26 @@ namespace Test { namespace Int { testsearch(true), testfix(true) {} inline - Test::Test(const std::string& s, + Test::Test(const std::string& p, const std::string& s, + int a, int min, int max, bool r, + Gecode::IntPropLevel i) + : Test(TestTag::normal,p,s,a,min,max,r,i) {} + + inline + Test::Test(TestTags tags, const std::string& s, int a, int min, int max, bool r, Gecode::IntPropLevel i) - : Base("Int::"+s), arity(a), dom(min,max), + : Base("Int::"+s, tags), arity(a), dom(min,max), reified(r), rms((1 << Gecode::RM_EQV) | (1 << Gecode::RM_IMP) | (1 << Gecode::RM_PMI)), ipl(i), contest(ipl == Gecode::IPL_DOM ? CTL_DOMAIN : CTL_NONE), testsearch(true), testfix(true) {} + inline + Test::Test(const std::string& s, + int a, int min, int max, bool r, Gecode::IntPropLevel i) + : Test(TestTag::normal,s,a,min,max,r,i) {} + inline std::string Test::str(Gecode::IntPropLevel ipl) { @@ -359,4 +382,3 @@ namespace Test { namespace Int { }} // STATISTICS: test-int - diff --git a/test/int/arithmetic.cpp b/test/int/arithmetic.cpp index 59ca93388e..043f9f80b6 100644 --- a/test/int/arithmetic.cpp +++ b/test/int/arithmetic.cpp @@ -231,7 +231,8 @@ namespace Test { namespace Int { /// Create and register test PowXY(const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Pow::XY::"+str(n0)+"::"+str(ipl)+"::"+s, + : Test(TestTag::sweep, + "Arithmetic::Pow::XY::"+str(n0)+"::"+str(ipl)+"::"+s, 2,d,false,ipl), n(n0) {} /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { @@ -263,7 +264,9 @@ namespace Test { namespace Int { /// Create and register test PowXX(const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Pow::XX::"+str(n0)+"::"+str(ipl)+"::"+s, + : Test((n0 == 0) && (ipl == Gecode::IPL_BND) && (s == "A") + ? TestTag::normal : TestTag::sweep, + "Arithmetic::Pow::XX::"+str(n0)+"::"+str(ipl)+"::"+s, 1,d,false,ipl), n(n0) {} /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { @@ -347,7 +350,8 @@ namespace Test { namespace Int { /// Create and register test NrootXY(const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Nroot::XY::"+str(n0)+"::"+str(ipl)+"::"+s, + : Test(TestTag::sweep, + "Arithmetic::Nroot::XY::"+str(n0)+"::"+str(ipl)+"::"+s, 2,d,false,ipl), n(n0) {} /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { @@ -377,7 +381,9 @@ namespace Test { namespace Int { /// Create and register test NrootXX(const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Nroot::XX::"+str(n0)+"::"+str(ipl)+"::"+s, + : Test((n0 == 1) && (ipl == Gecode::IPL_BND) && (s == "A") + ? TestTag::normal : TestTag::sweep, + "Arithmetic::Nroot::XX::"+str(n0)+"::"+str(ipl)+"::"+s, 1,d,false,ipl), n(n0) {} /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { @@ -470,7 +476,9 @@ namespace Test { namespace Int { /// Create and register test AbsXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Abs::XY::"+str(ipl)+"::"+s,2,d,false,ipl) {} + : Test("Arithmetic::Abs::XY::"+str(ipl)+"::"+s,2,d,false,ipl) { + add_tags(TestTag::check); + } /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { double d0 = static_cast(x[0]); @@ -489,7 +497,9 @@ namespace Test { namespace Int { /// Create and register test AbsXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Abs::XX::"+str(ipl)+"::"+s,1,d,false,ipl) {} + : Test("Arithmetic::Abs::XX::"+str(ipl)+"::"+s,1,d,false,ipl) { + add_tags(TestTag::check); + } /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { double d0 = static_cast(x[0]); @@ -715,7 +725,9 @@ namespace Test { namespace Int { public: /// Create and register test MaxNary(Gecode::IntPropLevel ipl) - : Test("Arithmetic::Max::Nary::"+str(ipl),4,-4,4,false,ipl) {} + : Test("Arithmetic::Max::Nary::"+str(ipl),4,-4,4,false,ipl) { + add_tags(TestTag::check); + } /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { return std::max(std::max(x[0],x[1]), x[2]) == x[3]; @@ -733,7 +745,9 @@ namespace Test { namespace Int { public: /// Create and register test MaxNaryShared(Gecode::IntPropLevel ipl) - : Test("Arithmetic::Max::Nary::Shared::"+str(ipl),3,-4,4,false,ipl) {} + : Test("Arithmetic::Max::Nary::Shared::"+str(ipl),3,-4,4,false,ipl) { + add_tags(TestTag::check); + } /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { return std::max(std::max(x[0],x[1]), x[2]) == x[1]; @@ -759,7 +773,9 @@ namespace Test { namespace Int { : Test("Arithmetic::ArgMax::"+str(o)+"::"+str(tb)+"::"+str(n), n+1,0,n+1, false,tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), - offset(o), tiebreak(tb) {} + offset(o), tiebreak(tb) { + add_tags(TestTag::check); + } /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { int n=x.size()-1; @@ -793,6 +809,7 @@ namespace Test { namespace Int { : Test("Arithmetic::ArgMax::Shared::"+str(tb)+"::"+str(n),n+1,0,n+1, false), tiebreak(tb) { + add_tags(TestTag::check); testfix=false; } /// %Test whether \a x is solution @@ -907,7 +924,9 @@ namespace Test { namespace Int { : Test("Arithmetic::ArgMaxBool::"+str(o)+"::"+str(tb)+"::"+str(n), n+1,0,n+1, false,tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), - offset(o), tiebreak(tb) {} + offset(o), tiebreak(tb) { + add_tags(TestTag::check); + } /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { int n=x.size()-1; @@ -946,6 +965,7 @@ namespace Test { namespace Int { : Test("Arithmetic::ArgMaxBool::Shared::"+str(tb)+"::"+str(n),n+1,0,n+1, false), tiebreak(tb) { + add_tags(TestTag::check); testfix=false; } /// %Test whether \a x is solution diff --git a/test/int/channel.cpp b/test/int/channel.cpp index 0a72f258ca..e1f4e12b3e 100644 --- a/test/int/channel.cpp +++ b/test/int/channel.cpp @@ -53,7 +53,7 @@ namespace Test { namespace Int { public: /// Construct and register test ChannelFull(int xoff0, int yoff0, Gecode::IntPropLevel ipl) - : Test("Channel::Full::"+str(xoff0)+"::"+str(yoff0)+"::"+str(ipl), + : Test(TestTag::sweep,"Channel::Full::"+str(xoff0)+"::"+str(yoff0)+"::"+str(ipl), 8,0,3,false,ipl), xoff(xoff0), yoff(yoff0) { contest = CTL_NONE; @@ -94,7 +94,7 @@ namespace Test { namespace Int { public: /// Construct and register test ChannelHalf(Gecode::IntPropLevel ipl) - : Test("Channel::Half::"+str(ipl),6,0,5,false,ipl) { + : Test(TestTag::sweep,"Channel::Half::"+str(ipl),6,0,5,false,ipl) { contest = CTL_NONE; } /// Check whether \a x is solution @@ -124,7 +124,7 @@ namespace Test { namespace Int { public: /// Construct and register test ChannelShared(Gecode::IntPropLevel ipl) - : Test("Channel::Shared::"+str(ipl),6,0,5,false,ipl) { + : Test(TestTag::sweep,"Channel::Shared::"+str(ipl),6,0,5,false,ipl) { contest = CTL_NONE; } /// Check whether \a x is solution @@ -146,7 +146,7 @@ namespace Test { namespace Int { public: /// Construct and register test ChannelLinkSingle(void) - : Test("Channel::Bool::Single",2,-1,2) { + : Test(TestTag::sweep,"Channel::Bool::Single",2,-1,2) { contest = CTL_NONE; } /// Check whether \a x is solution @@ -169,7 +169,8 @@ namespace Test { namespace Int { public: /// Construct and register test ChannelLinkMulti(const std::string& s, int min, int max, int o0) - : Test("Channel::Bool::Multi::"+s,7,min,max), o(o0) { + : Test(s == "A" ? TestTag::normal : TestTag::sweep, + "Channel::Bool::Multi::"+s,7,min,max), o(o0) { } /// Check whether \a x is solution virtual bool solution(const Assignment& x) const { @@ -227,4 +228,3 @@ namespace Test { namespace Int { }} // STATISTICS: test-int - diff --git a/test/int/circuit.cpp b/test/int/circuit.cpp index 1eb0c14384..b274321a85 100644 --- a/test/int/circuit.cpp +++ b/test/int/circuit.cpp @@ -52,7 +52,7 @@ namespace Test { namespace Int { public: /// Create and register test Circuit(int n, int min, int max, int off, Gecode::IntPropLevel ipl) - : Test("Circuit::" + str(ipl) + "::" + str(n) + "::" + str(off), + : Test(TestTag::sweep,"Circuit::" + str(ipl) + "::" + str(n) + "::" + str(off), n,min,max,false,ipl), offset(off) { contest = CTL_NONE; testfix = false; @@ -95,7 +95,7 @@ namespace Test { namespace Int { public: /// Create and register test Path(int n, int min, int max, int off, Gecode::IntPropLevel ipl) - : Test("Path::" + str(ipl) + "::" + str(n) + "::" + str(off), + : Test(TestTag::sweep,"Path::" + str(ipl) + "::" + str(n) + "::" + str(off), n+2,min,max,false,ipl), offset(off) { contest = CTL_NONE; testfix = false; @@ -148,7 +148,9 @@ namespace Test { namespace Int { public: /// Create and register test CircuitCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl) - : Test("Circuit::Cost::"+str(ipl)+"::"+str(n)+"::"+str(off), + : Test((ipl == Gecode::IPL_DOM) && (n == 4) && (off == 0) + ? TestTag::normal : TestTag::sweep, + "Circuit::Cost::"+str(ipl)+"::"+str(n)+"::"+str(off), n+1,min,max,false,ipl), offset(off) { contest = CTL_NONE; testfix = false; @@ -203,7 +205,9 @@ namespace Test { namespace Int { public: /// Create and register test PathCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl) - : Test("Path::Cost::"+str(ipl)+"::"+str(n)+"::"+str(off), + : Test((ipl == Gecode::IPL_DOM) && (n == 3) && (off == 0) + ? TestTag::normal : TestTag::sweep, + "Path::Cost::"+str(ipl)+"::"+str(n)+"::"+str(off), n+3,min,max,false,ipl), offset(off) { contest = CTL_NONE; testfix = false; @@ -266,7 +270,7 @@ namespace Test { namespace Int { /// Create and register test CircuitFullCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl) - : Test("Circuit::FullCost::" + str(ipl)+"::"+str(n)+"::"+str(off), + : Test(TestTag::sweep,"Circuit::FullCost::" + str(ipl)+"::"+str(n)+"::"+str(off), 2*n+1,min,max,false,ipl), offset(off) { contest = CTL_NONE; testfix = false; diff --git a/test/int/cumulative.cpp b/test/int/cumulative.cpp index 99cddc4df2..964138fc88 100755 --- a/test/int/cumulative.cpp +++ b/test/int/cumulative.cpp @@ -71,10 +71,14 @@ namespace Test { namespace Int { const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) - : Test("Cumulative::Man::Fix::"+str(o0)+"::"+ + : Test(TestTag::sweep,"Cumulative::Man::Fix::"+str(o0)+"::"+ str(c0)+"::"+str(p0)+"::"+str(u0)+"::"+str(ipl0), (c0 >= 0) ? p0.size():p0.size()+1,0,st(c0,p0,u0),false,ipl0), c(c0), p(p0), u(u0), o(o0) { + if ((o0 == 0) && (c0 == 4)) { + tags(TestTag::normal); + add_tags(TestTag::check); + } testsearch = false; testfix = false; contest = CTL_NONE; @@ -174,11 +178,13 @@ namespace Test { namespace Int { const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) - : Test("Cumulative::Opt::Fix::"+str(o0)+"::"+ + : Test(TestTag::sweep,"Cumulative::Opt::Fix::"+str(o0)+"::"+ str(c0)+"::"+str(p0)+"::"+str(u0)+"::"+str(ipl0), (c0 >= 0) ? 2*p0.size() : 2*p0.size()+1,0,st(c0,p0,u0), false,ipl0), c(c0), p(p0), u(u0), l(st(c,p,u)/2), o(o0) { + if ((o0 == Gecode::Int::Limits::min) && (c0 == -1)) + tags(TestTag::normal); testsearch = false; testfix = false; contest = CTL_NONE; @@ -280,7 +286,7 @@ namespace Test { namespace Int { const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) - : Test("Cumulative::Man::Flex::"+str(o0)+"::"+ + : Test(TestTag::sweep,"Cumulative::Man::Flex::"+str(o0)+"::"+ str(c0)+"::"+str(minP)+"::"+str(maxP)+"::"+str(u0)+ "::"+str(ipl0), (c0 >= 0) ? 2*u0.size() : 2*u0.size()+1, @@ -393,13 +399,16 @@ namespace Test { namespace Int { const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) - : Test("Cumulative::Opt::Flex::"+str(o0)+"::"+ + : Test(TestTag::sweep,"Cumulative::Opt::Flex::"+str(o0)+"::"+ str(c0)+"::"+str(minP)+"::"+str(maxP)+"::"+str(u0)+ "::"+str(ipl0), (c0 >= 0) ? 3*u0.size() : 3*u0.size()+1, 0,std::max(maxP,st(c0,maxP,u0)), false,ipl0), c(c0), _minP(minP), _maxP(maxP), u(u0), l(std::max(maxP,st(c0,maxP,u0))/2), o(o0) { + if ((o0 == Gecode::Int::Limits::min) && (c0 == 4) && + (minP == 0) && (maxP == 2)) + tags(TestTag::normal); testsearch = false; testfix = false; contest = CTL_NONE; diff --git a/test/int/distinct.cpp b/test/int/distinct.cpp index c652f739b7..f4f8582104 100755 --- a/test/int/distinct.cpp +++ b/test/int/distinct.cpp @@ -53,11 +53,15 @@ namespace Test { namespace Int { /// Create and register test Distinct(const Gecode::IntSet& d0, Gecode::IntPropLevel ipl, int n=6) - : Test(std::string(useCount ? "Count::Distinct::" : "Distinct::")+ + : Test((useCount || (ipl != Gecode::IPL_VAL)) + ? TestTag::sweep : TestTag::normal, + std::string(useCount ? "Count::Distinct::" : "Distinct::")+ str(ipl)+"::Sparse::"+str(n),n,d0,false,ipl) {} /// Create and register test Distinct(int min, int max, Gecode::IntPropLevel ipl) - : Test(std::string(useCount ? "Count::Distinct::" : "Distinct::")+ + : Test((!useCount || (ipl == Gecode::IPL_BND)) + ? TestTag::normal : TestTag::sweep, + std::string(useCount ? "Count::Distinct::" : "Distinct::")+ str(ipl)+"::Dense",6,min,max,false,ipl) {} /// Check whether \a x is solution virtual bool solution(const Assignment& x) const { @@ -87,10 +91,12 @@ namespace Test { namespace Int { public: /// Create and register test Offset(const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Distinct::Offset::Sparse::"+str(ipl),6,d,false,ipl) {} + : Test(TestTag::sweep, + "Distinct::Offset::Sparse::"+str(ipl),6,d,false,ipl) {} /// Create and register test Offset(int min, int max, Gecode::IntPropLevel ipl) - : Test("Distinct::Offset::Dense::"+str(ipl),6,min,max,false,ipl) {} + : Test(ipl == Gecode::IPL_BND ? TestTag::normal : TestTag::sweep, + "Distinct::Offset::Dense::"+str(ipl),6,min,max,false,ipl) {} /// Check whether \a x is solution virtual bool solution(const Assignment& x) const { for (int i=0; i> 1; @@ -443,7 +443,7 @@ namespace Test { namespace Int { public: /// Create and register test IntArrayInt(Gecode::IntRelType irt0) - : Test("Rel::Int::Array::Int::"+str(irt0),3,-2,2), irt(irt0) {} + : Test(TestTag::sweep,"Rel::Int::Array::Int::"+str(irt0),3,-2,2), irt(irt0) {} /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { Gecode::IntArgs y({0,0,0}); @@ -476,7 +476,9 @@ namespace Test { namespace Int { public: /// Create and register test IntArrayDiff(Gecode::IntRelType irt0, int m) - : Test("Rel::Int::Array::"+str(irt0)+"::"+str(m)+"::"+str(n-m), + : Test((irt0 == Gecode::IRT_EQ) && (m == 0) + ? TestTag::normal : TestTag::sweep, + "Rel::Int::Array::"+str(irt0)+"::"+str(m)+"::"+str(n-m), n,-2,2), irt(irt0), n_fst(m) { assert(n_fst <= n); diff --git a/test/int/unary.cpp b/test/int/unary.cpp index 44abfc0e61..944dd9d105 100755 --- a/test/int/unary.cpp +++ b/test/int/unary.cpp @@ -62,9 +62,13 @@ namespace Test { namespace Int { namespace Unary { public: /// Create and register test ManFixPUnary(const Gecode::IntArgs& p0, int o, Gecode::IntPropLevel ipl0) - : Test("Unary::Man::Fix::"+str(o)+"::"+str(p0)+"::"+str(ipl0), + : Test(TestTag::sweep,"Unary::Man::Fix::"+str(o)+"::"+str(p0)+"::"+str(ipl0), p0.size(),o,o+st(p0),false,ipl0), p(p0) { + if ((o == Gecode::Int::Limits::min) && + (str(p0) == "[2,2,0,2,2]") && + (ipl0 == Gecode::IPL_ADVANCED)) + tags(TestTag::normal); testsearch = false; contest = CTL_NONE; } @@ -103,8 +107,12 @@ namespace Test { namespace Int { namespace Unary { public: /// Create and register test OptFixPUnary(const Gecode::IntArgs& p0, int o, Gecode::IntPropLevel ipl0) - : Test("Unary::Opt::Fix::"+str(o)+"::"+str(p0)+"::"+str(ipl0), + : Test(TestTag::sweep,"Unary::Opt::Fix::"+str(o)+"::"+str(p0)+"::"+str(ipl0), 2*p0.size(),o,o+st(p0),false,ipl0), p(p0), l(o+st(p)/2) { + if ((o == Gecode::Int::Limits::min) && + (str(p0) == "[2,2,0,2,2]") && + (ipl0 == Gecode::IPL_ADVANCED)) + tags(TestTag::normal); testsearch = false; contest = CTL_NONE; } @@ -148,9 +156,12 @@ namespace Test { namespace Int { namespace Unary { public: /// Create and register test ManFlexUnary(int n, int minP, int maxP, int o, Gecode::IntPropLevel ipl0) - : Test("Unary::Man::Flex::"+str(o)+"::"+str(n)+"::" + : Test(TestTag::sweep,"Unary::Man::Flex::"+str(o)+"::"+str(n)+"::" +str(minP)+"::"+str(maxP)+"::"+str(ipl0), 2*n,0,n*maxP,false,ipl0), _minP(minP), _maxP(maxP), off(o) { + if ((o == Gecode::Int::Limits::min) && (n == 4) && + (minP == 0) && (maxP == 2) && (ipl0 == Gecode::IPL_ADVANCED)) + tags(TestTag::normal); testsearch = false; testfix = false; contest = CTL_NONE; @@ -207,10 +218,13 @@ namespace Test { namespace Int { namespace Unary { public: /// Create and register test OptFlexUnary(int n, int minP, int maxP, int o, Gecode::IntPropLevel ipl0) - : Test("Unary::Opt::Flex::"+str(o)+"::"+str(n)+"::" + : Test(TestTag::sweep,"Unary::Opt::Flex::"+str(o)+"::"+str(n)+"::" +str(minP)+"::"+str(maxP)+"::"+str(ipl0), 3*n,0,n*maxP,false,ipl0), _minP(minP), _maxP(maxP), off(o), l(n*maxP/2) { + if ((o == Gecode::Int::Limits::min) && (n == 4) && + (minP == 0) && (maxP == 2) && (ipl0 == Gecode::IPL_ADVANCED)) + tags(TestTag::normal); testsearch = false; testfix = false; contest = CTL_NONE; diff --git a/test/nogoods.cpp b/test/nogoods.cpp index dfcb7b35e8..14c52f5984 100644 --- a/test/nogoods.cpp +++ b/test/nogoods.cpp @@ -224,7 +224,10 @@ namespace Test { NoGoods(ValBranch vb0, unsigned int t0, bool a0, bool n0) : Base("NoGoods::"+Model::name()+"::"+Model::val(vb0)+"::"+str(t0)+ "::"+(a0 ? "+" : "-")+"::"+(n0 ? "+" : "-")), - vb(vb0), t(t0), a(a0), n(n0) {} + vb(vb0), t(t0), a(a0), n(n0) { + if (Model::name() == "Queens") + add_tags(TestTag::check); + } /// Run test virtual bool run(void) { Model* m = new Model(vb,a,n); diff --git a/test/search.cpp b/test/search.cpp index 48e0bdfdcb..e710644309 100644 --- a/test/search.cpp +++ b/test/search.cpp @@ -398,7 +398,17 @@ namespace Test { : Test("DFS::"+Model::name()+"::"+ str(htb1)+"::"+str(htb2)+"::"+str(htb3)+"::"+ str(c_d0)+"::"+str(a_d0)+"::"+str(t0), - htb1,htb2,htb3), c_d(c_d0), a_d(a_d0), t(t0) {} + htb1,htb2,htb3), c_d(c_d0), a_d(a_d0), t(t0) { + if (Model::name().compare(0,3,"Sol") == 0) + tags(TestTag::sweep); + if ((Model::name() == "Sol") && + (htb1 == HTB_BINARY) && (htb2 == HTB_NARY) && + (htb3 == HTB_BINARY) && (c_d0 == 1) && + (a_d0 == 1) && (t0 == 1)) { + tags(TestTag::normal); + add_tags(TestTag::check); + } + } /// Run test virtual bool run(void) { Model* m = new Model(htb1,htb2,htb3); @@ -479,7 +489,15 @@ namespace Test { : Test("BAB::"+Model::name()+"::"+str(htc)+"::"+ str(htb1)+"::"+str(htb2)+"::"+str(htb3)+"::"+ str(c_d0)+"::"+str(a_d0)+"::"+str(t0), - htb1,htb2,htb3,htc), c_d(c_d0), a_d(a_d0), t(t0) {} + htb1,htb2,htb3,htc), c_d(c_d0), a_d(a_d0), t(t0) { + if (Model::name().compare(0,3,"Sol") == 0) + tags(TestTag::sweep); + if ((Model::name() == "Sol") && (htc == HTC_BAL_GR) && + (htb1 == HTB_BINARY) && (htb2 == HTB_BINARY) && + (htb3 == HTB_BINARY) && (c_d0 == 1) && + (a_d0 == 1) && (t0 == 1)) + tags(TestTag::normal); + } /// Run test virtual bool run(void) { Model* m = new Model(htb1,htb2,htb3,htc); diff --git a/test/set.hh b/test/set.hh index 29f74bdaf6..e3ee1202f6 100644 --- a/test/set.hh +++ b/test/set.hh @@ -303,7 +303,11 @@ namespace Test { */ SetTest(const std::string& s, int a, const Gecode::IntSet& d, bool r=false, int w=0) - : Base("Set::"+s), arity(a), lub(d), reified(r), withInt(w), + : SetTest(TestTag::normal,s,a,d,r,w) {} + /// Construct and register a test with explicitly assigned tags + SetTest(TestTags tags, const std::string& s, + int a, const Gecode::IntSet& d, bool r=false, int w=0) + : Base("Set::"+s, tags), arity(a), lub(d), reified(r), withInt(w), disabled(true), testsubsumed(true) {} /// Check for solution virtual bool solution(const SetAssignment&) const = 0; diff --git a/test/set/channel.cpp b/test/set/channel.cpp index abed5619e0..cd4f32727a 100644 --- a/test/set/channel.cpp +++ b/test/set/channel.cpp @@ -63,7 +63,7 @@ namespace Test { namespace Set { public: /// Create and register test ChannelSorted(const char* t) - : SetTest(t,1,ds_33,false,3) {} + : SetTest(TestTag::sweep,t,1,ds_33,false,3) {} /// %Test whether \a x is solution virtual bool solution(const SetAssignment& x) const { if (x.ints()[0]>=x.ints()[1] || @@ -103,7 +103,7 @@ namespace Test { namespace Set { public: /// Create and register test ChannelInt(const char* t, const IntSet& d, int _ssize, int _isize) - : SetTest(t,_ssize,d,false,_isize), ssize(_ssize), isize(_isize) {} + : SetTest(TestTag::sweep,t,_ssize,d,false,_isize), ssize(_ssize), isize(_isize) {} /// %Test whether \a x is solution virtual bool solution(const SetAssignment& x) const { for (int i=0; i 2) @@ -319,7 +319,7 @@ namespace Test { namespace Set { public: /// Create and register test ElementSetConst(const char* t) - : SetTest(t,1,ds_13,false,true), i0(-3,-3), i1(-1,1), i2(0,2) {} + : SetTest(TestTag::sweep,t,1,ds_13,false,true), i0(-3,-3), i1(-1,1), i2(0,2) {} /// %Test whether \a x is solution virtual bool solution(const SetAssignment& x) const { if (x.intval() < 0 || x.intval() > 2) @@ -346,7 +346,7 @@ namespace Test { namespace Set { public: /// Create and register test MatrixIntSet(void) - : SetTest("Element::Matrix::IntSet",1,IntSet(0,3),false,2), + : SetTest(TestTag::sweep,"Element::Matrix::IntSet",1,IntSet(0,3),false,2), tm(4) { tm[0]=IntSet(0,0); tm[1]=IntSet(1,1); tm[2]=IntSet(2,2); tm[3]=IntSet(3,3); diff --git a/test/set/exec.cpp b/test/set/exec.cpp index 8bf911b4f4..2f123d4603 100644 --- a/test/set/exec.cpp +++ b/test/set/exec.cpp @@ -53,7 +53,9 @@ namespace Test { namespace Set { Wait(int n, bool sf0) : SetTest("Wait::"+str(n)+"::"+ (sf0 ? "std::function" : "funptr"),n, - Gecode::IntSet(0,n),false), sf(sf0) {} + Gecode::IntSet(0,n),false), sf(sf0) { + add_tags(TestTag::check); + } /// Check whether \a x is solution virtual bool solution(const SetAssignment& x) const { (void) x; diff --git a/test/set/mm-set.cpp b/test/set/mm-set.cpp index 6c7d83f7da..f031a8df8f 100755 --- a/test/set/mm-set.cpp +++ b/test/set/mm-set.cpp @@ -126,7 +126,9 @@ namespace Test { namespace Int { /// Create and register test SetExprConst(const SetInstr* bis0, const std::string& s, Gecode::SetRelType srt0, int c0) - : Test("MiniModel::SetExpr::Const::"+s+"::"+str(srt0)+"::"+str(c0), + : Test((s == "000") && (srt0 == Gecode::SRT_EQ) && (c0 == 0) + ? TestTag::normal : TestTag::sweep, + "MiniModel::SetExpr::Const::"+s+"::"+str(srt0)+"::"+str(c0), 4,0,1,simpleReifiedSemantics(bis0)), bis(bis0), c(c0), srt(srt0) {} /// %Test whether \a x is solution @@ -212,7 +214,9 @@ namespace Test { namespace Int { /// Create and register test SetExprExpr(const SetInstr* bis00, const SetInstr* bis10, const std::string& s, Gecode::SetRelType srt0) - : Test("MiniModel::SetExpr::Expr::"+s+"::"+str(srt0), + : Test((s == "000::000") && (srt0 == Gecode::SRT_EQ) + ? TestTag::normal : TestTag::sweep, + "MiniModel::SetExpr::Expr::"+s+"::"+str(srt0), 8,0,1, simpleReifiedSemantics(bis00) && simpleReifiedSemantics(bis10)), diff --git a/test/set/precede.cpp b/test/set/precede.cpp index b98988e63d..f9e2f746c1 100755 --- a/test/set/precede.cpp +++ b/test/set/precede.cpp @@ -64,7 +64,7 @@ namespace Test { namespace Set { public: /// Create and register test Single(int s0, int t0) - : SetTest("Precede::Single::"+str(s0)+"<"+str(t0),4,ds,false), + : SetTest(TestTag::sweep,"Precede::Single::"+str(s0)+"<"+str(t0),4,ds,false), s(s0), t(t0) {} /// %Test whether \a x is solution virtual bool solution(const SetAssignment& x) const { @@ -99,7 +99,9 @@ namespace Test { namespace Set { public: /// Create and register test Multi(const Gecode::IntArgs& c0) - : SetTest("Precede::Multi::"+str(c0),4,ds,false), c(c0) {} + : SetTest(str(c0) == "[1,2,3]" + ? TestTag::normal : TestTag::sweep, + "Precede::Multi::"+str(c0),4,ds,false), c(c0) {} /// %Test whether \a x is solution virtual bool solution(const SetAssignment& x) const { for (int j=0; j @@ -46,7 +45,6 @@ main(int argc, char* argv[]) { #ifdef GECODE_HAS_MTRACE mtrace(); #endif - Test::apply_gecode_test_tags(); return Test::run_registered_tests(argc, argv); } diff --git a/test/test.hh b/test/test.hh index e1659eebd9..2422b0ad57 100755 --- a/test/test.hh +++ b/test/test.hh @@ -99,6 +99,8 @@ namespace Test { TestTags(void); /// Initialize with tag \a t TestTags(TestTag t); + /// Initialize with tags \a t0 and \a t1 + TestTags(TestTag t0, TestTag t1); /// Return set with all known tags static TestTags all(void); /// Whether no tags are set @@ -183,6 +185,8 @@ namespace Test { const std::string& name(void) const; /// Return tags for test TestTags tags(void) const; + /// Replace tags assigned to test with \a t + void tags(TestTags t); /// Add tags \a t to test void add_tags(TestTags t); /// Remove tags \a t from test diff --git a/test/test.hpp b/test/test.hpp index 7f77ae7ffc..9d932d6b18 100755 --- a/test/test.hpp +++ b/test/test.hpp @@ -46,6 +46,10 @@ namespace Test { inline TestTags::TestTags(TestTag t) : _mask(static_cast(t)) {} + inline + TestTags::TestTags(TestTag t0, TestTag t1) + : _mask(static_cast(t0) | + static_cast(t1)) {} inline bool TestTags::empty(void) const { return _mask == 0; @@ -87,6 +91,10 @@ namespace Test { return _tags; } inline void + Base::tags(TestTags t) { + _tags = t; + } + inline void Base::add_tags(TestTags t) { _tags.add(t); } From 159c2543c71e9d2fda41088ce19da3d16a448ed1 Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Sun, 6 Sep 2026 14:53:43 +0200 Subject: [PATCH 09/10] Polish public test tag integration --- CMakeLists.txt | 6 ++---- changelog.in | 9 +++++++++ cmake/GecodeSources.cmake | 4 +--- test/public-runner-smoke.cpp | 6 +++--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 217729001e..cb460c83fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -814,9 +814,7 @@ ${CONFIG_OUT}") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GecodeSources.cmake) if(GECODE_ENABLE_FAULT_INJECTION) list(APPEND GECODE_SUPPORT_SOURCES gecode/support/failpoint.cpp) - set(GECODE_FAULT_TEST_SOURCES - test/test-main.cpp - test/fault.cpp) + set(GECODE_FAULT_TEST_SOURCES ${GECODE_TEST_MAIN_SOURCE} test/fault.cpp) endif() # --------------------------------------------------------------------------- @@ -1467,7 +1465,7 @@ if(BUILD_TESTING) endif() if(GECODE_CAN_BUILD_TESTS) - add_executable(gecode-test EXCLUDE_FROM_ALL ${GECODE_TEST_MAIN_SOURCES} ${GECODE_TEST_SOURCES_SELECTED}) + add_executable(gecode-test EXCLUDE_FROM_ALL ${GECODE_TEST_MAIN_SOURCE} ${GECODE_TEST_SOURCES_SELECTED}) set(GECODE_TEST_LINK_LIBS gecodetestint gecodeminimodel) if(GECODE_ENABLE_FLATZINC) list(APPEND GECODE_TEST_LINK_LIBS gecodeflatzinc) diff --git a/changelog.in b/changelog.in index a27b454b3e..a49e964116 100755 --- a/changelog.in +++ b/changelog.in @@ -73,6 +73,15 @@ Date: unreleased [DESCRIPTION] This is the development changelog for the next Gecode release. +[ENTRY] +Module: test +What: new +Rank: major +[DESCRIPTION] +Add self-declared check, normal, and sweep tags to the public test harness. +The standard check targets use a focused integrity selection, while normal +testing retains broad coverage without the exhaustive multi-hour sweeps. + [ENTRY] Module: test What: new diff --git a/cmake/GecodeSources.cmake b/cmake/GecodeSources.cmake index 264fb747c1..1ddd513014 100644 --- a/cmake/GecodeSources.cmake +++ b/cmake/GecodeSources.cmake @@ -252,9 +252,7 @@ set(GECODE_TEST_INT_SOURCES test/int.cpp ) -set(GECODE_TEST_MAIN_SOURCES - test/test-main.cpp -) +set(GECODE_TEST_MAIN_SOURCE test/test-main.cpp) set(GECODE_TEST_PUBLIC_RUNNER_SMOKE_SOURCE test/public-runner-smoke.cpp) set(GECODE_TEST_PUBLIC_INT_SMOKE_SOURCE test/public-int-smoke.cpp) diff --git a/test/public-runner-smoke.cpp b/test/public-runner-smoke.cpp index cc088a3044..ea512eb510 100644 --- a/test/public-runner-smoke.cpp +++ b/test/public-runner-smoke.cpp @@ -51,7 +51,7 @@ namespace { class PassingSmokeTest : public Test::Base { public: PassingSmokeTest(void) - : Test::Base("Int::Linear::Int::Smoke::A-Pass") {} + : Test::Base("Smoke::A-Pass") {} bool run(void) override { passing_runs++; @@ -102,7 +102,7 @@ main(void) { "-list should succeed")) { return EXIT_FAILURE; } - const std::string pass_name = "Int::Linear::Int::Smoke::A-Pass"; + const std::string pass_name = "Smoke::A-Pass"; const std::string fail_name = "Smoke::B-Fail"; const std::size_t pass_pos = list_output.find(pass_name); const std::size_t fail_pos = list_output.find(fail_name); @@ -153,7 +153,7 @@ main(void) { } std::string pass_output; - if (!require(run_and_capture({"public-runner-smoke", "-test", "Int::Linear::Int::Smoke::A-Pass", "-iter", "1", "-stop", "true"}, + if (!require(run_and_capture({"public-runner-smoke", "-test", "Smoke::A-Pass", "-iter", "1", "-stop", "true"}, pass_output) == EXIT_SUCCESS, "filtered passing run should succeed")) { return EXIT_FAILURE; From 4bd11499e2023ca2dc53816e9f479605af9cd87a Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Sun, 6 Sep 2026 15:24:52 +0200 Subject: [PATCH 10/10] Make non-default test tags explicit --- docs/cmake-build.md | 8 +- docs/public-test-harness.md | 12 ++- test/branch.cpp | 7 +- test/branch.hh | 3 + test/branch/set.cpp | 10 +- test/flatzinc.cpp | 5 +- test/flatzinc/blackbox.cpp | 6 +- test/float/arithmetic.cpp | 174 +++++++++++++++++----------------- test/float/linear.cpp | 60 ++++++------ test/float/mm-lin.cpp | 8 +- test/float/transcendental.cpp | 51 +++++----- test/float/trigonometric.cpp | 78 ++++++++------- test/int/arithmetic.cpp | 79 ++++++++------- test/int/channel.cpp | 12 +-- test/int/cumulative.cpp | 23 +++-- test/int/distinct.cpp | 4 +- test/int/extensional.cpp | 59 ++++++------ test/int/linear.cpp | 61 ++++++------ test/int/mm-lin.cpp | 13 +-- test/int/no-overlap.cpp | 19 ++-- test/int/nvalues.cpp | 25 +++-- test/int/unary.cpp | 136 +++++++++++++------------- test/nogoods.cpp | 31 +++--- test/search.cpp | 75 ++++++++------- test/set/channel.cpp | 13 ++- test/set/dom.cpp | 9 +- test/set/exec.cpp | 7 +- test/set/mm-set.cpp | 54 ++++++----- test/set/precede.cpp | 12 +-- test/set/rel-op-const.cpp | 8 +- test/set/sequence.cpp | 7 +- test/test.hh | 6 -- test/test.hpp | 12 --- 33 files changed, 548 insertions(+), 539 deletions(-) diff --git a/docs/cmake-build.md b/docs/cmake-build.md index a9fe2d319b..4c49a8ecd3 100644 --- a/docs/cmake-build.md +++ b/docs/cmake-build.md @@ -98,10 +98,16 @@ gecode-test -tag check gecode-test -tag normal gecode-test -tag sweep gecode-test -tag normal -tag sweep +gecode-test -tag all ``` +With no `-tag` option, the runner does not restrict tests by tag. Repeated tags +form a union, while tag and name filters intersect. `-tag all` explicitly +selects every known tag. + Use `gecode-test -list-tags` to list known tags and -`gecode-test -list-with-tags` to inspect test assignments. +`gecode-test -list-with-tags` to inspect test assignments. Listing always shows +all registered tests, regardless of selection filters. ## Build Conventions and Key Options diff --git a/docs/public-test-harness.md b/docs/public-test-harness.md index 53ed48f5df..9dd5241231 100644 --- a/docs/public-test-harness.md +++ b/docs/public-test-harness.md @@ -157,7 +157,7 @@ where those checks do not apply. ## Select tests by tag Tests created with the one-argument `Test::Base` constructor have the `normal` -tag. A test can instead provide an explicit tag: +tag. Any other membership is assigned explicitly when the test is constructed: ```c++ ConsumerSmoke() @@ -165,17 +165,23 @@ ConsumerSmoke() ``` The runner recognizes the `check`, `normal`, and `sweep` tags. Repeating -`-tag` selects their union: +`-tag` selects their union. Without `-tag`, the runner does not restrict tests +by tag; `-tag all` is the explicit equivalent: ```bash ./consumer-smoke -tag normal ./consumer-smoke -tag normal -tag sweep +./consumer-smoke -tag all ``` +Name and tag filters intersect: a test must match both when both `-test` and +`-tag` are present. + Use `-list-tags` to list the recognized tags and `-list-with-tags` to show the tags assigned to every registered test. Gecode's tests declare their tags at registration, just like downstream tests; test names do not trigger implicit -classification. +classification. The listing commands always show all registered tests; they do +not apply `-test`, `-tag`, or `-start` filters. The runner uses the same option model as Gecode's own `gecode-test` binary. The supported public seam is the runner function, not a separate alternate CLI. diff --git a/test/branch.cpp b/test/branch.cpp index 3010055a11..23a63bc86f 100644 --- a/test/branch.cpp +++ b/test/branch.cpp @@ -732,8 +732,13 @@ namespace Test { namespace Branch { } #ifdef GECODE_HAS_SET_VARS + SetTest::SetTest(TestTags tags, const std::string& s, int a, + const Gecode::IntSet& d) + : Base("Set::Branch::"+s,tags), arity(a), dom(d) { + } + SetTest::SetTest(const std::string& s, int a, const Gecode::IntSet& d) - : Base("Set::Branch::"+s), arity(a), dom(d) { + : SetTest(TestTag::normal,s,a,d) { } bool diff --git a/test/branch.hh b/test/branch.hh index efda94bbe3..a73dfec1b5 100644 --- a/test/branch.hh +++ b/test/branch.hh @@ -107,6 +107,9 @@ namespace Test { /// Domain of variables Gecode::IntSet dom; public: + /// Construct and register test with explicitly assigned tags + SetTest(TestTags tags, const std::string& s, int a, + const Gecode::IntSet& d); /// Construct and register test SetTest(const std::string& s, int a, const Gecode::IntSet& d); /// Perform test diff --git a/test/branch/set.cpp b/test/branch/set.cpp index 401a6e6c68..de3494bc8f 100644 --- a/test/branch/set.cpp +++ b/test/branch/set.cpp @@ -41,10 +41,8 @@ namespace Test { namespace Branch { class Set : public SetTest { public: /// Create and register test - Set(const std::string& s, const Gecode::IntSet& d, int n) - : SetTest(s,n,d) { - tags(s == "Dense::3" ? TestTag::normal : TestTag::sweep); - } + Set(TestTags tags, const std::string& s, const Gecode::IntSet& d, int n) + : SetTest(tags,s,n,d) {} /// Post propagators on variables \a x virtual void post(Gecode::Space& home, Gecode::SetVarArray& x) { Gecode::SetVarArgs xx(x.size()-1); @@ -59,8 +57,8 @@ namespace Test { namespace Branch { const int v_sparse[6] = {-100,-10,0,10,100,1000}; Gecode::IntSet d_sparse(v_sparse,6); - Set d_3("Dense::3",d_dense,3); - Set s_3("Sparse::3",d_sparse,3); + Set d_3(TestTag::normal,"Dense::3",d_dense,3); + Set s_3(TestTag::sweep,"Sparse::3",d_sparse,3); } }} diff --git a/test/flatzinc.cpp b/test/flatzinc.cpp index 5417997651..ee98085d94 100755 --- a/test/flatzinc.cpp +++ b/test/flatzinc.cpp @@ -81,9 +81,8 @@ namespace Test { namespace FlatZinc { } public: GistStatisticsMode(void) - : Base("FlatZinc::Options::GistStatisticsMode") { - add_tags(TestTag::check); - } + : Base("FlatZinc::Options::GistStatisticsMode", + TestTags(TestTag::normal,TestTag::check)) {} virtual bool run(void) { return diff --git a/test/flatzinc/blackbox.cpp b/test/flatzinc/blackbox.cpp index 7a1d443f77..8cad3592ee 100644 --- a/test/flatzinc/blackbox.cpp +++ b/test/flatzinc/blackbox.cpp @@ -256,9 +256,9 @@ namespace Test { namespace FlatZinc { namespace Blackbox { class NativeProtocol : public Base { public: - NativeProtocol(void) : Base("FlatZinc::blackbox::native_protocol") { - add_tags(TestTag::check); - } + NativeProtocol(void) + : Base("FlatZinc::blackbox::native_protocol", + TestTags(TestTag::normal,TestTag::check)) {} virtual bool run(void) { std::vector int_input{-2}; std::vector float_input{1.25}; diff --git a/test/float/arithmetic.cpp b/test/float/arithmetic.cpp index d438b959c8..21c99a7f26 100755 --- a/test/float/arithmetic.cpp +++ b/test/float/arithmetic.cpp @@ -134,9 +134,8 @@ namespace Test { namespace Float { public: /// Create and register test PositiveNRootBounds(void) - : Base("Float::Arithmetic::PositiveNRootBounds") { - add_tags(TestTag::check); - } + : Base("Float::Arithmetic::PositiveNRootBounds", + TestTags(TestTag::normal,TestTag::check)) {} /// Run test under every supported IEEE-754 rounding mode virtual bool run(void) { const int oldMode = std::fegetround(); @@ -366,9 +365,9 @@ namespace Test { namespace Float { } public: /// Create and register test - PowConsistency(void) : Base("Float::Arithmetic::PowConsistency") { - add_tags(TestTag::check); - } + PowConsistency(void) + : Base("Float::Arithmetic::PowConsistency", + TestTags(TestTag::normal,TestTag::check)) {} /// Run zero and fixpoint regressions virtual bool run(void) { bool result = true; @@ -490,9 +489,8 @@ namespace Test { namespace Float { public: /// Create and register test MultZeroEndpoint(void) - : Base("Float::Arithmetic::MultZeroEndpoint") { - add_tags(TestTag::check); - } + : Base("Float::Arithmetic::MultZeroEndpoint", + TestTags(TestTag::normal,TestTag::check)) {} /// Run sign, symmetry, signed-zero, and zero-product cases virtual bool run(void) { bool result = true; @@ -549,13 +547,10 @@ namespace Test { namespace Float { class MultXYZSol : public Test { public: /// Create and register test - MultXYZSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTag::sweep,"Arithmetic::Mult::XYZ::Sol::"+s,3,d,st,EXTEND_ASSIGNMENT,false) { - if (s == "C") { - tags(TestTag::normal); - add_tags(TestTag::check); - } - } + MultXYZSol(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags,"Arithmetic::Mult::XYZ::Sol::"+s, + 3,d,st,EXTEND_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[1], x[2]); @@ -670,9 +665,10 @@ namespace Test { namespace Float { class Div : public Test { public: /// Create and register test - Div(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(s == "A" ? TestTag::normal : TestTag::sweep, - "Arithmetic::Div::"+s,3,d,st,CPLT_ASSIGNMENT,false) {} + Div(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags,"Arithmetic::Div::"+s, + 3,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] / x[1], x[2]); @@ -761,9 +757,10 @@ namespace Test { namespace Float { class SqrXX : public Test { public: /// Create and register test - SqrXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(s == "A" ? TestTag::normal : TestTag::sweep, - "Arithmetic::Sqr::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + SqrXX(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags,"Arithmetic::Sqr::XX::"+s, + 1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(x[0] * x[0], x[0]); @@ -833,9 +830,10 @@ namespace Test { namespace Float { class SqrtXX : public Test { public: /// Create and register test - SqrtXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(s == "A" ? TestTag::normal : TestTag::sweep, - "Arithmetic::Sqrt::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + SqrtXX(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags,"Arithmetic::Sqrt::XX::"+s, + 1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) { @@ -876,13 +874,11 @@ namespace Test { namespace Float { unsigned int n; public: /// Create and register test - PowXYSol(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test(TestTag::sweep,"Arithmetic::Pow::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) { - if ((_n == 2) && (s == "C")) { - tags(TestTag::normal); - add_tags(TestTag::check); - } - } + PowXYSol(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, unsigned int _n, + Gecode::FloatNum st) + : Test(tags,"Arithmetic::Pow::N::"+str(_n)+"::XY::Sol::"+s, + 2,d,st,EXTEND_ASSIGNMENT,false), n(_n) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(pow(x[0],n), x[1]); @@ -947,13 +943,11 @@ namespace Test { namespace Float { unsigned int n; public: /// Create and register test - NRootXYSol(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test(TestTag::sweep,"Arithmetic::NRoot::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) { - if ((_n == 2) && (s == "C")) { - tags(TestTag::normal); - add_tags(TestTag::check); - } - } + NRootXYSol(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, unsigned int _n, + Gecode::FloatNum st) + : Test(tags,"Arithmetic::NRoot::N::"+str(_n)+"::XY::Sol::"+s, + 2,d,st,EXTEND_ASSIGNMENT,false), n(_n) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((n == 0) || (x[0].min() < 0.0)) @@ -1020,9 +1014,10 @@ namespace Test { namespace Float { class AbsXX : public Test { public: /// Create and register test - AbsXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(s == "A" ? TestTag::normal : TestTag::sweep, - "Arithmetic::Abs::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + AbsXX(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags,"Arithmetic::Abs::XX::"+s, + 1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(abs(x[0]), x[0]); @@ -1104,9 +1099,10 @@ namespace Test { namespace Float { class MinXXX : public Test { public: /// Create and register test - MinXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(s == "A" ? TestTag::normal : TestTag::sweep, - "Arithmetic::Min::Bin::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + MinXXX(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags,"Arithmetic::Min::Bin::XXX::"+s, + 1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(min(x[0],x[0]), x[0]); @@ -1188,9 +1184,10 @@ namespace Test { namespace Float { class MaxXXX : public Test { public: /// Create and register test - MaxXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(s == "A" ? TestTag::normal : TestTag::sweep, - "Arithmetic::Max::Bin::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + MaxXXX(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags,"Arithmetic::Max::Bin::XXX::"+s, + 1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(max(x[0],x[0]), x[0]); @@ -1308,13 +1305,14 @@ namespace Test { namespace Float { MultXYZ mult_xyz_b("B",b,step); MultXYZ mult_xyz_c("C",c,step); - MultXYZSol mult_xyz_sol_a("A",a,step); - MultXYZSol mult_xyz_sol_b("B",b,step); - MultXYZSol mult_xyz_sol_c("C",c,step); + MultXYZSol mult_xyz_sol_a(TestTag::sweep,"A",a,step); + MultXYZSol mult_xyz_sol_b(TestTag::sweep,"B",b,step); + MultXYZSol mult_xyz_sol_c( + TestTags(TestTag::normal,TestTag::check),"C",c,step); - Div div_a("A",a,step); - Div div_b("B",b,step); - Div div_c("C",c,step); + Div div_a(TestTag::normal,"A",a,step); + Div div_b(TestTag::sweep,"B",b,step); + Div div_c(TestTag::sweep,"C",c,step); DivSol div_sol_a("A",a,step); DivSol div_sol_b("B",b,step); @@ -1328,9 +1326,9 @@ namespace Test { namespace Float { SqrXYSol sqr_xy_sol_b("B",b,step); SqrXYSol sqr_xy_sol_c("C",c,step); - SqrXX sqr_xx_a("A",a,step); - SqrXX sqr_xx_b("B",b,step); - SqrXX sqr_xx_c("C",c,step); + SqrXX sqr_xx_a(TestTag::normal,"A",a,step); + SqrXX sqr_xx_b(TestTag::sweep,"B",b,step); + SqrXX sqr_xx_c(TestTag::sweep,"C",c,step); SqrtXY sqrt_xy_a("A",a,step); SqrtXY sqrt_xy_b("B",b,step); @@ -1340,17 +1338,18 @@ namespace Test { namespace Float { SqrtXYSol sqrt_xy_sol_b("B",b,step); SqrtXYSol sqrt_xy_sol_c("C",c,step); - SqrtXX sqrt_xx_a("A",a,step); - SqrtXX sqrt_xx_b("B",b,step); - SqrtXX sqrt_xx_c("C",c,step); + SqrtXX sqrt_xx_a(TestTag::normal,"A",a,step); + SqrtXX sqrt_xx_b(TestTag::sweep,"B",b,step); + SqrtXX sqrt_xx_c(TestTag::sweep,"C",c,step); PowXY pow_xy_a_1("A",a,2,step); PowXY pow_xy_b_1("B",b,2,step); PowXY pow_xy_c_1("C",c,2,step); - PowXYSol pow_xy_sol_a_1("A",a,2,step); - PowXYSol pow_xy_sol_b_1("B",b,2,step); - PowXYSol pow_xy_sol_c_1("C",c,2,step); + PowXYSol pow_xy_sol_a_1(TestTag::sweep,"A",a,2,step); + PowXYSol pow_xy_sol_b_1(TestTag::sweep,"B",b,2,step); + PowXYSol pow_xy_sol_c_1( + TestTags(TestTag::normal,TestTag::check),"C",c,2,step); PowXX pow_xx_a_1("A",a,2,step); PowXX pow_xx_b_1("B",b,2,step); @@ -1360,9 +1359,9 @@ namespace Test { namespace Float { PowXY pow_xy_b_2("B",b,3,step); PowXY pow_xy_c_2("C",c,3,step); - PowXYSol pow_xy_sol_a_2("A",a,3,step); - PowXYSol pow_xy_sol_b_2("B",b,3,step); - PowXYSol pow_xy_sol_c_2("C",c,3,step); + PowXYSol pow_xy_sol_a_2(TestTag::sweep,"A",a,3,step); + PowXYSol pow_xy_sol_b_2(TestTag::sweep,"B",b,3,step); + PowXYSol pow_xy_sol_c_2(TestTag::sweep,"C",c,3,step); PowXX pow_xx_a_2("A",a,3,step); PowXX pow_xx_b_2("B",b,3,step); @@ -1372,9 +1371,9 @@ namespace Test { namespace Float { PowXY pow_xy_b_3("B",b,0,step); PowXY pow_xy_c_3("C",c,0,step); - PowXYSol pow_xy_sol_a_3("A",a,0,step); - PowXYSol pow_xy_sol_b_3("B",b,0,step); - PowXYSol pow_xy_sol_c_3("C",c,0,step); + PowXYSol pow_xy_sol_a_3(TestTag::sweep,"A",a,0,step); + PowXYSol pow_xy_sol_b_3(TestTag::sweep,"B",b,0,step); + PowXYSol pow_xy_sol_c_3(TestTag::sweep,"C",c,0,step); PowXX pow_xx_a_3("A",a,0,step); PowXX pow_xx_b_3("B",b,0,step); @@ -1384,9 +1383,10 @@ namespace Test { namespace Float { NRootXY nroot_xy_b_1("B",b,2,step); NRootXY nroot_xy_c_1("C",c,2,step); - NRootXYSol nroot_xy_sol_a_1("A",a,2,step); - NRootXYSol nroot_xy_sol_b_1("B",b,2,step); - NRootXYSol nroot_xy_sol_c_1("C",c,2,step); + NRootXYSol nroot_xy_sol_a_1(TestTag::sweep,"A",a,2,step); + NRootXYSol nroot_xy_sol_b_1(TestTag::sweep,"B",b,2,step); + NRootXYSol nroot_xy_sol_c_1( + TestTags(TestTag::normal,TestTag::check),"C",c,2,step); NRootXX nroot_xx_a_1("A",a,2,step); NRootXX nroot_xx_b_1("B",b,2,step); @@ -1396,9 +1396,9 @@ namespace Test { namespace Float { NRootXY nroot_xy_b_2("B",b,3,step); NRootXY nroot_xy_c_2("C",c,3,step); - NRootXYSol nroot_xy_sol_a_2("A",a,3,step); - NRootXYSol nroot_xy_sol_b_2("B",b,3,step); - NRootXYSol nroot_xy_sol_c_2("C",c,3,step); + NRootXYSol nroot_xy_sol_a_2(TestTag::sweep,"A",a,3,step); + NRootXYSol nroot_xy_sol_b_2(TestTag::sweep,"B",b,3,step); + NRootXYSol nroot_xy_sol_c_2(TestTag::sweep,"C",c,3,step); NRootXX nroot_xx_a_2("A",a,3,step); NRootXX nroot_xx_b_2("B",b,3,step); @@ -1408,9 +1408,9 @@ namespace Test { namespace Float { NRootXY nroot_xy_b_3("B",b,0,step); NRootXY nroot_xy_c_3("C",c,0,step); - NRootXYSol nroot_xy_sol_a_3("A",a,0,step); - NRootXYSol nroot_xy_sol_b_3("B",b,0,step); - NRootXYSol nroot_xy_sol_c_3("C",c,0,step); + NRootXYSol nroot_xy_sol_a_3(TestTag::sweep,"A",a,0,step); + NRootXYSol nroot_xy_sol_b_3(TestTag::sweep,"B",b,0,step); + NRootXYSol nroot_xy_sol_c_3(TestTag::sweep,"C",c,0,step); NRootXX nroot_xx_a_3("A",a,0,step); NRootXX nroot_xx_b_3("B",b,0,step); @@ -1420,9 +1420,9 @@ namespace Test { namespace Float { AbsXY abs_xy_b("B",b,step); AbsXY abs_xy_c("C",c,step); - AbsXX abs_xx_a("A",a,step); - AbsXX abs_xx_b("B",b,step); - AbsXX abs_xx_c("C",c,step); + AbsXX abs_xx_a(TestTag::normal,"A",a,step); + AbsXX abs_xx_b(TestTag::sweep,"B",b,step); + AbsXX abs_xx_c(TestTag::sweep,"C",c,step); MinXYZ min_xyz_a("A",a,step); MinXYZ min_xyz_b("B",b,step); @@ -1440,9 +1440,9 @@ namespace Test { namespace Float { MinXYY min_xyy_b("B",b,step); MinXYY min_xyy_c("C",c,step); - MinXXX min_xxx_a("A",a,step); - MinXXX min_xxx_b("B",b,step); - MinXXX min_xxx_c("C",c,step); + MinXXX min_xxx_a(TestTag::normal,"A",a,step); + MinXXX min_xxx_b(TestTag::sweep,"B",b,step); + MinXXX min_xxx_c(TestTag::sweep,"C",c,step); MaxXYZ max_xyz_a("A",a,step); MaxXYZ max_xyz_b("B",b,step); @@ -1460,9 +1460,9 @@ namespace Test { namespace Float { MaxXYY max_xyy_b("B",b,step); MaxXYY max_xyy_c("C",c,step); - MaxXXX max_xxx_a("A",a,step); - MaxXXX max_xxx_b("B",b,step); - MaxXXX max_xxx_c("C",c,step); + MaxXXX max_xxx_a(TestTag::normal,"A",a,step); + MaxXXX max_xxx_b(TestTag::sweep,"B",b,step); + MaxXXX max_xxx_c(TestTag::sweep,"C",c,step); MinNary min_nary; MinNaryShared min_s_nary; diff --git a/test/float/linear.cpp b/test/float/linear.cpp index 8111250674..1796f1e6f6 100644 --- a/test/float/linear.cpp +++ b/test/float/linear.cpp @@ -66,12 +66,11 @@ namespace Test { namespace Float { Gecode::FloatNum c; public: /// Create and register test - FloatFloat(const std::string& s, const Gecode::FloatVal& d, + FloatFloat(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, const Gecode::FloatValArgs& a0, Gecode::FloatRelType frt0, Gecode::FloatNum c0, Gecode::FloatNum st) - : Test((s == "11") && (frt0 == Gecode::FRT_EQ) && - (c0 == 0.0) && (a0.size() == 1) - ? TestTag::normal : TestTag::sweep,"Linear::Float::"+ + : Test(tags,"Linear::Float::"+ str(frt0)+"::"+s+"::"+str(c0)+"::" +str(a0.size()), a0.size(),d,st,CPLT_ASSIGNMENT,true), @@ -130,11 +129,10 @@ namespace Test { namespace Float { Gecode::FloatRelType frt; public: /// Create and register test - FloatVar(const std::string& s, const Gecode::FloatVal& d, + FloatVar(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, const Gecode::FloatValArgs& a0, Gecode::FloatRelType frt0, Gecode::FloatNum st) - : Test((s == "11") && (frt0 == Gecode::FRT_EQ) && - (a0.size() == 1) ? TestTag::normal : TestTag::sweep, - "Linear::Var::"+ + : Test(tags,"Linear::Var::"+ str(frt0)+"::"+s+"::"+str(a0.size()), a0.size()+1,d,st,CPLT_ASSIGNMENT,true), a(a0), frt(frt0) { @@ -207,11 +205,13 @@ namespace Test { namespace Float { a1[0] = 0.0; for (FloatRelTypes frts; frts(); ++frts) { - (void) new FloatFloat("11",f1,a1,frts.frt(),0.0,step); - (void) new FloatVar("11",f1,a1,frts.frt(),step); - (void) new FloatFloat("21",f2,a1,frts.frt(),0.0,step); - (void) new FloatVar("21",f2,a1,frts.frt(),step); - (void) new FloatFloat("31",f3,a1,frts.frt(),1.0,step); + TestTags tags = frts.frt() == Gecode::FRT_EQ + ? TestTag::normal : TestTag::sweep; + (void) new FloatFloat(tags,"11",f1,a1,frts.frt(),0.0,step); + (void) new FloatVar(tags,"11",f1,a1,frts.frt(),step); + (void) new FloatFloat(TestTag::sweep,"21",f2,a1,frts.frt(),0.0,step); + (void) new FloatVar(TestTag::sweep,"21",f2,a1,frts.frt(),step); + (void) new FloatFloat(TestTag::sweep,"31",f3,a1,frts.frt(),1.0,step); } const FloatVal av2[4] = {1.0,1.0,1.0,1.0}; @@ -225,24 +225,24 @@ namespace Test { namespace Float { FloatValArgs a4(i, av4); FloatValArgs a5(i, av5); for (FloatRelTypes frts; frts(); ++frts) { - (void) new FloatFloat("12",f1,a2,frts.frt(),0.0,step); - (void) new FloatFloat("13",f1,a3,frts.frt(),0.0,step); - (void) new FloatFloat("14",f1,a4,frts.frt(),0.0,step); - (void) new FloatFloat("15",f1,a5,frts.frt(),0.0,step); - (void) new FloatFloat("22",f2,a2,frts.frt(),0.0,step); - (void) new FloatFloat("23",f2,a3,frts.frt(),0.0,step); - (void) new FloatFloat("24",f2,a4,frts.frt(),0.0,step); - (void) new FloatFloat("25",f2,a5,frts.frt(),0.0,step); - (void) new FloatFloat("32",f3,a2,frts.frt(),1.0,step); + (void) new FloatFloat(TestTag::sweep,"12",f1,a2,frts.frt(),0.0,step); + (void) new FloatFloat(TestTag::sweep,"13",f1,a3,frts.frt(),0.0,step); + (void) new FloatFloat(TestTag::sweep,"14",f1,a4,frts.frt(),0.0,step); + (void) new FloatFloat(TestTag::sweep,"15",f1,a5,frts.frt(),0.0,step); + (void) new FloatFloat(TestTag::sweep,"22",f2,a2,frts.frt(),0.0,step); + (void) new FloatFloat(TestTag::sweep,"23",f2,a3,frts.frt(),0.0,step); + (void) new FloatFloat(TestTag::sweep,"24",f2,a4,frts.frt(),0.0,step); + (void) new FloatFloat(TestTag::sweep,"25",f2,a5,frts.frt(),0.0,step); + (void) new FloatFloat(TestTag::sweep,"32",f3,a2,frts.frt(),1.0,step); if (i < 4) { - (void) new FloatVar("12",f1,a2,frts.frt(),step); - (void) new FloatVar("13",f1,a3,frts.frt(),step); - (void) new FloatVar("14",f1,a4,frts.frt(),step); - (void) new FloatVar("15",f1,a5,frts.frt(),step); - (void) new FloatVar("22",f2,a2,frts.frt(),step); - (void) new FloatVar("23",f2,a3,frts.frt(),step); - (void) new FloatVar("24",f2,a4,frts.frt(),step); - (void) new FloatVar("25",f2,a5,frts.frt(),step); + (void) new FloatVar(TestTag::sweep,"12",f1,a2,frts.frt(),step); + (void) new FloatVar(TestTag::sweep,"13",f1,a3,frts.frt(),step); + (void) new FloatVar(TestTag::sweep,"14",f1,a4,frts.frt(),step); + (void) new FloatVar(TestTag::sweep,"15",f1,a5,frts.frt(),step); + (void) new FloatVar(TestTag::sweep,"22",f2,a2,frts.frt(),step); + (void) new FloatVar(TestTag::sweep,"23",f2,a3,frts.frt(),step); + (void) new FloatVar(TestTag::sweep,"24",f2,a4,frts.frt(),step); + (void) new FloatVar(TestTag::sweep,"25",f2,a5,frts.frt(),step); } } } diff --git a/test/float/mm-lin.cpp b/test/float/mm-lin.cpp index 0168e67a0a..29857890dc 100644 --- a/test/float/mm-lin.cpp +++ b/test/float/mm-lin.cpp @@ -98,9 +98,8 @@ namespace Test { namespace Float { const LinInstr* lis; public: /// Create and register test - LinExpr(const LinInstr* lis0, const std::string& s) - : Test(s == "000" ? TestTag::normal : TestTag::sweep, - "Float::","MiniModel::LinExpr::"+s,4,-3,3), + LinExpr(TestTags tags, const LinInstr* lis0, const std::string& s) + : Test(tags,"Float::","MiniModel::LinExpr::"+s,4,-3,3), lis(lis0) { testfix = false; } @@ -1875,7 +1874,8 @@ namespace Test { namespace Float { } else if (i < 100) { s = "0" + s; } - (void) new LinExpr(li[i],s); + (void) new LinExpr(i == 0 ? TestTag::normal : TestTag::sweep, + li[i],s); } FloatRelTypes frts; for (int i=0; i 1.0) || (x[0].max() < -1.0)) @@ -357,9 +361,10 @@ namespace Test { namespace Float { class ACosXX : public Test { public: /// Create and register test - ACosXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(s == "A" ? TestTag::normal : TestTag::sweep, - "Trigonometric::ACos::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + ACosXX(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags,"Trigonometric::ACos::XX::"+s, + 1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) @@ -421,9 +426,10 @@ namespace Test { namespace Float { class ATanXX : public Test { public: /// Create and register test - ATanXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(s == "A" ? TestTag::normal : TestTag::sweep, - "Trigonometric::ATan::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {} + ATanXX(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags,"Trigonometric::ATan::XX::"+s, + 1,d,st,CPLT_ASSIGNMENT,false) {} /// %Test whether \a x is solution virtual MaybeType solution(const Assignment& x) const { return eq(atan(x[0]), x[0]); @@ -448,9 +454,9 @@ namespace Test { namespace Float { SinXYSol sin_xy_sol_b("B",b,step); SinXYSol sin_xy_sol_c("C",c,step); - SinXX sin_xx_a("A",a,step); - SinXX sin_xx_b("B",b,step); - SinXX sin_xx_c("C",c,step); + SinXX sin_xx_a(TestTag::normal,"A",a,step); + SinXX sin_xx_b(TestTag::sweep,"B",b,step); + SinXX sin_xx_c(TestTag::sweep,"C",c,step); CosXY cos_xy_a("A",a,step); CosXY cos_xy_b("B",b,step); @@ -460,9 +466,9 @@ namespace Test { namespace Float { CosXYSol cos_xy_sol_b("B",b,step); CosXYSol cos_xy_sol_c("C",c,step); - CosXX cos_xx_a("A",a,step); - CosXX cos_xx_b("B",b,step); - CosXX cos_xx_c("C",c,step); + CosXX cos_xx_a(TestTag::normal,"A",a,step); + CosXX cos_xx_b(TestTag::sweep,"B",b,step); + CosXX cos_xx_c(TestTag::sweep,"C",c,step); TanXY tan_xy_a("A",a,step); TanXY tan_xy_b("B",b,step); @@ -472,9 +478,9 @@ namespace Test { namespace Float { TanXYSol tan_xy_sol_b("B",b,step); TanXYSol tan_xy_sol_c("C",c,step); - TanXX tan_xx_a("A",a,step); - TanXX tan_xx_b("B",b,step); - TanXX tan_xx_c("C",c,step); + TanXX tan_xx_a(TestTag::normal,"A",a,step); + TanXX tan_xx_b(TestTag::sweep,"B",b,step); + TanXX tan_xx_c(TestTag::sweep,"C",c,step); ASinXY asin_xy_a("A",a,step); ASinXY asin_xy_b("B",b,step); @@ -484,9 +490,9 @@ namespace Test { namespace Float { ASinXYSol asin_xy_sol_b("B",b,step); ASinXYSol asin_xy_sol_c("C",c,step); - ASinXX asin_xx_a("A",a,step); - ASinXX asin_xx_b("B",b,step); - ASinXX asin_xx_c("C",c,step); + ASinXX asin_xx_a(TestTag::normal,"A",a,step); + ASinXX asin_xx_b(TestTag::sweep,"B",b,step); + ASinXX asin_xx_c(TestTag::sweep,"C",c,step); ACosXY acos_xy_a("A",a,step); ACosXY acos_xy_b("B",b,step); @@ -496,9 +502,9 @@ namespace Test { namespace Float { ACosXYSol acos_xy_sol_b("B",b,step); ACosXYSol acos_xy_sol_c("C",c,step); - ACosXX acos_xx_a("A",a,step); - ACosXX acos_xx_b("B",b,step); - ACosXX acos_xx_c("C",c,step); + ACosXX acos_xx_a(TestTag::normal,"A",a,step); + ACosXX acos_xx_b(TestTag::sweep,"B",b,step); + ACosXX acos_xx_c(TestTag::sweep,"C",c,step); ATanXY atan_xy_a("A",a,step); ATanXY atan_xy_b("B",b,step); @@ -508,9 +514,9 @@ namespace Test { namespace Float { ATanXYSol atan_xy_sol_b("B",b,step); ATanXYSol atan_xy_sol_c("C",c,step); - ATanXX atan_xx_a("A",a,step); - ATanXX atan_xx_b("B",b,step); - ATanXX atan_xx_c("C",c,step); + ATanXX atan_xx_a(TestTag::normal,"A",a,step); + ATanXX atan_xx_b(TestTag::sweep,"B",b,step); + ATanXX atan_xx_c(TestTag::sweep,"C",c,step); //@} diff --git a/test/int/arithmetic.cpp b/test/int/arithmetic.cpp index 043f9f80b6..3b48f4ac69 100644 --- a/test/int/arithmetic.cpp +++ b/test/int/arithmetic.cpp @@ -262,10 +262,10 @@ namespace Test { namespace Int { int n; public: /// Create and register test - PowXX(const std::string& s, int n0, const Gecode::IntSet& d, + PowXX(TestTags tags, const std::string& s, + int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test((n0 == 0) && (ipl == Gecode::IPL_BND) && (s == "A") - ? TestTag::normal : TestTag::sweep, + : Test(tags, "Arithmetic::Pow::XX::"+str(n0)+"::"+str(ipl)+"::"+s, 1,d,false,ipl), n(n0) {} /// %Test whether \a x is solution @@ -379,10 +379,10 @@ namespace Test { namespace Int { int n; public: /// Create and register test - NrootXX(const std::string& s, int n0, const Gecode::IntSet& d, + NrootXX(TestTags tags, const std::string& s, + int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test((n0 == 1) && (ipl == Gecode::IPL_BND) && (s == "A") - ? TestTag::normal : TestTag::sweep, + : Test(tags, "Arithmetic::Nroot::XX::"+str(n0)+"::"+str(ipl)+"::"+s, 1,d,false,ipl), n(n0) {} /// %Test whether \a x is solution @@ -476,9 +476,8 @@ namespace Test { namespace Int { /// Create and register test AbsXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Abs::XY::"+str(ipl)+"::"+s,2,d,false,ipl) { - add_tags(TestTag::check); - } + : Test(TestTags(TestTag::normal,TestTag::check), + "Arithmetic::Abs::XY::"+str(ipl)+"::"+s,2,d,false,ipl) {} /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { double d0 = static_cast(x[0]); @@ -497,9 +496,8 @@ namespace Test { namespace Int { /// Create and register test AbsXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Abs::XX::"+str(ipl)+"::"+s,1,d,false,ipl) { - add_tags(TestTag::check); - } + : Test(TestTags(TestTag::normal,TestTag::check), + "Arithmetic::Abs::XX::"+str(ipl)+"::"+s,1,d,false,ipl) {} /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { double d0 = static_cast(x[0]); @@ -725,9 +723,8 @@ namespace Test { namespace Int { public: /// Create and register test MaxNary(Gecode::IntPropLevel ipl) - : Test("Arithmetic::Max::Nary::"+str(ipl),4,-4,4,false,ipl) { - add_tags(TestTag::check); - } + : Test(TestTags(TestTag::normal,TestTag::check), + "Arithmetic::Max::Nary::"+str(ipl),4,-4,4,false,ipl) {} /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { return std::max(std::max(x[0],x[1]), x[2]) == x[3]; @@ -745,9 +742,9 @@ namespace Test { namespace Int { public: /// Create and register test MaxNaryShared(Gecode::IntPropLevel ipl) - : Test("Arithmetic::Max::Nary::Shared::"+str(ipl),3,-4,4,false,ipl) { - add_tags(TestTag::check); - } + : Test(TestTags(TestTag::normal,TestTag::check), + "Arithmetic::Max::Nary::Shared::"+str(ipl), + 3,-4,4,false,ipl) {} /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { return std::max(std::max(x[0],x[1]), x[2]) == x[1]; @@ -770,12 +767,11 @@ namespace Test { namespace Int { public: /// Create and register test ArgMax(int n, int o, bool tb) - : Test("Arithmetic::ArgMax::"+str(o)+"::"+str(tb)+"::"+str(n), + : Test(TestTags(TestTag::normal,TestTag::check), + "Arithmetic::ArgMax::"+str(o)+"::"+str(tb)+"::"+str(n), n+1,0,n+1, false,tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), - offset(o), tiebreak(tb) { - add_tags(TestTag::check); - } + offset(o), tiebreak(tb) {} /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { int n=x.size()-1; @@ -806,10 +802,10 @@ namespace Test { namespace Int { public: /// Create and register test ArgMaxShared(int n, bool tb) - : Test("Arithmetic::ArgMax::Shared::"+str(tb)+"::"+str(n),n+1,0,n+1, + : Test(TestTags(TestTag::normal,TestTag::check), + "Arithmetic::ArgMax::Shared::"+str(tb)+"::"+str(n),n+1,0,n+1, false), tiebreak(tb) { - add_tags(TestTag::check); testfix=false; } /// %Test whether \a x is solution @@ -921,12 +917,11 @@ namespace Test { namespace Int { public: /// Create and register test ArgMaxBool(int n, int o, bool tb) - : Test("Arithmetic::ArgMaxBool::"+str(o)+"::"+str(tb)+"::"+str(n), + : Test(TestTags(TestTag::normal,TestTag::check), + "Arithmetic::ArgMaxBool::"+str(o)+"::"+str(tb)+"::"+str(n), n+1,0,n+1, false,tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), - offset(o), tiebreak(tb) { - add_tags(TestTag::check); - } + offset(o), tiebreak(tb) {} /// %Test whether \a x is solution virtual bool solution(const Assignment& x) const { int n=x.size()-1; @@ -962,10 +957,10 @@ namespace Test { namespace Int { public: /// Create and register test ArgMaxBoolShared(int n, bool tb) - : Test("Arithmetic::ArgMaxBool::Shared::"+str(tb)+"::"+str(n),n+1,0,n+1, + : Test(TestTags(TestTag::normal,TestTag::check), + "Arithmetic::ArgMaxBool::Shared::"+str(tb)+"::"+str(n),n+1,0,n+1, false), tiebreak(tb) { - add_tags(TestTag::check); testfix=false; } /// %Test whether \a x is solution @@ -1162,10 +1157,12 @@ namespace Test { namespace Int { (void) new PowXY("C",n,c,ipls.ipl()); (void) new PowXY("D",n,d,ipls.ipl()); - (void) new PowXX("A",n,a,ipls.ipl()); - (void) new PowXX("B",n,b,ipls.ipl()); - (void) new PowXX("C",n,c,ipls.ipl()); - (void) new PowXX("D",n,d,ipls.ipl()); + TestTags tags = (n == 0) && (ipls.ipl() == Gecode::IPL_BND) + ? TestTag::normal : TestTag::sweep; + (void) new PowXX(tags,"A",n,a,ipls.ipl()); + (void) new PowXX(TestTag::sweep,"B",n,b,ipls.ipl()); + (void) new PowXX(TestTag::sweep,"C",n,c,ipls.ipl()); + (void) new PowXX(TestTag::sweep,"D",n,d,ipls.ipl()); } for (int n=1; n<=6; n++) { @@ -1174,17 +1171,19 @@ namespace Test { namespace Int { (void) new NrootXY("C",n,c,ipls.ipl()); (void) new NrootXY("D",n,d,ipls.ipl()); - (void) new NrootXX("A",n,a,ipls.ipl()); - (void) new NrootXX("B",n,b,ipls.ipl()); - (void) new NrootXX("C",n,c,ipls.ipl()); - (void) new NrootXX("D",n,d,ipls.ipl()); + TestTags tags = (n == 1) && (ipls.ipl() == Gecode::IPL_BND) + ? TestTag::normal : TestTag::sweep; + (void) new NrootXX(tags,"A",n,a,ipls.ipl()); + (void) new NrootXX(TestTag::sweep,"B",n,b,ipls.ipl()); + (void) new NrootXX(TestTag::sweep,"C",n,c,ipls.ipl()); + (void) new NrootXX(TestTag::sweep,"D",n,d,ipls.ipl()); } for (int n=30; n<=34; n++) { (void) new PowXY("C",n,c,ipls.ipl()); - (void) new PowXX("C",n,c,ipls.ipl()); + (void) new PowXX(TestTag::sweep,"C",n,c,ipls.ipl()); (void) new NrootXY("C",n,c,ipls.ipl()); - (void) new NrootXX("C",n,c,ipls.ipl()); + (void) new NrootXX(TestTag::sweep,"C",n,c,ipls.ipl()); } (void) new SqrtXY("A",a,ipls.ipl()); diff --git a/test/int/channel.cpp b/test/int/channel.cpp index e1f4e12b3e..abb7b9e6c2 100644 --- a/test/int/channel.cpp +++ b/test/int/channel.cpp @@ -168,9 +168,9 @@ namespace Test { namespace Int { int o; public: /// Construct and register test - ChannelLinkMulti(const std::string& s, int min, int max, int o0) - : Test(s == "A" ? TestTag::normal : TestTag::sweep, - "Channel::Bool::Multi::"+s,7,min,max), o(o0) { + ChannelLinkMulti(TestTags tags, const std::string& s, + int min, int max, int o0) + : Test(tags,"Channel::Bool::Multi::"+s,7,min,max), o(o0) { } /// Check whether \a x is solution virtual bool solution(const Assignment& x) const { @@ -219,9 +219,9 @@ namespace Test { namespace Int { ChannelLinkSingle cls; - ChannelLinkMulti clma("A", 0, 5, 0); - ChannelLinkMulti clmb("B", 1, 6, 1); - ChannelLinkMulti clmc("C",-1, 4,-1); + ChannelLinkMulti clma(TestTag::normal,"A", 0, 5, 0); + ChannelLinkMulti clmb(TestTag::sweep,"B", 1, 6, 1); + ChannelLinkMulti clmc(TestTag::sweep,"C",-1, 4,-1); //@} } diff --git a/test/int/cumulative.cpp b/test/int/cumulative.cpp index 964138fc88..fa606fbb50 100755 --- a/test/int/cumulative.cpp +++ b/test/int/cumulative.cpp @@ -71,14 +71,13 @@ namespace Test { namespace Int { const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) - : Test(TestTag::sweep,"Cumulative::Man::Fix::"+str(o0)+"::"+ + : Test((o0 == 0) && (c0 == 4) + ? TestTags(TestTag::normal,TestTag::check) + : TestTags(TestTag::sweep), + "Cumulative::Man::Fix::"+str(o0)+"::"+ str(c0)+"::"+str(p0)+"::"+str(u0)+"::"+str(ipl0), (c0 >= 0) ? p0.size():p0.size()+1,0,st(c0,p0,u0),false,ipl0), c(c0), p(p0), u(u0), o(o0) { - if ((o0 == 0) && (c0 == 4)) { - tags(TestTag::normal); - add_tags(TestTag::check); - } testsearch = false; testfix = false; contest = CTL_NONE; @@ -178,13 +177,13 @@ namespace Test { namespace Int { const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) - : Test(TestTag::sweep,"Cumulative::Opt::Fix::"+str(o0)+"::"+ + : Test((o0 == Gecode::Int::Limits::min) && (c0 == -1) + ? TestTags(TestTag::normal) : TestTags(TestTag::sweep), + "Cumulative::Opt::Fix::"+str(o0)+"::"+ str(c0)+"::"+str(p0)+"::"+str(u0)+"::"+str(ipl0), (c0 >= 0) ? 2*p0.size() : 2*p0.size()+1,0,st(c0,p0,u0), false,ipl0), c(c0), p(p0), u(u0), l(st(c,p,u)/2), o(o0) { - if ((o0 == Gecode::Int::Limits::min) && (c0 == -1)) - tags(TestTag::normal); testsearch = false; testfix = false; contest = CTL_NONE; @@ -399,16 +398,16 @@ namespace Test { namespace Int { const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) - : Test(TestTag::sweep,"Cumulative::Opt::Flex::"+str(o0)+"::"+ + : Test((o0 == Gecode::Int::Limits::min) && (c0 == 4) && + (minP == 0) && (maxP == 2) + ? TestTags(TestTag::normal) : TestTags(TestTag::sweep), + "Cumulative::Opt::Flex::"+str(o0)+"::"+ str(c0)+"::"+str(minP)+"::"+str(maxP)+"::"+str(u0)+ "::"+str(ipl0), (c0 >= 0) ? 3*u0.size() : 3*u0.size()+1, 0,std::max(maxP,st(c0,maxP,u0)), false,ipl0), c(c0), _minP(minP), _maxP(maxP), u(u0), l(std::max(maxP,st(c0,maxP,u0))/2), o(o0) { - if ((o0 == Gecode::Int::Limits::min) && (c0 == 4) && - (minP == 0) && (maxP == 2)) - tags(TestTag::normal); testsearch = false; testfix = false; contest = CTL_NONE; diff --git a/test/int/distinct.cpp b/test/int/distinct.cpp index f4f8582104..182e7076fc 100755 --- a/test/int/distinct.cpp +++ b/test/int/distinct.cpp @@ -174,8 +174,8 @@ namespace Test { namespace Int { public: /// Create and register test Random(int n, int min, int max, Gecode::IntPropLevel ipl) - : Test("Distinct::Random::"+str(ipl),n,min,max,false,ipl) { - add_tags(TestTag::check); + : Test(TestTags(TestTag::normal,TestTag::check), + "Distinct::Random::"+str(ipl),n,min,max,false,ipl) { testsearch = false; } /// Create and register initial assignment diff --git a/test/int/extensional.cpp b/test/int/extensional.cpp index 1518651cd2..b695f96b5e 100755 --- a/test/int/extensional.cpp +++ b/test/int/extensional.cpp @@ -537,7 +537,7 @@ namespace Test { namespace Int { class SparseTupleSetUnary : public ::Test::Base { public: SparseTupleSetUnary(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::Unary", TestTag::sweep) {} + : ::Test::Base("Int::Extensional::TupleSet::Sparse::Unary") {} virtual bool run(void) { using namespace Gecode; @@ -589,7 +589,7 @@ namespace Test { namespace Int { class SparseTupleSetTernary : public ::Test::Base { public: SparseTupleSetTernary(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::Ternary", TestTag::sweep) {} + : ::Test::Base("Int::Extensional::TupleSet::Sparse::Ternary") {} virtual bool run(void) { using namespace Gecode; @@ -643,7 +643,7 @@ namespace Test { namespace Int { class SparseTupleSetHighArity : public ::Test::Base { public: SparseTupleSetHighArity(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::HighArity", TestTag::sweep) {} + : ::Test::Base("Int::Extensional::TupleSet::Sparse::HighArity") {} virtual bool run(void) { using namespace Gecode; @@ -705,7 +705,7 @@ namespace Test { namespace Int { class SparseTupleSetNullary : public ::Test::Base { public: SparseTupleSetNullary(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::Nullary", TestTag::sweep) {} + : ::Test::Base("Int::Extensional::TupleSet::Sparse::Nullary") {} virtual bool run(void) { using namespace Gecode; @@ -764,9 +764,9 @@ namespace Test { namespace Int { class SparseTupleSetIncrementalDelta : public ::Test::Base { public: SparseTupleSetIncrementalDelta(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::IncrementalDelta") { - add_tags(TestTag::check); - } + : ::Test::Base( + "Int::Extensional::TupleSet::Sparse::IncrementalDelta", + TestTags(TestTag::normal,TestTag::check)) {} virtual bool run(void) { using namespace Gecode; @@ -820,7 +820,7 @@ namespace Test { namespace Int { class SparseTupleSetIncrementalAssign : public ::Test::Base { public: SparseTupleSetIncrementalAssign(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::IncrementalAssign", TestTag::sweep) {} + : ::Test::Base("Int::Extensional::TupleSet::Sparse::IncrementalAssign") {} virtual bool run(void) { using namespace Gecode; @@ -866,7 +866,7 @@ namespace Test { namespace Int { class SparseTupleSetIncrementalBool : public ::Test::Base { public: SparseTupleSetIncrementalBool(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::IncrementalBool", TestTag::sweep) {} + : ::Test::Base("Int::Extensional::TupleSet::Sparse::IncrementalBool") {} virtual bool run(void) { using namespace Gecode; @@ -917,7 +917,7 @@ namespace Test { namespace Int { class SparseTupleSetDisabledFailure : public ::Test::Base { public: SparseTupleSetDisabledFailure(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::DisabledFailure", TestTag::sweep) {} + : ::Test::Base("Int::Extensional::TupleSet::Sparse::DisabledFailure") {} virtual bool run(void) { using namespace Gecode; @@ -966,7 +966,7 @@ namespace Test { namespace Int { class SparseTupleSetWideDelta : public ::Test::Base { public: SparseTupleSetWideDelta(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::WideDelta", TestTag::sweep) {} + : ::Test::Base("Int::Extensional::TupleSet::Sparse::WideDelta") {} virtual bool run(void) { using namespace Gecode; @@ -1035,7 +1035,7 @@ namespace Test { namespace Int { class SparseTupleSetNegative : public ::Test::Base { public: SparseTupleSetNegative(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::Negative", TestTag::sweep) {} + : ::Test::Base("Int::Extensional::TupleSet::Sparse::Negative") {} virtual bool run(void) { using namespace Gecode; @@ -1083,7 +1083,7 @@ namespace Test { namespace Int { class SparseTupleSetReified : public ::Test::Base { public: SparseTupleSetReified(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::Reified", TestTag::sweep) {} + : ::Test::Base("Int::Extensional::TupleSet::Sparse::Reified") {} virtual bool run(void) { using namespace Gecode; @@ -1134,7 +1134,8 @@ namespace Test { namespace Int { class TupleSetSingleRepresentation : public ::Test::Base { public: TupleSetSingleRepresentation(void) - : ::Test::Base("Int::Extensional::TupleSet::Support::SingleRepresentation", TestTag::sweep) {} + : ::Test::Base( + "Int::Extensional::TupleSet::Support::SingleRepresentation") {} virtual bool run(void) { using namespace Gecode; @@ -1203,8 +1204,7 @@ namespace Test { namespace Int { public: TupleSetSupportOffsetBoundary(void) : ::Test::Base( - "Int::Extensional::TupleSet::Support::OffsetBoundary", - TestTag::sweep) {} + "Int::Extensional::TupleSet::Support::OffsetBoundary") {} virtual bool run(void) { using Gecode::Int::Extensional::support_offsets_size; @@ -1226,8 +1226,7 @@ namespace Test { namespace Int { public: TupleSetTerminalFinalizationFailure(void) : ::Test::Base( - "Int::Extensional::TupleSet::Support::TerminalFailure", - TestTag::sweep) {} + "Int::Extensional::TupleSet::Support::TerminalFailure") {} virtual bool run(void) { using namespace Gecode; @@ -1295,8 +1294,7 @@ namespace Test { namespace Int { public: TupleSetDFARepresentation(void) : ::Test::Base( - "Int::Extensional::TupleSet::Support::DFARepresentation", - TestTag::sweep) {} + "Int::Extensional::TupleSet::Support::DFARepresentation") {} virtual bool run(void) { using namespace Gecode; @@ -1327,8 +1325,7 @@ namespace Test { namespace Int { public: TupleSetDisabledClone(void) : ::Test::Base( - "Int::Extensional::TupleSet::Support::DisabledClone", - TestTag::sweep) {} + "Int::Extensional::TupleSet::Support::DisabledClone") {} virtual bool run(void) { using namespace Gecode; @@ -1452,9 +1449,9 @@ namespace Test { namespace Int { class TupleSetAutoDefaultDispatch : public ::Test::Base { public: TupleSetAutoDefaultDispatch(void) - : ::Test::Base("Int::Extensional::TupleSet::Auto::DefaultDispatch") { - add_tags(TestTag::check); - } + : ::Test::Base( + "Int::Extensional::TupleSet::Auto::DefaultDispatch", + TestTags(TestTag::normal,TestTag::check)) {} virtual bool run(void) { using namespace Gecode; @@ -1550,7 +1547,8 @@ namespace Test { namespace Int { class DenseCompressedTupleSetWideGap : public ::Test::Base { public: DenseCompressedTupleSetWideGap(void) - : ::Test::Base("Int::Extensional::TupleSet::DenseCompressed::WideGap", TestTag::sweep) {} + : ::Test::Base( + "Int::Extensional::TupleSet::DenseCompressed::WideGap") {} virtual bool run(void) { using namespace Gecode; @@ -1662,7 +1660,8 @@ namespace Test { namespace Int { class SparseTupleSetNegativeFail : public ::Test::Base { public: SparseTupleSetNegativeFail(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::NegativeFail", TestTag::sweep) {} + : ::Test::Base( + "Int::Extensional::TupleSet::Sparse::NegativeFail") {} virtual bool run(void) { using namespace Gecode; @@ -1702,7 +1701,8 @@ namespace Test { namespace Int { class SparseTupleSetNegativePrune : public ::Test::Base { public: SparseTupleSetNegativePrune(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::NegativePrune", TestTag::sweep) {} + : ::Test::Base( + "Int::Extensional::TupleSet::Sparse::NegativePrune") {} virtual bool run(void) { using namespace Gecode; @@ -1748,7 +1748,8 @@ namespace Test { namespace Int { class SparseTupleSetReifiedModes : public ::Test::Base { public: SparseTupleSetReifiedModes(void) - : ::Test::Base("Int::Extensional::TupleSet::Sparse::ReifiedModes", TestTag::sweep) {} + : ::Test::Base( + "Int::Extensional::TupleSet::Sparse::ReifiedModes") {} virtual bool run(void) { using namespace Gecode; diff --git a/test/int/linear.cpp b/test/int/linear.cpp index 7e029a495f..6b8706b796 100755 --- a/test/int/linear.cpp +++ b/test/int/linear.cpp @@ -64,13 +64,10 @@ namespace Test { namespace Int { int c; public: /// Create and register test - IntInt(const std::string& s, const Gecode::IntSet& d, + IntInt(TestTags tags, const std::string& s, const Gecode::IntSet& d, const Gecode::IntArgs& a0, Gecode::IntRelType irt0, int c0, Gecode::IntPropLevel ipl=Gecode::IPL_BND) - : Test((s == "11") && (irt0 == Gecode::IRT_EQ) && - (ipl == Gecode::IPL_BND) && (c0 == 0) && - (a0.size() == 1) ? TestTag::normal : TestTag::sweep, - "Linear::Int::Int::"+ + : Test(tags,"Linear::Int::Int::"+ str(irt0)+"::"+str(ipl)+"::"+s+"::"+str(c0)+"::" +str(a0.size()), a0.size(),d,ipl != Gecode::IPL_DOM,ipl), @@ -164,14 +161,12 @@ namespace Test { namespace Int { /// Create and register test BoolInt(const std::string& s, const Gecode::IntArgs& a0, Gecode::IntRelType irt0, int c0) - : Test(TestTag::sweep,"Linear::Bool::Int::"+ + : Test(irt0 == Gecode::IRT_LQ + ? TestTags(TestTag::normal,TestTag::check) + : TestTags(TestTag::sweep),"Linear::Bool::Int::"+ str(irt0)+"::"+s+"::"+str(a0.size())+"::"+str(c0), a0.size(),0,1,true,Gecode::IPL_DEF), a(a0), irt(irt0), c(c0) { - if (irt0 == Gecode::IRT_LQ) { - tags(TestTag::normal); - add_tags(TestTag::check); - } testfix=false; } /// %Test whether \a x is solution @@ -281,15 +276,17 @@ namespace Test { namespace Int { IntArgs a1({0}); for (IntRelTypes irts; irts(); ++irts) { - (void) new IntInt("11",d1,a1,irts.irt(),0); + TestTags tags = irts.irt() == Gecode::IRT_EQ + ? TestTag::normal : TestTag::sweep; + (void) new IntInt(tags,"11",d1,a1,irts.irt(),0); (void) new IntVar("11",d1,a1,irts.irt()); - (void) new IntInt("21",d2,a1,irts.irt(),0); + (void) new IntInt(TestTag::sweep,"21",d2,a1,irts.irt(),0); (void) new IntVar("21",d2,a1,irts.irt()); - (void) new IntInt("31",d3,a1,irts.irt(),150000000); + (void) new IntInt(TestTag::sweep,"31",d3,a1,irts.irt(),150000000); } - (void) new IntInt("11",d1,a1,IRT_EQ,0,IPL_DOM); + (void) new IntInt(TestTag::sweep,"11",d1,a1,IRT_EQ,0,IPL_DOM); (void) new IntVar("11",d1,a1,IRT_EQ,IPL_DOM); - (void) new IntInt("21",d2,a1,IRT_EQ,0,IPL_DOM); + (void) new IntInt(TestTag::sweep,"21",d2,a1,IRT_EQ,0,IPL_DOM); (void) new IntVar("21",d2,a1,IRT_EQ,IPL_DOM); const int av2[5] = {1,1,1,1,1}; @@ -304,15 +301,15 @@ namespace Test { namespace Int { IntArgs a4(i, av4); IntArgs a5(i, av5); for (IntRelTypes irts; irts(); ++irts) { - (void) new IntInt("12",d1,a2,irts.irt(),0); - (void) new IntInt("13",d1,a3,irts.irt(),0); - (void) new IntInt("14",d1,a4,irts.irt(),0); - (void) new IntInt("15",d1,a5,irts.irt(),0); - (void) new IntInt("22",d2,a2,irts.irt(),0); - (void) new IntInt("23",d2,a3,irts.irt(),0); - (void) new IntInt("24",d2,a4,irts.irt(),0); - (void) new IntInt("25",d2,a5,irts.irt(),0); - (void) new IntInt("32",d3,a2,irts.irt(),1500000000); + (void) new IntInt(TestTag::sweep,"12",d1,a2,irts.irt(),0); + (void) new IntInt(TestTag::sweep,"13",d1,a3,irts.irt(),0); + (void) new IntInt(TestTag::sweep,"14",d1,a4,irts.irt(),0); + (void) new IntInt(TestTag::sweep,"15",d1,a5,irts.irt(),0); + (void) new IntInt(TestTag::sweep,"22",d2,a2,irts.irt(),0); + (void) new IntInt(TestTag::sweep,"23",d2,a3,irts.irt(),0); + (void) new IntInt(TestTag::sweep,"24",d2,a4,irts.irt(),0); + (void) new IntInt(TestTag::sweep,"25",d2,a5,irts.irt(),0); + (void) new IntInt(TestTag::sweep,"32",d3,a2,irts.irt(),1500000000); if (i < 5) { (void) new IntVar("12",d1,a2,irts.irt()); (void) new IntVar("13",d1,a3,irts.irt()); @@ -324,14 +321,14 @@ namespace Test { namespace Int { (void) new IntVar("25",d2,a5,irts.irt()); } } - (void) new IntInt("12",d1,a2,IRT_EQ,0,IPL_DOM); - (void) new IntInt("13",d1,a3,IRT_EQ,0,IPL_DOM); - (void) new IntInt("14",d1,a4,IRT_EQ,0,IPL_DOM); - (void) new IntInt("15",d1,a5,IRT_EQ,0,IPL_DOM); - (void) new IntInt("22",d2,a2,IRT_EQ,0,IPL_DOM); - (void) new IntInt("23",d2,a3,IRT_EQ,0,IPL_DOM); - (void) new IntInt("24",d2,a4,IRT_EQ,0,IPL_DOM); - (void) new IntInt("25",d2,a5,IRT_EQ,0,IPL_DOM); + (void) new IntInt(TestTag::sweep,"12",d1,a2,IRT_EQ,0,IPL_DOM); + (void) new IntInt(TestTag::sweep,"13",d1,a3,IRT_EQ,0,IPL_DOM); + (void) new IntInt(TestTag::sweep,"14",d1,a4,IRT_EQ,0,IPL_DOM); + (void) new IntInt(TestTag::sweep,"15",d1,a5,IRT_EQ,0,IPL_DOM); + (void) new IntInt(TestTag::sweep,"22",d2,a2,IRT_EQ,0,IPL_DOM); + (void) new IntInt(TestTag::sweep,"23",d2,a3,IRT_EQ,0,IPL_DOM); + (void) new IntInt(TestTag::sweep,"24",d2,a4,IRT_EQ,0,IPL_DOM); + (void) new IntInt(TestTag::sweep,"25",d2,a5,IRT_EQ,0,IPL_DOM); if (i < 4) { (void) new IntVar("12",d1,a2,IRT_EQ,IPL_DOM); (void) new IntVar("13",d1,a3,IRT_EQ,IPL_DOM); diff --git a/test/int/mm-lin.cpp b/test/int/mm-lin.cpp index 6b0a267187..4cbd1db91c 100755 --- a/test/int/mm-lin.cpp +++ b/test/int/mm-lin.cpp @@ -164,11 +164,9 @@ namespace Test { namespace Int { const LinInstr* lis; public: /// Create and register test - LinExprBool(const LinInstr* lis0, const std::string& s) - : Test(s == "352" ? TestTag::normal : TestTag::sweep, - "MiniModel::LinExpr::Bool::"+s,4,-3,3), lis(lis0) { - if (s == "352") - add_tags(TestTag::check); + LinExprBool(TestTags tags, const LinInstr* lis0, + const std::string& s) + : Test(tags,"MiniModel::LinExpr::Bool::"+s,4,-3,3), lis(lis0) { testfix = false; } /// %Test whether \a x is solution @@ -2198,7 +2196,10 @@ namespace Test { namespace Int { s = "0" + s; } (void) new LinExprInt(li[i],s); - (void) new LinExprBool(li[i],s); + TestTags bool_tags = (i == 352) + ? TestTags(TestTag::normal,TestTag::check) + : TestTags(TestTag::sweep); + (void) new LinExprBool(bool_tags,li[i],s); (void) new LinExprMixed(li[i],s); } IntRelTypes irts; diff --git a/test/int/no-overlap.cpp b/test/int/no-overlap.cpp index c7283c18c5..069a143ae2 100755 --- a/test/int/no-overlap.cpp +++ b/test/int/no-overlap.cpp @@ -55,10 +55,9 @@ namespace Test { namespace Int { Gecode::IntArgs h; public: /// Create and register test with maximal coordinate value \a m - Int2(int m, const Gecode::IntArgs& w0, const Gecode::IntArgs& h0) - : Test((m == 2) && (str(w0) == "[1,1,1,1]") && - (str(h0) == "[1,1,1,1]") - ? TestTag::normal : TestTag::sweep, + Int2(TestTags tags, int m, + const Gecode::IntArgs& w0, const Gecode::IntArgs& h0) + : Test(tags, "NoOverlap::Int::2::"+str(m)+"::"+str(w0)+"::"+str(h0), 2*w0.size(), 0, m-1), w(w0), h(h0) { @@ -271,12 +270,12 @@ namespace Test { namespace Int { IntArgs s4({1,1,1,1}); for (int m=2; m<3; m++) { - (void) new Int2(m, s1, s1); - (void) new Int2(m, s2, s2); - (void) new Int2(m, s3, s3); - (void) new Int2(m, s2, s3); - (void) new Int2(m, s4, s4); - (void) new Int2(m, s4, s2); + (void) new Int2(TestTag::sweep,m,s1,s1); + (void) new Int2(TestTag::sweep,m,s2,s2); + (void) new Int2(TestTag::sweep,m,s3,s3); + (void) new Int2(TestTag::sweep,m,s2,s3); + (void) new Int2(TestTag::normal,m,s4,s4); + (void) new Int2(TestTag::sweep,m,s4,s2); (void) new IntOpt2(m, s2, s3); (void) new IntOpt2(m, s4, s3); } diff --git a/test/int/nvalues.cpp b/test/int/nvalues.cpp index 76d3d54cf3..4b81a4c2b5 100644 --- a/test/int/nvalues.cpp +++ b/test/int/nvalues.cpp @@ -53,9 +53,8 @@ namespace Test { namespace Int { int m; public: /// Create and register test - IntInt(int n, int m0, Gecode::IntRelType irt0) - : Test((n == 1) && (m0 == 0) && (irt0 == Gecode::IRT_EQ) - ? TestTag::normal : TestTag::sweep, + IntInt(TestTags tags, int n, int m0, Gecode::IntRelType irt0) + : Test(tags, "NValues::Int::Int::"+str(irt0)+"::"+str(n)+"::"+str(m0), n,0,n), irt(irt0), m(m0) { @@ -98,8 +97,8 @@ namespace Test { namespace Int { Gecode::IntRelType irt; public: /// Create and register test - IntVar(int n, Gecode::IntRelType irt0) - : Test(TestTag::sweep, + IntVar(TestTags tags, int n, Gecode::IntRelType irt0) + : Test(tags, "NValues::Int::Var::"+str(irt0)+"::"+str(n),n+1,0,n), irt(irt0) { testfix = false; @@ -221,10 +220,18 @@ namespace Test { namespace Int { (void) new BoolVar(i, irts.irt()); } for (int i=1; i<=7; i += 2) { - for (int m=0; m<=i+1; m++) - (void) new IntInt(i, m, irts.irt()); - if (i <= 5) - (void) new IntVar(i, irts.irt()); + for (int m=0; m<=i+1; m++) { + TestTags tags = ((i == 3) && (m == 2) && + (irts.irt() == Gecode::IRT_EQ)) + ? TestTag::normal : TestTag::sweep; + (void) new IntInt(tags,i,m,irts.irt()); + } + if (i <= 5) { + TestTags tags = ((i == 3) && + (irts.irt() == Gecode::IRT_EQ)) + ? TestTag::normal : TestTag::sweep; + (void) new IntVar(tags,i,irts.irt()); + } } } } diff --git a/test/int/unary.cpp b/test/int/unary.cpp index 944dd9d105..2cbc925815 100755 --- a/test/int/unary.cpp +++ b/test/int/unary.cpp @@ -61,14 +61,11 @@ namespace Test { namespace Int { namespace Unary { } public: /// Create and register test - ManFixPUnary(const Gecode::IntArgs& p0, int o, Gecode::IntPropLevel ipl0) - : Test(TestTag::sweep,"Unary::Man::Fix::"+str(o)+"::"+str(p0)+"::"+str(ipl0), + ManFixPUnary(TestTags tags, const Gecode::IntArgs& p0, + int o, Gecode::IntPropLevel ipl0) + : Test(tags,"Unary::Man::Fix::"+str(o)+"::"+str(p0)+"::"+str(ipl0), p0.size(),o,o+st(p0),false,ipl0), p(p0) { - if ((o == Gecode::Int::Limits::min) && - (str(p0) == "[2,2,0,2,2]") && - (ipl0 == Gecode::IPL_ADVANCED)) - tags(TestTag::normal); testsearch = false; contest = CTL_NONE; } @@ -106,13 +103,10 @@ namespace Test { namespace Int { namespace Unary { } public: /// Create and register test - OptFixPUnary(const Gecode::IntArgs& p0, int o, Gecode::IntPropLevel ipl0) - : Test(TestTag::sweep,"Unary::Opt::Fix::"+str(o)+"::"+str(p0)+"::"+str(ipl0), + OptFixPUnary(TestTags tags, const Gecode::IntArgs& p0, + int o, Gecode::IntPropLevel ipl0) + : Test(tags,"Unary::Opt::Fix::"+str(o)+"::"+str(p0)+"::"+str(ipl0), 2*p0.size(),o,o+st(p0),false,ipl0), p(p0), l(o+st(p)/2) { - if ((o == Gecode::Int::Limits::min) && - (str(p0) == "[2,2,0,2,2]") && - (ipl0 == Gecode::IPL_ADVANCED)) - tags(TestTag::normal); testsearch = false; contest = CTL_NONE; } @@ -155,13 +149,11 @@ namespace Test { namespace Int { namespace Unary { int off; public: /// Create and register test - ManFlexUnary(int n, int minP, int maxP, int o, Gecode::IntPropLevel ipl0) - : Test(TestTag::sweep,"Unary::Man::Flex::"+str(o)+"::"+str(n)+"::" + ManFlexUnary(TestTags tags, int n, int minP, int maxP, + int o, Gecode::IntPropLevel ipl0) + : Test(tags,"Unary::Man::Flex::"+str(o)+"::"+str(n)+"::" +str(minP)+"::"+str(maxP)+"::"+str(ipl0), 2*n,0,n*maxP,false,ipl0), _minP(minP), _maxP(maxP), off(o) { - if ((o == Gecode::Int::Limits::min) && (n == 4) && - (minP == 0) && (maxP == 2) && (ipl0 == Gecode::IPL_ADVANCED)) - tags(TestTag::normal); testsearch = false; testfix = false; contest = CTL_NONE; @@ -217,14 +209,12 @@ namespace Test { namespace Int { namespace Unary { } public: /// Create and register test - OptFlexUnary(int n, int minP, int maxP, int o, Gecode::IntPropLevel ipl0) - : Test(TestTag::sweep,"Unary::Opt::Flex::"+str(o)+"::"+str(n)+"::" + OptFlexUnary(TestTags tags, int n, int minP, int maxP, + int o, Gecode::IntPropLevel ipl0) + : Test(tags,"Unary::Opt::Flex::"+str(o)+"::"+str(n)+"::" +str(minP)+"::"+str(maxP)+"::"+str(ipl0), 3*n,0,n*maxP,false,ipl0), _minP(minP), _maxP(maxP), off(o), l(n*maxP/2) { - if ((o == Gecode::Int::Limits::min) && (n == 4) && - (minP == 0) && (maxP == 2) && (ipl0 == Gecode::IPL_ADVANCED)) - tags(TestTag::normal); testsearch = false; testfix = false; contest = CTL_NONE; @@ -282,61 +272,63 @@ namespace Test { namespace Int { namespace Unary { IntArgs p30({4,0,2,9,3,7,5,0}); for (IntPropBasicAdvanced ipba; ipba(); ++ipba) { - (void) new ManFixPUnary(p1,0,ipba.ipl()); - (void) new ManFixPUnary(p1,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFixPUnary(p1,0,ipba.ipl()); - (void) new OptFixPUnary(p1,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFlexUnary(4,0,2,0,ipba.ipl()); - (void) new ManFlexUnary(4,0,2,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFlexUnary(4,1,3,0,ipba.ipl()); - (void) new ManFlexUnary(4,1,3,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFlexUnary(4,0,2,0,ipba.ipl()); - (void) new OptFlexUnary(4,0,2,Gecode::Int::Limits::min,ipba.ipl()); + TestTags representative = ipba.ipl() == Gecode::IPL_ADVANCED + ? TestTag::normal : TestTag::sweep; + (void) new ManFixPUnary(TestTag::sweep,p1,0,ipba.ipl()); + (void) new ManFixPUnary(TestTag::sweep,p1,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFixPUnary(TestTag::sweep,p1,0,ipba.ipl()); + (void) new OptFixPUnary(TestTag::sweep,p1,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,4,0,2,0,ipba.ipl()); + (void) new ManFlexUnary(representative,4,0,2,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,4,1,3,0,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,4,1,3,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFlexUnary(TestTag::sweep,4,0,2,0,ipba.ipl()); + (void) new OptFlexUnary(representative,4,0,2,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFixPUnary(p10,0,ipba.ipl()); - (void) new ManFixPUnary(p10,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFixPUnary(p10,0,ipba.ipl()); - (void) new OptFixPUnary(p10,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFlexUnary(5,0,2,0,ipba.ipl()); - (void) new ManFlexUnary(5,0,2,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFlexUnary(5,0,2,0,ipba.ipl()); - (void) new OptFlexUnary(5,0,2,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFixPUnary(TestTag::sweep,p10,0,ipba.ipl()); + (void) new ManFixPUnary(representative,p10,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFixPUnary(TestTag::sweep,p10,0,ipba.ipl()); + (void) new OptFixPUnary(representative,p10,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,5,0,2,0,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,5,0,2,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFlexUnary(TestTag::sweep,5,0,2,0,ipba.ipl()); + (void) new OptFlexUnary(TestTag::sweep,5,0,2,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFixPUnary(p2,0,ipba.ipl()); - (void) new ManFixPUnary(p2,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFixPUnary(p2,0,ipba.ipl()); - (void) new OptFixPUnary(p2,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFlexUnary(4,3,5,0,ipba.ipl()); - (void) new ManFlexUnary(4,3,5,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFlexUnary(4,3,5,0,ipba.ipl()); - (void) new OptFlexUnary(4,3,5,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFixPUnary(TestTag::sweep,p2,0,ipba.ipl()); + (void) new ManFixPUnary(TestTag::sweep,p2,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFixPUnary(TestTag::sweep,p2,0,ipba.ipl()); + (void) new OptFixPUnary(TestTag::sweep,p2,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,4,3,5,0,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,4,3,5,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFlexUnary(TestTag::sweep,4,3,5,0,ipba.ipl()); + (void) new OptFlexUnary(TestTag::sweep,4,3,5,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFixPUnary(p20,0,ipba.ipl()); - (void) new ManFixPUnary(p20,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFixPUnary(p20,0,ipba.ipl()); - (void) new OptFixPUnary(p20,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFlexUnary(6,0,5,0,ipba.ipl()); - (void) new ManFlexUnary(6,0,5,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFlexUnary(6,0,5,0,ipba.ipl()); - (void) new OptFlexUnary(6,0,5,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFixPUnary(TestTag::sweep,p20,0,ipba.ipl()); + (void) new ManFixPUnary(TestTag::sweep,p20,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFixPUnary(TestTag::sweep,p20,0,ipba.ipl()); + (void) new OptFixPUnary(TestTag::sweep,p20,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,6,0,5,0,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,6,0,5,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFlexUnary(TestTag::sweep,6,0,5,0,ipba.ipl()); + (void) new OptFlexUnary(TestTag::sweep,6,0,5,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFixPUnary(p3,0,ipba.ipl()); - (void) new ManFixPUnary(p3,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFixPUnary(p3,0,ipba.ipl()); - (void) new OptFixPUnary(p3,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFlexUnary(6,2,7,0,ipba.ipl()); - (void) new ManFlexUnary(6,2,7,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFlexUnary(6,2,7,0,ipba.ipl()); - (void) new OptFlexUnary(6,2,7,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFixPUnary(TestTag::sweep,p3,0,ipba.ipl()); + (void) new ManFixPUnary(TestTag::sweep,p3,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFixPUnary(TestTag::sweep,p3,0,ipba.ipl()); + (void) new OptFixPUnary(TestTag::sweep,p3,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,6,2,7,0,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,6,2,7,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFlexUnary(TestTag::sweep,6,2,7,0,ipba.ipl()); + (void) new OptFlexUnary(TestTag::sweep,6,2,7,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFixPUnary(p30,0,ipba.ipl()); - (void) new ManFixPUnary(p30,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFixPUnary(p30,0,ipba.ipl()); - (void) new OptFixPUnary(p30,Gecode::Int::Limits::min,ipba.ipl()); - (void) new ManFlexUnary(8,0,9,0,ipba.ipl()); - (void) new ManFlexUnary(8,0,9,Gecode::Int::Limits::min,ipba.ipl()); - (void) new OptFlexUnary(8,0,9,0,ipba.ipl()); - (void) new OptFlexUnary(8,0,9,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFixPUnary(TestTag::sweep,p30,0,ipba.ipl()); + (void) new ManFixPUnary(TestTag::sweep,p30,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFixPUnary(TestTag::sweep,p30,0,ipba.ipl()); + (void) new OptFixPUnary(TestTag::sweep,p30,Gecode::Int::Limits::min,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,8,0,9,0,ipba.ipl()); + (void) new ManFlexUnary(TestTag::sweep,8,0,9,Gecode::Int::Limits::min,ipba.ipl()); + (void) new OptFlexUnary(TestTag::sweep,8,0,9,0,ipba.ipl()); + (void) new OptFlexUnary(TestTag::sweep,8,0,9,Gecode::Int::Limits::min,ipba.ipl()); } } }; diff --git a/test/nogoods.cpp b/test/nogoods.cpp index 14c52f5984..80baab57ab 100644 --- a/test/nogoods.cpp +++ b/test/nogoods.cpp @@ -221,13 +221,11 @@ namespace Test { return s.str(); } /// Initialize test - NoGoods(ValBranch vb0, unsigned int t0, bool a0, bool n0) + NoGoods(TestTags tags, ValBranch vb0, + unsigned int t0, bool a0, bool n0) : Base("NoGoods::"+Model::name()+"::"+Model::val(vb0)+"::"+str(t0)+ - "::"+(a0 ? "+" : "-")+"::"+(n0 ? "+" : "-")), - vb(vb0), t(t0), a(a0), n(n0) { - if (Model::name() == "Queens") - add_tags(TestTag::check); - } + "::"+(a0 ? "+" : "-")+"::"+(n0 ? "+" : "-"),tags), + vb(vb0), t(t0), a(a0), n(n0) {} /// Run test virtual bool run(void) { Model* m = new Model(vb,a,n); @@ -277,17 +275,18 @@ namespace Test { bool n = false; do { for (unsigned int t = 1; t<=4; t++) { - (void) new NoGoods(INT_VAL_MIN(),t,a,n); - (void) new NoGoods(INT_VAL_MAX(),t,a,n); - (void) new NoGoods(INT_VAL_SPLIT_MIN(),t,a,n); - (void) new NoGoods(INT_VAL_SPLIT_MAX(),t,a,n); - (void) new NoGoods(INT_VALUES_MIN(),t,a,n); - (void) new NoGoods(INT_VALUES_MAX(),t,a,n); + TestTags queens(TestTag::normal,TestTag::check); + (void) new NoGoods(queens,INT_VAL_MIN(),t,a,n); + (void) new NoGoods(queens,INT_VAL_MAX(),t,a,n); + (void) new NoGoods(queens,INT_VAL_SPLIT_MIN(),t,a,n); + (void) new NoGoods(queens,INT_VAL_SPLIT_MAX(),t,a,n); + (void) new NoGoods(queens,INT_VALUES_MIN(),t,a,n); + (void) new NoGoods(queens,INT_VALUES_MAX(),t,a,n); #ifdef GECODE_HAS_SET_VARS - (void) new NoGoods(SET_VAL_MIN_INC(),t,a,n); - (void) new NoGoods(SET_VAL_MIN_EXC(),t,a,n); - (void) new NoGoods(SET_VAL_MAX_INC(),t,a,n); - (void) new NoGoods(SET_VAL_MAX_EXC(),t,a,n); + (void) new NoGoods(TestTag::normal,SET_VAL_MIN_INC(),t,a,n); + (void) new NoGoods(TestTag::normal,SET_VAL_MIN_EXC(),t,a,n); + (void) new NoGoods(TestTag::normal,SET_VAL_MAX_INC(),t,a,n); + (void) new NoGoods(TestTag::normal,SET_VAL_MAX_EXC(),t,a,n); #endif } n = !n; diff --git a/test/search.cpp b/test/search.cpp index e710644309..93a1cf20f5 100644 --- a/test/search.cpp +++ b/test/search.cpp @@ -374,11 +374,16 @@ namespace Test { return ""; } /// Initialize test - Test(const std::string& s, + Test(TestTags tags, const std::string& s, HowToBranch _htb1, HowToBranch _htb2, HowToBranch _htb3, HowToConstrain _htc=HTC_NONE) - : Base("Search::"+s), + : Base("Search::"+s,tags), htb1(_htb1), htb2(_htb2), htb3(_htb3), htc(_htc) {} + /// Initialize a normal test + Test(const std::string& s, + HowToBranch _htb1, HowToBranch _htb2, HowToBranch _htb3, + HowToConstrain _htc=HTC_NONE) + : Test(TestTag::normal,s,_htb1,_htb2,_htb3,_htc) {} }; /// %Test for depth-first search @@ -393,22 +398,13 @@ namespace Test { unsigned int t; public: /// Initialize test - DFS(HowToBranch htb1, HowToBranch htb2, HowToBranch htb3, + DFS(TestTags tags, + HowToBranch htb1, HowToBranch htb2, HowToBranch htb3, unsigned int c_d0, unsigned int a_d0, unsigned int t0) - : Test("DFS::"+Model::name()+"::"+ + : Test(tags,"DFS::"+Model::name()+"::"+ str(htb1)+"::"+str(htb2)+"::"+str(htb3)+"::"+ str(c_d0)+"::"+str(a_d0)+"::"+str(t0), - htb1,htb2,htb3), c_d(c_d0), a_d(a_d0), t(t0) { - if (Model::name().compare(0,3,"Sol") == 0) - tags(TestTag::sweep); - if ((Model::name() == "Sol") && - (htb1 == HTB_BINARY) && (htb2 == HTB_NARY) && - (htb3 == HTB_BINARY) && (c_d0 == 1) && - (a_d0 == 1) && (t0 == 1)) { - tags(TestTag::normal); - add_tags(TestTag::check); - } - } + htb1,htb2,htb3), c_d(c_d0), a_d(a_d0), t(t0) {} /// Run test virtual bool run(void) { Model* m = new Model(htb1,htb2,htb3); @@ -483,21 +479,13 @@ namespace Test { unsigned int t; public: /// Initialize test - BAB(HowToConstrain htc, + BAB(TestTags tags, HowToConstrain htc, HowToBranch htb1, HowToBranch htb2, HowToBranch htb3, unsigned int c_d0, unsigned int a_d0, unsigned int t0) - : Test("BAB::"+Model::name()+"::"+str(htc)+"::"+ + : Test(tags,"BAB::"+Model::name()+"::"+str(htc)+"::"+ str(htb1)+"::"+str(htb2)+"::"+str(htb3)+"::"+ str(c_d0)+"::"+str(a_d0)+"::"+str(t0), - htb1,htb2,htb3,htc), c_d(c_d0), a_d(a_d0), t(t0) { - if (Model::name().compare(0,3,"Sol") == 0) - tags(TestTag::sweep); - if ((Model::name() == "Sol") && (htc == HTC_BAL_GR) && - (htb1 == HTB_BINARY) && (htb2 == HTB_BINARY) && - (htb3 == HTB_BINARY) && (c_d0 == 1) && - (a_d0 == 1) && (t0 == 1)) - tags(TestTag::normal); - } + htb1,htb2,htb3,htc), c_d(c_d0), a_d(a_d0), t(t0) {} /// Run test virtual bool run(void) { Model* m = new Model(htb1,htb2,htb3,htc); @@ -759,12 +747,21 @@ namespace Test { for (BranchTypes htb2; htb2(); ++htb2) for (BranchTypes htb3; htb3(); ++htb3) (void) new DFS - (htb1.htb(),htb2.htb(),htb3.htb(),c_d, a_d, t); - new DFS(HTB_NONE, HTB_NONE, HTB_NONE, + ((htb1.htb() == HTB_BINARY) && + (htb2.htb() == HTB_NARY) && + (htb3.htb() == HTB_BINARY) && + (c_d == 1) && (a_d == 1) && (t == 1) + ? TestTags(TestTag::normal,TestTag::check) + : TestTags(TestTag::sweep), + htb1.htb(),htb2.htb(),htb3.htb(),c_d,a_d,t); + new DFS(TestTag::normal, + HTB_NONE, HTB_NONE, HTB_NONE, c_d, a_d, t); - new DFS(HTB_NONE, HTB_NONE, HTB_NONE, + new DFS(TestTag::sweep, + HTB_NONE, HTB_NONE, HTB_NONE, c_d, a_d, t); - new DFS(HTB_NONE, HTB_NONE, HTB_NONE, + new DFS(TestTag::sweep, + HTB_NONE, HTB_NONE, HTB_NONE, c_d, a_d, t); } @@ -788,15 +785,25 @@ namespace Test { for (BranchTypes htb2; htb2(); ++htb2) for (BranchTypes htb3; htb3(); ++htb3) { (void) new BAB - (htc.htc(),htb1.htb(),htb2.htb(),htb3.htb(), + ((htc.htc() == HTC_BAL_GR) && + (htb1.htb() == HTB_BINARY) && + (htb2.htb() == HTB_BINARY) && + (htb3.htb() == HTB_BINARY) && + (c_d == 1) && (a_d == 1) && (t == 1) + ? TestTags(TestTag::normal) + : TestTags(TestTag::sweep), + htc.htc(),htb1.htb(),htb2.htb(),htb3.htb(), c_d,a_d,t); } (void) new BAB - (HTC_NONE,HTB_NONE,HTB_NONE,HTB_NONE,c_d,a_d,t); + (TestTag::normal,HTC_NONE,HTB_NONE,HTB_NONE,HTB_NONE, + c_d,a_d,t); (void) new BAB - (HTC_NONE,HTB_NONE,HTB_NONE,HTB_NONE,c_d,a_d,t); + (TestTag::sweep,HTC_NONE,HTB_NONE,HTB_NONE,HTB_NONE, + c_d,a_d,t); (void) new BAB - (HTC_NONE,HTB_NONE,HTB_NONE,HTB_NONE,c_d,a_d,t); + (TestTag::sweep,HTC_NONE,HTB_NONE,HTB_NONE,HTB_NONE, + c_d,a_d,t); } // Restart-based search for (unsigned int t=1; t<=4; t++) { diff --git a/test/set/channel.cpp b/test/set/channel.cpp index cd4f32727a..1ea3f0ed4c 100644 --- a/test/set/channel.cpp +++ b/test/set/channel.cpp @@ -137,10 +137,9 @@ namespace Test { namespace Set { int isize; public: /// Create and register test - ChannelBool(const char* t, const IntSet& d, int _isize) - : SetTest(std::string(t) == "Channel::Bool::1" - ? TestTag::normal : TestTag::sweep, - t,1,d,false,_isize), isize(_isize) {} + ChannelBool(TestTags tags, const char* t, + const IntSet& d, int _isize) + : SetTest(tags,t,1,d,false,_isize), isize(_isize) {} /// %Test whether \a x is solution virtual bool solution(const SetAssignment& x) const { for (int i=0; i