diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cfa8516ad..cb460c83fa 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 -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) @@ -1573,16 +1516,6 @@ if(BUILD_TESTING) 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 @@ -1595,11 +1528,35 @@ 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) + 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} DEPENDS ${GECODE_CHECK_DEPENDS} USES_TERMINAL) + 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) endif() if(GECODE_ENABLE_FAULT_INJECTION) set(GECODE_FAULT_CHECK_ARGS -iter 1 -threads 1 -test "^Fault::") @@ -1617,10 +1574,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..7d7fa154f9 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 -fixprob 1 -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: 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/docs/cmake-build.md b/docs/cmake-build.md index b5d5786bd9..4c49a8ecd3 100644 --- a/docs/cmake-build.md +++ b/docs/cmake-build.md @@ -72,6 +72,43 @@ 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 +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. Listing always shows +all registered tests, regardless of selection filters. + ## Build Conventions and Key Options ### Common CMake options diff --git a/docs/public-test-harness.md b/docs/public-test-harness.md index 6798ed27c2..9dd5241231 100644 --- a/docs/public-test-harness.md +++ b/docs/public-test-harness.md @@ -154,6 +154,38 @@ 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. Any other membership is assigned explicitly when the test is constructed: + +```c++ +ConsumerSmoke() + : Test::Base("Package::ConsumerSmoke", Test::TestTag::sweep) {} +``` + +The runner recognizes the `check`, `normal`, and `sweep` tags. Repeating +`-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. 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. + ## Run and reproduce tests List the registered tests: 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 2ec3d914bb..de3494bc8f 100644 --- a/test/branch/set.cpp +++ b/test/branch/set.cpp @@ -41,8 +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) {} + 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); @@ -57,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 b7c1873b0b..ee98085d94 100755 --- a/test/flatzinc.cpp +++ b/test/flatzinc.cpp @@ -81,7 +81,8 @@ namespace Test { namespace FlatZinc { } public: GistStatisticsMode(void) - : Base("FlatZinc::Options::GistStatisticsMode") {} + : Base("FlatZinc::Options::GistStatisticsMode", + TestTags(TestTag::normal,TestTag::check)) {} virtual bool run(void) { return @@ -96,6 +97,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 +110,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 +127,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..8cad3592ee 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", + TestTags(TestTag::normal,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..21c99a7f26 100755 --- a/test/float/arithmetic.cpp +++ b/test/float/arithmetic.cpp @@ -134,7 +134,8 @@ namespace Test { namespace Float { public: /// Create and register test PositiveNRootBounds(void) - : Base("Float::Arithmetic::PositiveNRootBounds") {} + : 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(); @@ -364,7 +365,9 @@ namespace Test { namespace Float { } public: /// Create and register test - PowConsistency(void) : Base("Float::Arithmetic::PowConsistency") {} + PowConsistency(void) + : Base("Float::Arithmetic::PowConsistency", + TestTags(TestTag::normal,TestTag::check)) {} /// Run zero and fixpoint regressions virtual bool run(void) { bool result = true; @@ -486,7 +489,8 @@ namespace Test { namespace Float { public: /// Create and register test MultZeroEndpoint(void) - : Base("Float::Arithmetic::MultZeroEndpoint") {} + : 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; @@ -525,7 +529,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]); @@ -543,8 +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("Arithmetic::Mult::XYZ::Sol::"+s,3,d,st,EXTEND_ASSIGNMENT,false) {} + 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]); @@ -570,7 +576,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 +592,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 +618,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 +634,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 +650,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]); @@ -659,8 +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("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]); @@ -679,7 +687,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 +713,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 +732,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]); @@ -749,8 +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("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]); @@ -766,7 +776,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 +800,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)) { @@ -820,8 +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("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)) { @@ -843,7 +855,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]); @@ -862,8 +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("Arithmetic::Pow::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) {} + 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]); @@ -890,7 +905,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 +922,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)) @@ -928,8 +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("Arithmetic::NRoot::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) {} + 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)) @@ -960,7 +978,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 +996,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]); @@ -996,8 +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("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]); @@ -1013,7 +1033,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 +1052,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 +1068,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 +1084,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]); @@ -1079,8 +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("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]); @@ -1096,7 +1118,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 +1137,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 +1153,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 +1169,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]); @@ -1162,8 +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("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]); @@ -1179,7 +1203,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 +1224,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 +1242,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 +1263,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]); @@ -1281,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); @@ -1301,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); @@ -1313,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); @@ -1333,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); @@ -1345,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); @@ -1357,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); @@ -1369,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); @@ -1381,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); @@ -1393,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); @@ -1413,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); @@ -1433,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 a20cc39276..1796f1e6f6 100644 --- a/test/float/linear.cpp +++ b/test/float/linear.cpp @@ -66,10 +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("Linear::Float::"+ + : Test(tags,"Linear::Float::"+ str(frt0)+"::"+s+"::"+str(c0)+"::" +str(a0.size()), a0.size(),d,st,CPLT_ASSIGNMENT,true), @@ -128,9 +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("Linear::Var::"+ + : Test(tags,"Linear::Var::"+ str(frt0)+"::"+s+"::"+str(a0.size()), a0.size()+1,d,st,CPLT_ASSIGNMENT,true), a(a0), frt(frt0) { @@ -203,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}; @@ -221,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 1007b9826e..29857890dc 100644 --- a/test/float/mm-lin.cpp +++ b/test/float/mm-lin.cpp @@ -98,8 +98,8 @@ namespace Test { namespace Float { const LinInstr* lis; public: /// Create and register test - LinExpr(const LinInstr* lis0, const std::string& s) - : Test("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; } @@ -1874,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)) @@ -255,7 +261,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)) @@ -284,8 +290,10 @@ namespace Test { namespace Float { class ASinXX : public Test { 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) {} + ASinXX(TestTags tags, const std::string& s, + const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags,"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 +311,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 +332,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)) @@ -353,8 +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("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)) @@ -372,7 +382,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 +401,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]); @@ -416,8 +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("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]); @@ -442,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); @@ -454,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); @@ -466,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); @@ -478,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); @@ -490,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); @@ -502,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.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..3b48f4ac69 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 { @@ -261,9 +262,11 @@ 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("Arithmetic::Pow::XX::"+str(n0)+"::"+str(ipl)+"::"+s, + : Test(tags, + "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 { @@ -375,9 +379,11 @@ 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("Arithmetic::Nroot::XX::"+str(n0)+"::"+str(ipl)+"::"+s, + : Test(tags, + "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,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) {} + : 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]); @@ -489,7 +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) {} + : 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]); @@ -715,7 +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) {} + : 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]; @@ -733,7 +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) {} + : 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]; @@ -756,7 +767,8 @@ 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) {} @@ -790,7 +802,8 @@ 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) { testfix=false; @@ -904,7 +917,8 @@ 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) {} @@ -943,7 +957,8 @@ 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) { testfix=false; @@ -1142,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++) { @@ -1154,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 0a72f258ca..abb7b9e6c2 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 @@ -168,8 +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("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 { @@ -218,13 +219,12 @@ 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); //@} } }} // 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..fa606fbb50 100755 --- a/test/int/cumulative.cpp +++ b/test/int/cumulative.cpp @@ -71,7 +71,10 @@ namespace Test { namespace Int { const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) - : Test("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) { @@ -174,7 +177,9 @@ namespace Test { namespace Int { const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) - : Test("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), @@ -280,7 +285,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,7 +398,10 @@ namespace Test { namespace Int { const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) - : Test("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, diff --git a/test/int/distinct.cpp b/test/int/distinct.cpp index c652f739b7..182e7076fc 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..2cbc925815 100755 --- a/test/int/unary.cpp +++ b/test/int/unary.cpp @@ -61,8 +61,9 @@ 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), + 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) { testsearch = false; @@ -102,8 +103,9 @@ 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), + 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) { testsearch = false; contest = CTL_NONE; @@ -147,8 +149,9 @@ 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("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) { testsearch = false; @@ -206,8 +209,9 @@ 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)+"::" + 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) { @@ -268,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 dfcb7b35e8..80baab57ab 100644 --- a/test/nogoods.cpp +++ b/test/nogoods.cpp @@ -221,9 +221,10 @@ 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 ? "+" : "-")), + "::"+(a0 ? "+" : "-")+"::"+(n0 ? "+" : "-"),tags), vb(vb0), t(t0), a(a0), n(n0) {} /// Run test virtual bool run(void) { @@ -274,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/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..ea512eb510 100644 --- a/test/public-runner-smoke.cpp +++ b/test/public-runner-smoke.cpp @@ -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++; @@ -120,6 +120,38 @@ 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"}, pass_output) == EXIT_SUCCESS, @@ -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/search.cpp b/test/search.cpp index 48e0bdfdcb..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,9 +398,10 @@ 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) {} @@ -473,10 +479,10 @@ 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) {} @@ -741,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); } @@ -770,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.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..1ea3f0ed4c 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..a411565828 100644 --- a/test/set/exec.cpp +++ b/test/set/exec.cpp @@ -51,7 +51,8 @@ namespace Test { namespace Set { public: /// Create and register test Wait(int n, bool sf0) - : SetTest("Wait::"+str(n)+"::"+ + : SetTest(TestTags(TestTag::normal,TestTag::check), + "Wait::"+str(n)+"::"+ (sf0 ? "std::function" : "funptr"),n, Gecode::IntSet(0,n),false), sf(sf0) {} /// Check whether \a x is solution diff --git a/test/set/mm-set.cpp b/test/set/mm-set.cpp index 6c7d83f7da..49c5e4a7ff 100755 --- a/test/set/mm-set.cpp +++ b/test/set/mm-set.cpp @@ -124,9 +124,10 @@ namespace Test { namespace Int { Gecode::SetRelType srt; public: /// 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), + SetExprConst(TestTags tags, const SetInstr* bis0, + const std::string& s, Gecode::SetRelType srt0, int c0) + : Test(tags, + "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 @@ -210,9 +211,11 @@ namespace Test { namespace Int { Gecode::SetRelType srt; public: /// 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), + SetExprExpr(TestTags tags, const SetInstr* bis00, + const SetInstr* bis10, const std::string& s, + Gecode::SetRelType srt0) + : Test(tags, + "MiniModel::SetExpr::Expr::"+s+"::"+str(srt0), 8,0,1, simpleReifiedSemantics(bis00) && simpleReifiedSemantics(bis10)), @@ -4502,16 +4505,18 @@ namespace Test { namespace Int { } else if (i < 100) { s = "0" + s; } - (void) new SetExprConst(si[i],s,Gecode::SRT_EQ,0); - (void) new SetExprConst(si[i],s,Gecode::SRT_EQ,1); - (void) new SetExprConst(si[i],s,Gecode::SRT_NQ,0); - (void) new SetExprConst(si[i],s,Gecode::SRT_NQ,1); - (void) new SetExprConst(si[i],s,Gecode::SRT_SUB,0); - (void) new SetExprConst(si[i],s,Gecode::SRT_SUB,1); - (void) new SetExprConst(si[i],s,Gecode::SRT_SUP,0); - (void) new SetExprConst(si[i],s,Gecode::SRT_SUP,1); - (void) new SetExprConst(si[i],s,Gecode::SRT_DISJ,0); - (void) new SetExprConst(si[i],s,Gecode::SRT_DISJ,1); + TestTags eq_zero_tags = i == 0 + ? TestTags(TestTag::normal) : TestTags(TestTag::sweep); + (void) new SetExprConst(eq_zero_tags,si[i],s,Gecode::SRT_EQ,0); + (void) new SetExprConst(TestTag::sweep,si[i],s,Gecode::SRT_EQ,1); + (void) new SetExprConst(TestTag::sweep,si[i],s,Gecode::SRT_NQ,0); + (void) new SetExprConst(TestTag::sweep,si[i],s,Gecode::SRT_NQ,1); + (void) new SetExprConst(TestTag::sweep,si[i],s,Gecode::SRT_SUB,0); + (void) new SetExprConst(TestTag::sweep,si[i],s,Gecode::SRT_SUB,1); + (void) new SetExprConst(TestTag::sweep,si[i],s,Gecode::SRT_SUP,0); + (void) new SetExprConst(TestTag::sweep,si[i],s,Gecode::SRT_SUP,1); + (void) new SetExprConst(TestTag::sweep,si[i],s,Gecode::SRT_DISJ,0); + (void) new SetExprConst(TestTag::sweep,si[i],s,Gecode::SRT_DISJ,1); if ( (i % 31) == 0) { @@ -4524,11 +4529,18 @@ namespace Test { namespace Int { ss = "0" + ss; } ss=s+"::"+ss; - (void) new SetExprExpr(si[i],si[j],ss,Gecode::SRT_EQ); - (void) new SetExprExpr(si[i],si[j],ss,Gecode::SRT_NQ); - (void) new SetExprExpr(si[i],si[j],ss,Gecode::SRT_SUB); - (void) new SetExprExpr(si[i],si[j],ss,Gecode::SRT_SUP); - (void) new SetExprExpr(si[i],si[j],ss,Gecode::SRT_DISJ); + TestTags eq_tags = (i == 0) && (j == 0) + ? TestTags(TestTag::normal) : TestTags(TestTag::sweep); + (void) new SetExprExpr(eq_tags,si[i],si[j],ss, + Gecode::SRT_EQ); + (void) new SetExprExpr(TestTag::sweep,si[i],si[j],ss, + Gecode::SRT_NQ); + (void) new SetExprExpr(TestTag::sweep,si[i],si[j],ss, + Gecode::SRT_SUB); + (void) new SetExprExpr(TestTag::sweep,si[i],si[j],ss, + Gecode::SRT_SUP); + (void) new SetExprExpr(TestTag::sweep,si[i],si[j],ss, + Gecode::SRT_DISJ); } } } diff --git a/test/set/precede.cpp b/test/set/precede.cpp index b98988e63d..74c2d498bc 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 { @@ -98,8 +98,8 @@ namespace Test { namespace Set { } public: /// Create and register test - Multi(const Gecode::IntArgs& c0) - : SetTest("Precede::Multi::"+str(c0),4,ds,false), c(c0) {} + Multi(TestTags tags, const Gecode::IntArgs& c0) + : SetTest(tags,"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 diff --git a/test/test.cpp b/test/test.cpp index 4912fa558a..85d7be0542 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -52,12 +52,80 @@ namespace Test { // Log stream std::ostringstream olog; + /// A command-line name and its corresponding test tag + struct TestTagDescription { + const char* name; + TestTag tag; + }; + + /// Tags supported by the test runner + static const TestTagDescription test_tag_descriptions[] = { + {"check", TestTag::check}, + {"normal", TestTag::normal}, + {"sweep", TestTag::sweep} + }; + + 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 (const TestTagDescription& description : test_tag_descriptions) + if (!strcmp(name, description.name)) + return TestTags(description.tag); + if (!strcmp(name, "all")) + return TestTags::all(); + return TestTags(); + } + + /// Print all tag names + static void + print_tags(std::ostream& os) { + 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 (const TestTagDescription& description : test_tag_descriptions) { + if (tags.overlaps(TestTags(description.tag))) { + if (!s.empty()) + s += ","; + s += description.name; + } + } + 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, TestTag::normal) {} + + Base::Base(std::string s, TestTags t) + : _name(std::move(s)), _tags(t), _next(_tests), _rand(Gecode::Support::RandomGenerator()) { _tests = this; _n_tests++; } @@ -130,6 +198,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 (" << tag_choices() << ") 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 +217,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 +252,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; + 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.add(tag); + use_testtags = true; } else if (!strcmp(argv[i],"-start")) { if (++i == argc) goto missing; start_from = argv[i]; @@ -190,6 +276,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 +336,10 @@ namespace Test { } } + 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 bool run_test(Base* test, unsigned int test_seed, const Options& options, std::ostream& ostream) { try { @@ -464,7 +558,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 +570,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..db8fb2f338 100755 --- a/test/test.hh +++ b/test/test.hh @@ -80,6 +80,39 @@ namespace Test { MT_FIRST //< Positive match at beginning }; + /// Tags for test selection + 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); + /// 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 + 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 class Options { public: @@ -101,10 +134,18 @@ namespace Test { bool log; /// Patterns to test against std::vector > testpat; + /// Tags to test against + TestTags 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 +154,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(TestTags tags) const; }; /// The options @@ -123,6 +166,8 @@ namespace Test { private: /// Name of the test std::string _name; + /// Tags assigned to the test + TestTags _tags; /// Next test Base* _next; /// All tests @@ -130,12 +175,16 @@ 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); /// Sort tests alphabetically static void sort(void); /// Return name of test const std::string& name(void) const; + /// Return tags for test + TestTags tags(void) const; /// Return all tests static Base* tests(void); /// Return next test diff --git a/test/test.hpp b/test/test.hpp index f7f56488e7..6d1bdfd2a4 100755 --- a/test/test.hpp +++ b/test/test.hpp @@ -33,6 +33,40 @@ 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(TestTag t0, TestTag t1) + : _mask(static_cast(t0) | + static_cast(t1)) {} + 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 +74,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(), use_testtags(false), + start_from(nullptr), list(false), list_tags(false), list_with_tags(false) {} /* @@ -51,6 +86,10 @@ namespace Test { Base::name(void) const { return _name; } + inline TestTags + Base::tags(void) const { + return _tags; + } inline Base* Base::tests(void) { return _tests;