// // libsemigroups - C++ library for semigroups and monoids // Copyright (C) 2020 James D. Mitchell // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. //
#include <string> // for string #include <vector> // for vector
#include"catch.hpp"// for REQUIRE etc #include"test-main.hpp"// for LIBSEMIGROUPS_TEST_CASE
#include"libsemigroups/order.hpp"// for LexicographicalCompare #include"libsemigroups/siso.hpp"// for cbegin_silo, cbegin_sislo
namespace libsemigroups {
LIBSEMIGROUPS_TEST_CASE("silo", "000", "alphabet: a, min: 0, max: 10", "[silo][quick]") { auto first = ""; auto last = "aaaaaaaaaa"; auto w = std::vector<std::string>(cbegin_silo("a", 10, first, last),
cend_silo("a", 10, first, last));
REQUIRE(w.size() == 10);
REQUIRE(w
== std::vector<std::string>({"", "a", "aa", "aaa", "aaaa", "aaaaa", "aaaaaa", "aaaaaaa", "aaaaaaaa", "aaaaaaaaa"}));
w = std::vector<std::string>(cbegin_silo("", 10, first, last),
cend_silo("", 10, first, last));
REQUIRE(w.size() == 1);
w = std::vector<std::string>(cbegin_silo("a", 4, "aa", last),
cend_silo("a", 4, "aa", last));
REQUIRE(w == std::vector<std::string>({"aa", "aaa"}));
}
LIBSEMIGROUPS_TEST_CASE("silo", "001", "corner cases", "[silo][quick]") { auto first = ""; auto last = "aaaaaaaaaa"; auto w1 = std::vector<std::string>(cbegin_silo("ab", 4, last, first),
cend_silo("ab", 4, last, first));
REQUIRE(w1.empty()); auto w2 = std::vector<std::string>(cbegin_silo("ab", 4, first, first),
cend_silo("ab", 4, first, first));
REQUIRE(w2.empty()); auto w3 = std::vector<std::string>(cbegin_silo("ab", 2, "a", "bb"),
cend_silo("ab", 2, "a", "bb"));
REQUIRE(w3.size() == 2);
REQUIRE(w3 == std::vector<std::string>({"a", "b"})); auto w4 = std::vector<std::string>(cbegin_silo("ab", 1, first, last),
cend_silo("ab", 1, first, last));
REQUIRE(w4 == std::vector<std::string>({""}));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.