diff --git a/cmake/tau-common.cmake b/cmake/tau-common.cmake index e7141ecd..fd35f1e9 100644 --- a/cmake/tau-common.cmake +++ b/cmake/tau-common.cmake @@ -26,14 +26,12 @@ function(target_setup target) target_compile_options(${target} PRIVATE -W -Wall -Wextra -Wpedantic -Wformat=2 - -Wno-variadic-macros -Wcast-align -Wstrict-aliasing=2 -Wstrict-overflow=5 -Wfloat-equal -Wwrite-strings - -Wno-missing-braces - -Wno-parentheses-equality) + ) endif() target_compile_features(${target} PRIVATE cxx_std_20) target_git_definitions(${target}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 67dea6e7..1d9e257b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -56,9 +56,9 @@ target_link_options(TAUo PRIVATE ${TAU_LINK_OPTIONS}) target_sources(TAUo PRIVATE ${TAU_SOURCES} ${TAU_HEADERS}) target_link_libraries(TAUo ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(TAUo ${OBJECT_LIB_NAME} idni_parser) -target_include_directories(TAUo PUBLIC - $ - $) +target_include_directories(TAUo PUBLIC + $ + $) target_include_directories(TAUo PUBLIC $ ) @@ -73,9 +73,9 @@ target_compile_options(TAUso PRIVATE ${TAU_COMPILE_OPTIONS}) target_link_options(TAUso PRIVATE ${TAU_LINK_OPTIONS}) target_link_libraries(TAUso TAUo) target_link_libraries(TAUso ${OBJECT_LIB_NAME} idni_parser) -target_include_directories(TAUso PUBLIC - $ - $) +target_include_directories(TAUso PUBLIC + $ + $) target_include_directories(TAUso PUBLIC $ $ @@ -94,7 +94,7 @@ target_setup(TAUs) target_compile_options(TAUs PRIVATE ${TAU_COMPILE_OPTIONS}) target_link_options(TAUs PRIVATE ${TAU_LINK_OPTIONS}) target_link_libraries(TAUs TAUo) -target_include_directories(TAUs +target_include_directories(TAUs PUBLIC $ ) set_target_properties(TAUs PROPERTIES OUTPUT_NAME "TAU") diff --git a/src/anf.h b/src/anf.h index 232e898a..78a68ec1 100644 --- a/src/anf.h +++ b/src/anf.h @@ -51,7 +51,7 @@ struct anf : set> { r.neg = !(neg == x.neg); return r; } - + anf operator|(const anf& x) const { return x + *this + (*this * x); } static set union_(const set& x, const set& y) { diff --git a/src/babdd.h b/src/babdd.h index 7e61749f..f298c14f 100644 --- a/src/babdd.h +++ b/src/babdd.h @@ -431,8 +431,10 @@ struct bdd : variant : bdd_node>> dnf() const { set>> r; dnf([&r](auto& x) { r.insert(x); return true; }); @@ -491,7 +491,7 @@ template void create_universe(B a) { } } -template void create_universe(Bool a) { +template void create_universe(Bool /*a*/) { const auto &T = bdd::T; const auto &F = bdd::F; auto &V = bdd::V; diff --git a/src/bool.h b/src/bool.h index f2aed719..86e92573 100644 --- a/src/bool.h +++ b/src/bool.h @@ -18,19 +18,19 @@ struct Bool { static const Bool& zero() { static Bool b(false); return b; } static const Bool& one() { static Bool b(true); return b; } - + Bool operator&(const Bool& x) const; Bool operator|(const Bool& x) const; Bool operator^(const Bool& x) const; Bool operator+(const Bool& x) const; Bool operator~() const; auto operator<=>(const Bool& x) const = default; - - bool is_zero() const { - return !b; + + bool is_zero() const { + return !b; } - bool is_one() const { - return b; + bool is_one() const { + return b; } bool b; @@ -52,8 +52,8 @@ Bool Bool::operator+(const Bool& x) const { return (this->b == true) ? ~x : x; } -Bool Bool::operator~() const { - return (this->b == true) ? zero() : one(); +Bool Bool::operator~() const { + return (this->b == true) ? zero() : one(); } #endif diff --git a/src/defs.h b/src/defs.h index 65fb27cb..452c9a36 100644 --- a/src/defs.h +++ b/src/defs.h @@ -16,10 +16,11 @@ typedef int sym_t; -// toggles for debugging, comment properly to enable/disable each feature/debug helper. +// toggles for debugging, comment properly to enable/disable each feature/debug helper. // TODO (LOW) final features should be cotrolled by a command line flag +#undef OUTPUT_APPLY_RULES #define OUTPUT_APPLY_RULES #define OUTPUT_PARSED_TREES diff --git a/src/formula.h b/src/formula.h index 7bc04259..f7ae7bd4 100644 --- a/src/formula.h +++ b/src/formula.h @@ -580,8 +580,8 @@ struct stringify { return n; } - const extractor_t& extractor; std::basic_stringstream& stream; + const extractor_t& extractor; }; // converts a sp_tau_node<...> to a string skipping the nodes that satisfy the @@ -795,7 +795,7 @@ tau_rule make_rule(sp_tau_node& rule) { switch (type) { case tau_parser::bf_rule: return make_rule(rule); case tau_parser::wff_rule: return make_rule(rule); - default: assert(false); + default: assert(false); return {}; }; } @@ -924,7 +924,7 @@ template sp_tau_node tau_apply_builder(const builder& b, std::vector>& n) { std::map, sp_tau_node> changes; std::vector> vars = b.first || tau_parser::capture; - for (int i = 0; i < vars.size(); ++i) changes[vars[i]] = n[i]; + for (size_t i = 0; i < vars.size(); ++i) changes[vars[i]] = n[i]; return replace>(b.second, changes); } @@ -1435,7 +1435,6 @@ sp_tau_node tau_apply(const rules& rs, const sp_tau_node // TODO (HIGH) << for tau_source_sym // TODO (HIGH) << for tau_source_node -// TODO (HIGH) << for tau_source_node // TODO (HIGH) << for sp_tau_source_node // TODO (HIGH) << for tau_sym // TODO (HIGH) << for sp_tau_node diff --git a/src/main.cpp b/src/main.cpp index d8f3e60d..c7697f93 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,15 +23,15 @@ using namespace idni::tau; // We could use TODO (HIGH|MEDIUM|LOW|nothing), DOING, IDEA, FIXME, REVIEW and MARK. -// TODO (IMPORTANT) deal with runtime errors in the code. +// TODO (IMPORTANT) deal with runtime errors in the code. // For example, if the user provides a formula with errors, we should not continue // and print garbage. Instead, we should print an error message and exit. // TODO (MEDIUM) declare a static const lambda instead of a predicates if possible // -// This could be done in all the code. +// This could be done in all the code. -int main(int argc, char** argv) { +int main(int /*argc*/, char** /*argv*/) { // TODO (LOW) tau main method, parse command line arguments, read input file,... // normalize, print output, etc. return 0; diff --git a/src/normalizer.h b/src/normalizer.h index 3bd913a3..daaab6e4 100644 --- a/src/normalizer.h +++ b/src/normalizer.h @@ -59,7 +59,7 @@ struct normalizer, aux...> { for (const auto& x : pos) p = (p | x); msba_t r(true, p); hbdd np = ~p; - if (!(p->get_uelim() == false)) return msba_t(false); + if (!(p->get_uelim() == false)) return msba_t(false); auto t = p->lgrs(); for (const hbdd& x : neg) { hbdd z = x->compose(t) & np; diff --git a/src/rewriting.h b/src/rewriting.h index 3451f9ad..16924cea 100644 --- a/src/rewriting.h +++ b/src/rewriting.h @@ -37,10 +37,10 @@ namespace idni::rewriter { // Both notions could be unified if we keep those operators defined. // IDEA make make_node a friend function and the constructor private. Right now -// it is public to easy the construction of the tree during testing, but it is +// it is public to easy the construction of the tree during testing, but it is // not really needed. -// node of a tree. +// node of a tree. template struct node { // equality operators and ordering @@ -51,9 +51,9 @@ struct node { return std::lexicographical_compare_three_way( child.begin(), child.end(), that.child.begin(), that.child.end()); - } + } - // the value of the node and pointers to the children, we follow the same + // the value of the node and pointers to the children, we follow the same // notation as in forest<...>::tree to be able to reuse the code with // forest<...>::tree. symbol_t value; @@ -66,10 +66,10 @@ using sp_node = std::shared_ptr>; // node factory method template -sp_node make_node(const symbol_t& s, +sp_node make_node(const symbol_t& s, const std::vector>& ns) { static std::map, sp_node> cache; - node key{s, ns}; + node key{s, ns}; if (auto it = cache.find(key); it != cache.end()) { return it->second; } @@ -96,11 +96,11 @@ template using identity_t = decltype(identity); // visitor that traverse the tree in post-order (avoiding visited nodes). -template struct post_order_traverser { - post_order_traverser(wrapped_t& wrapped, predicate_t& query) : + post_order_traverser(wrapped_t& wrapped, predicate_t& query) : wrapped(wrapped), query(query) {} output_node_t operator()(const input_node_t& n) { @@ -120,13 +120,13 @@ struct post_order_traverser { output_node_t traverse(const input_node_t& n, std::set& visited) { // we traverse the children of the node in post-order, i.e. we visit // the children first and then the node itself. - for (const auto& c : n->child) + for (const auto& c : n->child) // we skip already visited nodes and nodes that do not match the // query predicate if it is present. if (!visited.contains(c) && query(c)) { traverse(c, visited); // we assume we have no cycles, i.e. there is no way we could - // visit the same node again down the tree. + // visit the same node again down the tree. // thus we can safely add the node to the visited set after // visiting it. visited.insert(c); @@ -141,11 +141,11 @@ struct post_order_traverser { // change all the related code. // visitor that traverse the tree in post-order (repeating visited nodes if necessary). -template struct post_order_tree_traverser { - post_order_tree_traverser(wrapped_t& wrapped, predicate_t& query) : + post_order_tree_traverser(wrapped_t& wrapped, predicate_t& query) : wrapped(wrapped), query(query) {} output_node_t operator()(const input_node_t& n) { @@ -161,7 +161,7 @@ struct post_order_tree_traverser { output_node_t traverse(const input_node_t& n) { // we traverse the children of the node in post-order, i.e. we visit // the children first and then the node itself. - for (const auto& c : n->child) + for (const auto& c : n->child) // we skip already visited nodes and nodes that do not match the // query predicate if it is present. if (query(c)) traverse(c); @@ -170,9 +170,9 @@ struct post_order_tree_traverser { } }; -// visitor that produces nodes transformed accordingly to the +// visitor that produces nodes transformed accordingly to the // given transformer. It only works with post order traversals. -template struct map_transformer { @@ -180,8 +180,8 @@ struct map_transformer { output_node_t operator()(const input_node_t& n) { std::vector child; - for (const auto& c : n->child) - if (auto it = changes.find(c); it != changes.end()) + for (const auto& c : n->child) + if (auto it = changes.find(c); it != changes.end()) child.push_back(it->second); return changes[n] = make_node(wrapped(n->value), child); } @@ -190,9 +190,9 @@ struct map_transformer { wrapped_t& wrapped; }; -// visitor that produces nodes transformed accordingly to the +// visitor that produces nodes transformed accordingly to the // given transformer. It only works with post order traversals. -template struct map_node_transformer { @@ -203,8 +203,8 @@ struct map_node_transformer { auto nn = wrapped(n); if (nn != n) { changes[n] == nn; return nn; }; std::vector child; - for (const auto& c : n->child) - if (auto it = changes.find(c); it != changes.end()) + for (const auto& c : n->child) + if (auto it = changes.find(c); it != changes.end()) child.push_back(it->second); else child.push_back(c); auto nn2 = make_node(nn->value, child); @@ -215,11 +215,11 @@ struct map_node_transformer { wrapped_t& wrapped; }; -// visitor that produces nodes transformed accordingly to the +// visitor that produces nodes transformed accordingly to the // given transformer. It only works with post order traversals. // // TODO (MEDIUM) merge replace and replace_node transformers into one. -template struct replace_node_transformer { @@ -227,8 +227,8 @@ struct replace_node_transformer { output_node_t operator()(const input_node_t& n) { std::vector child; - for (const auto& c : n->child) - if (auto it = changes.find(c); it != changes.end()) + for (const auto& c : n->child) + if (auto it = changes.find(c); it != changes.end()) child.push_back(it->second); return changes[n] = wrapped(n->value, child); } @@ -237,7 +237,7 @@ struct replace_node_transformer { wrapped_t& wrapped; }; -// visitor that produces nodes transformed accordingly to the +// visitor that produces nodes transformed accordingly to the // given transformer. It only works with post order traversals. template struct replace_transformer { @@ -252,7 +252,7 @@ struct replace_transformer { private: node_t replace(const node_t& n) { std::vector child; - for (const auto& c : n->child) + for (const auto& c : n->child) if (auto it = changes.find(c); it != changes.end()) child.push_back(it->second); else child.push_back(c); @@ -260,12 +260,12 @@ struct replace_transformer { } }; -// visitor that selects top nodes that satisfy a predicate and stores them in the +// visitor that selects top nodes that satisfy a predicate and stores them in the // supplied vector. It only works with post order traversals and never produces // duplicates. template struct select_top_predicate { - select_top_predicate(predicate_t& query, std::vector& selected) : + select_top_predicate(predicate_t& query, std::vector& selected) : query(query), selected(selected) {} bool operator()(const node_t& n) { @@ -274,40 +274,40 @@ struct select_top_predicate { // since we are only interested in the top nodes. if (std::find(selected.begin(), selected.end(), n) == selected.end()) selected.push_back(n); - return false; + return false; } predicate_t& query; std::vector& selected; }; -// visitor that selects nodes that satisfy a predicate and stores them in the +// visitor that selects nodes that satisfy a predicate and stores them in the // supplied vector. template struct select_all_predicate { - select_all_predicate(predicate_t& query, std::vector& selected) : + select_all_predicate(predicate_t& query, std::vector& selected) : query(query), selected(selected) {} bool operator()(const node_t& n) { if (query(n)) selected.push_back(n); // we always return true to visit all the nodes. - return true; + return true; } predicate_t& query; std::vector& selected; }; -// visitor that selects nodes that satisfy a predicate and stores them in the +// visitor that selects nodes that satisfy a predicate and stores them in the // supplied vector. template struct find_top_predicate { - find_top_predicate(predicate_t& query, std::optional& found) : + find_top_predicate(predicate_t& query, std::optional& found) : query(query), found(found) {} bool operator()(const node_t& n) { if (!found && query(n)) found = n; - return !found; + return !found; } predicate_t& query; @@ -317,13 +317,13 @@ struct find_top_predicate { // always true predicate // // TODO (LOW) define a const version of the predicate, move it to rewriter and use -// it in all the code. Review the connection with all predicate and use only +// it in all the code. Review the connection with all predicate and use only // one of them. // Check if we have other cases like this one template struct true_predicate { - - bool operator()(const node_t& n) const { + + bool operator()(const node_t& /*n*/) const { return true; } }; @@ -338,8 +338,8 @@ using true_predicate_t = true_predicate; // Check if we have other cases like this one template struct false_predicate { - - bool operator()(const node_t& n) const { + + bool operator()(const node_t& /*n*/) const { return false; } }; @@ -415,8 +415,8 @@ node_t trim_top(const node_t& input, predicate_t& query) { neg_predicate neg(query); map_transformer, node_t> map(identity); return post_order_traverser< - map_transformer, node_t>, - neg_predicate_t, + map_transformer, node_t>, + neg_predicate_t, node_t>( map, neg)(input); } @@ -427,8 +427,8 @@ std::vector select_top(const node_t& input, predicate_t& query) { std::vector selected; select_top_predicate select(query, selected); post_order_traverser< - identity_t, - select_top_predicate, + identity_t, + select_top_predicate, node_t>( identity, select)(input); return selected; @@ -440,8 +440,8 @@ std::vector select_all(const node_t& input, predicate_t& query) { std::vector selected; select_all_predicate select(query, selected); post_order_traverser< - identity_t, - select_all_predicate, + identity_t, + select_all_predicate, node_t>( identity, select)(input); return selected; @@ -453,8 +453,8 @@ std::optional find_top(const node_t& input, predicate_t& query) { std::optional found; find_top_predicate find_top(query, found); post_order_traverser< - identity_t, - find_top_predicate, + identity_t, + find_top_predicate, node_t>( identity, find_top)(input); return found; @@ -465,8 +465,8 @@ template node_t replace(const node_t& n, std::map& changes) { replace_transformer replace{changes}; return post_order_traverser< - replace_transformer, - all_t, + replace_transformer, + all_t, node_t> (replace , all)(n); } @@ -480,8 +480,8 @@ struct while_not_found_predicate { while_not_found_predicate(std::optional& found) : found(found) {} - bool operator()(const node_t& n) const { - return !found; + bool operator()(const node_t& /*n*/) const { + return !found; } std::optional& found; @@ -491,7 +491,7 @@ struct while_not_found_predicate { // the predicate is satisfied by a node (set in found). template struct find_visitor { - + find_visitor(predicate_t& query, std::optional& found) : query(query), found(found) {} node_t operator()(const node_t& n) const { @@ -510,8 +510,8 @@ std::optional find_bottom(const node_t& input, predicate_t& query) { while_not_found_predicate not_found(node); find_visitor find(query, node); post_order_traverser< - find_visitor, - while_not_found_predicate, + find_visitor, + while_not_found_predicate, node_t>( find, not_found)(input); return node; @@ -537,12 +537,12 @@ using rule = std::pair; // // IDEA use also a skip predicate to skip subtrees that are not needed in the match. // It should allow to detects matches in the middle of a tree. -template +template struct pattern_matcher { using pattern_t = node_t; - pattern_matcher(pattern_t& pattern, environment& env, - is_ignore_t& is_ignore, is_capture_t& is_capture): pattern(pattern), + pattern_matcher(pattern_t& pattern, environment& env, + is_ignore_t& is_ignore, is_capture_t& is_capture): pattern(pattern), env(env), is_ignore(is_ignore), is_capture(is_capture) {} bool operator()(const node_t& n) { @@ -569,8 +569,8 @@ struct pattern_matcher { // if we already have captured a node associated to the current capture // we check if it is the same as the current node, if it is not, we // return false... - if (is_capture(p)) - if (auto it = env.find(p); it != env.end() && it->second != n) + if (is_capture(p)) + if (auto it = env.find(p); it != env.end() && it->second != n) return false; // ...otherwise we save the current node as the one associated to the // current capture and return true. @@ -599,13 +599,13 @@ struct pattern_matcher { // TODO (LOW) create and env in operator() and pass it as a parameter to match, if // a match occurs, copy the data from the temp env to the env passed as // parameter. -template +template struct pattern_matcher_with_skip { using pattern_t = node_t; - pattern_matcher_with_skip(const pattern_t& pattern, environment& env, - is_ignore_t& is_ignore, is_capture_t& is_capture, is_skip_t is_skip): - pattern(pattern), env(env), is_ignore(is_ignore), + pattern_matcher_with_skip(const pattern_t& pattern, environment& env, + is_ignore_t& is_ignore, is_capture_t& is_capture, is_skip_t &is_skip): + pattern(pattern), env(env), is_ignore(is_ignore), is_capture(is_capture), is_skip(is_skip) {} bool operator()(const node_t& n) { @@ -633,8 +633,8 @@ struct pattern_matcher_with_skip { // if we already have captured a node associated to the current capture // we check if it is the same as the current node, if it is not, we // return false... - if (is_capture(p)) - if (auto it = env.find(p); it != env.end() && it->second != n) + if (is_capture(p)) + if (auto it = env.find(p); it != env.end() && it->second != n) return false; // ...otherwise we save the current node as the one associated to the // current capture and return true. @@ -661,7 +661,7 @@ struct pattern_matcher_with_skip { }; // apply a rule to a tree using the predicate to pattern_matcher. -template +template node_t apply(rule& r, node_t& n, is_ignore_t& i, is_capture_t& c) { auto [p , s] = r; environment u; @@ -671,12 +671,12 @@ node_t apply(rule& r, node_t& n, is_ignore_t& i, is_capture_t& c) { // apply a rule to a tree using the predicate to pattern_matcher and skipping // unnecessary subtrees -template +template node_t apply_with_skip(const rule& r, const node_t& n, is_ignore_t& i, is_capture_t& c, is_skip_t& sk) { auto [p , s] = r; environment u; - pattern_matcher_with_skip + pattern_matcher_with_skip matcher {p, u, i, c, sk}; auto nn = apply(s, n, matcher); @@ -690,9 +690,9 @@ node_t apply_with_skip(const rule& r, const node_t& n, is_ignore_t& i, i return nn; } -// apply a substitution to a rule according to a given matcher, this method is +// apply a substitution to a rule according to a given matcher, this method is // use internaly by apply and apply with skip. -template +template node_t apply(const node_t& s, const node_t& n, matcher_t& matcher) { post_order_traverser, matcher_t, node_t>(identity, matcher)(n); if (matcher.matched) { @@ -711,11 +711,11 @@ using drop_location_t = decltype(drop_location); // make a tree from the given source code string. template -sp_node make_node_from_string(const transformer_t& transformer, const std::string source) { +sp_node make_node_from_string(const transformer_t& /*transformer*/, const std::string source) { using parse_forest = idni::forest; - using parse_tree = typename parse_forest::tree; + //using parse_tree = typename parse_forest::tree; using sp_parse_tree = typename parse_forest::sptree; - using parse_graph = typename parse_forest::graph; + //using parse_graph = typename parse_forest::graph; sp_parse_tree t; static parser_t parser; @@ -723,7 +723,7 @@ sp_node make_node_from_string(const transformer_t& transformer, const // MARK output the error if the parser failed // avoiding doctest issues, uncomment for errors //if (!f || !parser.found()) { - // std::cerr << parser.get_error().to_str(); + // std::cerr << parser.get_error().to_str(); //} auto get_tree = [&f, &t] (auto& g ){ @@ -738,11 +738,11 @@ sp_node make_node_from_string(const transformer_t& transformer, const }; f->extract_graphs(f->root(), get_tree); - map_transformer, + map_transformer, sp_parse_tree, sp_node> transform(drop_location); return post_order_traverser< // REVIEW maybe should be transformer instead of drop_location - map_transformer, sp_parse_tree, sp_node>, + map_transformer, sp_parse_tree, sp_node>, all_t, sp_parse_tree, sp_node> (transform, all)(t); diff --git a/src/seq.h b/src/seq.h index d4985a1f..4cefab6b 100644 --- a/src/seq.h +++ b/src/seq.h @@ -36,7 +36,7 @@ template struct seq { const state& prev, state& curr) const { nso_t &f = (curr[s] = prev.at(s) & this->first); for_each_subset_dec(s, [&f](size_t s) { - f = f & (prev.at(s) | ~psi(s)); + f = f & (prev.at(s) | ~psi(s)); }); f = q(f); } diff --git a/src/tau.cpp b/src/tau.cpp index 6a92acce..b31e99c9 100644 --- a/src/tau.cpp +++ b/src/tau.cpp @@ -44,7 +44,7 @@ bool is_satisfiable(const formula& f) { // the inputs would be the input variables of the program and would be binded from // actual parsed inputs or given formulkas supplied by the user (build in whatever way). -// helpers method could be provided to create tau_input from an input strings +// helpers method could be provided to create tau_input from an input strings // as we do in formula bindings // how we could avoid the creation of tau_execution if the formula is insatisfiable? diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2357e8e2..426586a0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -29,104 +29,34 @@ endif () # Unit testing # -set(DEBUG_TAU_NORMALIZER debug_tau_normalizer.cpp) -add_executable(debug_tau_normalizer ${DEBUG_TAU_NORMALIZER}) +set(TESTS + ba + bool + hbdd + rules-bf_execution + rules-bf_parsing + rules-wff_execution + rules-wff_parsing + builders + rewriting + formula + tau_parser + normalizer2 + type_system + bindings + traversal + integration +) + +foreach(X IN LISTS TESTS) + set(N "test_${X}") + add_executable(${N} "${N}.cpp") + target_setup(${N}) + target_link_libraries(${N} TAUo doctest) + target_compile_options(${N} PUBLIC -Wno-unused-function) + add_test(NAME ${N} COMMAND "${PROJECT_BINARY_DIR}/${N}") +endforeach() + +add_executable(debug_tau_normalizer debug_tau_normalizer.cpp) target_setup(debug_tau_normalizer) target_link_libraries(debug_tau_normalizer TAUo) - -set(TEST_BA test_ba.cpp) -add_executable(test_ba ${TEST_BA}) -target_setup(test_ba) -target_link_libraries(test_ba TAUo doctest) - -set(TEST_BOOL test_bool.cpp) -add_executable(test_bool ${TEST_BOOL}) -target_setup(test_bool) -target_link_libraries(test_bool TAUo doctest) - -set(TEST_HBDD test_hbdd.cpp) -add_executable(test_hbdd ${TEST_HBDD}) -target_setup(test_hbdd) -target_link_libraries(test_hbdd TAUo doctest) - -set(TEST_RULES_BF_EXECUTION test_rules-bf_execution.cpp) -add_executable(test_rules-bf_execution ${TEST_RULES_BF_EXECUTION}) -target_setup(test_rules-bf_execution) -target_link_libraries(test_rules-bf_execution TAUo doctest) - -set(TEST_RULES_BF_PARSING test_rules-bf_parsing.cpp) -add_executable(test_rules-bf_parsing ${TEST_RULES_BF_PARSING}) -target_setup(test_rules-bf_parsing) -target_link_libraries(test_rules-bf_parsing TAUo doctest) - -set(TEST_RULES_WFF_EXECUTION test_rules-wff_execution.cpp) -add_executable(test_rules-wff_execution ${TEST_RULES_WFF_EXECUTION}) -target_setup(test_rules-wff_execution) -target_link_libraries(test_rules-wff_execution TAUo doctest) - -set(TEST_RULES_WFF_PARSING test_rules-wff_parsing.cpp) -add_executable(test_rules-wff_parsing ${TEST_RULES_WFF_PARSING}) -target_setup(test_rules-wff_parsing) -target_link_libraries(test_rules-wff_parsing TAUo doctest) - -set(TEST_BUILDERS test_builders.cpp) -add_executable(test_builders ${TEST_BUILDERS}) -target_setup(test_builders) -target_link_libraries(test_builders TAUo doctest) - -set(TEST_REWRITING test_rewriting.cpp) -add_executable(test_rewriting ${TEST_REWRITING}) -target_setup(test_rewriting) -target_link_libraries(test_rewriting TAUo doctest) - -set(TEST_FORMULA test_formula.cpp) -add_executable(test_formula ${TEST_FORMULA}) -target_setup(test_formula) -target_link_libraries(test_formula TAUo doctest) - -set(TEST_TAU_PARSER test_tau_parser.cpp) -add_executable(test_tau_parser ${TEST_TAU_PARSER}) -target_setup(test_tau_parser) -target_link_libraries(test_tau_parser TAUo doctest) - -set(TEST_NORMALIZER2 test_normalizer2.cpp) -add_executable(test_normalizer2 ${TEST_NORMALIZER2}) -target_setup(test_normalizer2) -target_link_libraries(test_normalizer2 TAUo doctest) - -set(TEST_TYPE_SYSTEM test_type_system.cpp) -add_executable(test_type_system ${TEST_TYPE_SYSTEM}) -target_setup(test_type_system) -target_link_libraries(test_type_system TAUo doctest) - -set(TEST_BINDINGS test_bindings.cpp) -add_executable(test_bindings ${TEST_BINDINGS}) -target_setup(test_bindings) -target_link_libraries(test_bindings TAUo doctest) - -set(TEST_TRAVERSAL test_traversal.cpp) -add_executable(test_traversal ${TEST_TRAVERSAL}) -target_setup(test_traversal) -target_link_libraries(test_traversal TAUo doctest) - -set(TEST_INTEGRATION test_integration.cpp) -add_executable(test_integration ${TEST_INTEGRATION}) -target_setup(test_integration) -target_link_libraries(test_integration TAUo doctest) - -add_test(NAME test_rules-bf_parsing COMMAND "${PROJECT_BINARY_DIR}/test_rules-bf_parsing") -add_test(NAME test_rules-bf_execution COMMAND "${PROJECT_BINARY_DIR}/test_rules-bf_execution") -add_test(NAME test_rules-wff_parsing COMMAND "${PROJECT_BINARY_DIR}/test_rules-wff_parsing") -add_test(NAME test_rules-wff_execution COMMAND "${PROJECT_BINARY_DIR}/test_rules-wff_execution") -add_test(NAME test_builders COMMAND "${PROJECT_BINARY_DIR}/test_builders") -add_test(NAME test_ba COMMAND "${PROJECT_BINARY_DIR}/test_ba") -add_test(NAME test_bool COMMAND "${PROJECT_BINARY_DIR}/test_bool") -add_test(NAME test_hbdd COMMAND "${PROJECT_BINARY_DIR}/test_hbdd") -add_test(NAME test_rewriting COMMAND "${PROJECT_BINARY_DIR}/test_rewriting") -add_test(NAME test_formula COMMAND "${PROJECT_BINARY_DIR}/test_formula") -add_test(NAME test_tau_parser COMMAND "${PROJECT_BINARY_DIR}/test_tau_parser") -add_test(NAME test_normalizer2 COMMAND "${PROJECT_BINARY_DIR}/test_normalizer2") -add_test(NAME test_type_system COMMAND "${PROJECT_BINARY_DIR}/test_type_system") -add_test(NAME test_bindings COMMAND "${PROJECT_BINARY_DIR}/test_bindings") -add_test(NAME test_traversal COMMAND "${PROJECT_BINARY_DIR}/test_traversal") -add_test(NAME test_integration COMMAND "${PROJECT_BINARY_DIR}/test_integration") diff --git a/tests/test_ba.cpp b/tests/test_ba.cpp index 04205514..339ba72e 100644 --- a/tests/test_ba.cpp +++ b/tests/test_ba.cpp @@ -24,9 +24,9 @@ TEST_SUITE("product boolean algebra") { struct ba_01 { bool value; - ba_01 operator&(const ba_01& that) { return {value & that.value}; } - ba_01 operator|(const ba_01& that) { return {value | that.value}; } - ba_01 operator^(const ba_01& that) { return {value ^ that.value}; } + ba_01 operator&(const ba_01& that) { return ba_01(value & that.value); } + ba_01 operator|(const ba_01& that) { return ba_01(value | that.value); } + ba_01 operator^(const ba_01& that) { return ba_01(value ^ that.value); } ba_01 operator~() { return {!value}; } auto operator<=>(const ba_01& that) const = default; }; @@ -34,19 +34,19 @@ TEST_SUITE("product boolean algebra") { struct ba_01p { bool value; - ba_01p operator&(const ba_01p& that) { return {value & that.value}; } - ba_01p operator|(const ba_01p& that) { return {value | that.value}; } - ba_01p operator^(const ba_01p& that) { return {value ^ that.value}; } + ba_01p operator&(const ba_01p& that) { return ba_01p(value & that.value); } + ba_01p operator|(const ba_01p& that) { return ba_01p(value | that.value); } + ba_01p operator^(const ba_01p& that) { return ba_01p(value ^ that.value); } ba_01p operator~() { return {!value}; } auto operator<=>(const ba_01p& that) const = default; }; TEST_CASE("the product of one 0/1 boolean algebra is the correct boolean algebra") { - + ba_product F(ba_01(false)); ba_product T(ba_01(true)); - CHECK( ~F == T); CHECK( ~T == F); + CHECK( ~F == T); CHECK( ~T == F); CHECK( (F & F) == F); CHECK( (F & T) == F); CHECK( (T & F) == F); CHECK( (T & T) == T); @@ -59,7 +59,7 @@ TEST_SUITE("product boolean algebra") { } TEST_CASE("the product of two 0/1 boolean algebra is the correct boolean algebra") { - + ba_product FF(ba_01(false), ba_01p(false)); ba_product FT(ba_01(false), ba_01p(true)); ba_product TF(ba_01(true), ba_01p(false)); @@ -68,7 +68,7 @@ TEST_SUITE("product boolean algebra") { CHECK( ~FF == TT); CHECK( ~FT == TF); CHECK( ~TF == FT); CHECK( ~TT == FF); - CHECK( (FF & TT) == FF); CHECK( (FF & TF) == FF); + CHECK( (FF & TT) == FF); CHECK( (FF & TF) == FF); CHECK( (FF & FT) == FF); CHECK( (FF & FF) == FF); CHECK( (FT & TT) == FT); CHECK( (FT & TF) == FF); CHECK( (FT & FT) == FT); CHECK( (FT & FF) == FF); diff --git a/tests/test_bindings.cpp b/tests/test_bindings.cpp index aebe6004..dde5c000 100644 --- a/tests/test_bindings.cpp +++ b/tests/test_bindings.cpp @@ -28,7 +28,7 @@ namespace testing = doctest; TEST_SUITE("named bindings") { TEST_CASE("binding: given one statement with no bindigns, the binding process returns the same statement.") { - static constexpr char* sample = "$X := $X."; + const char* sample = "$X := $X."; auto src = make_tau_source(sample); auto statement = make_statement(src); bindings bs; bs["binding"] = { Bool(true) }; @@ -37,7 +37,7 @@ TEST_SUITE("named bindings") { } TEST_CASE("binding: given one statement with one binding, the binding process returns the statement with the binding replaced.") { - static constexpr char* sample = "{ binding } := { binding }."; + const char* sample = "{ binding } := { binding }."; auto src = make_tau_source(sample); auto statement = make_statement(src); bindings bs; bs["binding"] = { Bool(true) }; @@ -46,7 +46,7 @@ TEST_SUITE("named bindings") { } TEST_CASE("binding: given one statement with one non-matching binding, the binding process returns the original statement.") { - static constexpr char* sample = "{ non_matching } := { non_matching }."; + const char* sample = "{ non_matching } := { non_matching }."; auto src = make_tau_source(sample); auto statement = make_statement(src); bindings bs; bs["binding"] = { Bool(true) }; @@ -67,7 +67,7 @@ TEST_SUITE("factory bindings") { static auto factory = dummy_factory(); TEST_CASE("binding: given one statement with no bindigns, the binding process returns the same statement.") { - static constexpr char* sample = "$X := $X."; + const char* sample = "$X := $X."; auto src = make_tau_source(sample); auto statement = make_statement(src); auto binded = make_factory_bindings(statement, factory); @@ -75,7 +75,7 @@ TEST_SUITE("factory bindings") { } TEST_CASE("binding: given one statement with one binding, the binding process returns the statement with the binding replaced.") { - static constexpr char* sample = "{ binding } := { bool : some_source_sode }."; + const char* sample = "{ binding } := { bool : some_source_sode }."; auto src = make_tau_source(sample); auto statement = make_statement(src); auto binded = make_factory_bindings(statement, factory); @@ -83,7 +83,7 @@ TEST_SUITE("factory bindings") { } TEST_CASE("binding: given one statement with one non-matching binding, the binding process returns the original statement.") { - static constexpr char* sample = "{ non_matching } := { non_bool: some_source_code }."; + const char* sample = "{ non_matching } := { non_bool: some_source_code }."; auto src = make_tau_source(sample); auto statement = make_statement(src); auto binded = make_factory_bindings(statement, factory); diff --git a/tests/test_builders.cpp b/tests/test_builders.cpp index 08e14fc5..8bfe7172 100644 --- a/tests/test_builders.cpp +++ b/tests/test_builders.cpp @@ -152,7 +152,7 @@ TEST_SUITE("builders parsing") { TEST_SUITE("builders execution") { - static constexpr char* sample = " ( ?X = F ) ."; + const char* sample = " ( ?X = F ) ."; auto src = make_tau_source(sample); auto frml = make_statement(src); auto X = frml diff --git a/tests/test_formula.cpp b/tests/test_formula.cpp index 3ee46a1e..64bfd2e5 100644 --- a/tests/test_formula.cpp +++ b/tests/test_formula.cpp @@ -65,17 +65,17 @@ TEST_SUITE("make_library") { TEST_SUITE("callbacks") { TEST_CASE("BF_CALLBACK_SUBS") { - static constexpr char* sample = "bf_subs_cb F T F := F."; + const char* sample = "bf_subs_cb F T F := F."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); callback_applier cb_applier; - auto extracted = sample_statement - | tau_parser::library | tau_parser::rules - | tau_parser::rule | tau_parser::bf_rule - | tau_parser::bf_matcher | tau_parser::bf | tau_parser::bf_subs_cb + auto extracted = sample_statement + | tau_parser::library | tau_parser::rules + | tau_parser::rule | tau_parser::bf_rule + | tau_parser::bf_matcher | tau_parser::bf | tau_parser::bf_subs_cb | optional_value_extractor>; auto result = cb_applier(extracted); - CHECK( is_non_terminal(tau_parser::bf_t, result) ); + CHECK( is_non_terminal(tau_parser::bf_t, result) ); } // TODO (MEDIUM) add explicit unit tests for the remaining callbacks @@ -83,4 +83,3 @@ TEST_SUITE("callbacks") { // All of them are tested inderectly when appying the rules of the normalizer // in the file test_rules.cpp. However, it is better to have explicit tests } - diff --git a/tests/test_helpers.h b/tests/test_helpers.h index d7275432..83ecfda2 100644 --- a/tests/test_helpers.h +++ b/tests/test_helpers.h @@ -26,32 +26,32 @@ sp_tau_node make_statement(const sp_tau_source_node& source) { tauify tf; map_transformer, sp_tau_source_node, sp_tau_node> transform(tf); return post_order_traverser< - map_transformer, sp_tau_source_node, sp_tau_node>, - all_t, - sp_node, + map_transformer, sp_tau_source_node, sp_tau_node>, + all_t, + sp_node, sp_tau_node>( transform, all)(source); } sp_tau_node make_named_bindings(const sp_tau_node& statement, const bindings& bs) { - true_predicate> always; + //true_predicate> always; name_binder nb(bs); - bind_transformer, Bool> binder(nb); + bind_transformer, Bool> binder(nb); return post_order_traverser< - bind_transformer, Bool>, - all_t>, + bind_transformer, Bool>, + all_t>, sp_tau_node>( binder, all>)(statement); } template sp_tau_node make_factory_bindings(const sp_tau_node& statement, factory_t& factory) { - true_predicate> always; + //true_predicate> always; factory_binder fb(factory); - bind_transformer, Bool> binder(fb); + bind_transformer, Bool> binder(fb); return post_order_traverser< - bind_transformer, Bool>, - all_t>, + bind_transformer, Bool>, + all_t>, sp_tau_node>( binder, all>)(statement); } @@ -78,9 +78,9 @@ std::ostream& pretty_print_sp_tau_node(std::ostream &os, sp_tau_node n, si // for (size_t t = 0; t < l; t++) os << " "; std::visit(overloaded{ [&os](tau_source_sym v) { if (!v.nt()) os << v.t(); }, - [&os](std::variant v) { - if (auto b = std::get<0>(v); b == true) os << "true"; - else if (auto b = std::get<0>(v); b == false) os << "false"; + [&os](std::variant v) { + if (auto b = std::get<0>(v); b == true) os << "true"; + else if (auto b = std::get<0>(v); b == false) os << "false"; else os << "...bdd..."; } }, n->value); for (auto& d : n->child) pretty_print_sp_tau_node(os, d, l + 1); diff --git a/tests/test_integration.cpp b/tests/test_integration.cpp index c31b70f9..690aadf3 100644 --- a/tests/test_integration.cpp +++ b/tests/test_integration.cpp @@ -15,6 +15,7 @@ #include +#undef OUTPUT_APPLY_RULES #define OUTPUT_APPLY_RULES 1 #include "../src/doctest.h" @@ -37,7 +38,7 @@ namespace testing = doctest; TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { TEST_CASE("T") { - static constexpr char* sample = "T."; + const char* sample = "T."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -48,7 +49,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("F") { - static constexpr char* sample = "F."; + const char* sample = "F."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -59,7 +60,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("T wff_and F") { - static constexpr char* sample = "(T wff_and F)."; + const char* sample = "(T wff_and F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -70,7 +71,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("T wff_xor F") { - static constexpr char* sample = "(T wff_xor F)."; + const char* sample = "(T wff_xor F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -81,7 +82,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("F wff_or F") { - static constexpr char* sample = "(F wff_or F)."; + const char* sample = "(F wff_or F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -92,7 +93,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("wff_neg F") { - static constexpr char* sample = "wff_neg F."; + const char* sample = "wff_neg F."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -103,7 +104,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("F wff_imply F") { - static constexpr char* sample = "(F wff_imply F)."; + const char* sample = "(F wff_imply F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -114,7 +115,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("T wff_coimply F") { - static constexpr char* sample = "(T wff_coimply F)."; + const char* sample = "(T wff_coimply F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -125,7 +126,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("F wff_equiv F") { - static constexpr char* sample = "(F wff_equiv F)."; + const char* sample = "(F wff_equiv F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -136,7 +137,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("T bf_and F = F.") { - static constexpr char* sample = "((T bf_and F) = F)."; + const char* sample = "((T bf_and F) = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -147,7 +148,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("T bf_or F = F.") { - static constexpr char* sample = "((T bf_or F) = F)."; + const char* sample = "((T bf_or F) = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -158,7 +159,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("T bf_xor F != F.") { - static constexpr char* sample = "((T bf_xor F) != F)."; + const char* sample = "((T bf_xor F) != F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -169,7 +170,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("bf_neg F = F.") { - static constexpr char* sample = "(bf_neg F = F)."; + const char* sample = "(bf_neg F = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -180,7 +181,7 @@ TEST_SUITE("formulas: no variables, no bindings and no quantifiers") { } TEST_CASE("bf_neg T = F.") { - static constexpr char* sample = "(bf_neg T = F)."; + const char* sample = "(bf_neg T = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -199,7 +200,7 @@ TEST_SUITE("formulas: no variables, bindings and no quantifiers") { TEST_CASE("{ bdd : X } != F") { bdd_init(); - static constexpr char* sample = "( { bdd : X } != F)."; + const char* sample = "( { bdd : X } != F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -211,7 +212,7 @@ TEST_SUITE("formulas: no variables, bindings and no quantifiers") { TEST_CASE("{ bdd : X } = F") { bdd_init(); - static constexpr char* sample = "( { bdd : X } = F)."; + const char* sample = "( { bdd : X } = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -223,7 +224,7 @@ TEST_SUITE("formulas: no variables, bindings and no quantifiers") { TEST_CASE("(bf_neg {bdd : Y} bf_and {bdd : Y}) = F") { bdd_init(); - static constexpr char* sample = "( (bf_neg {bdd : Y} bf_and {bdd : Y}) = F)."; + const char* sample = "( (bf_neg {bdd : Y} bf_and {bdd : Y}) = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -236,7 +237,7 @@ TEST_SUITE("formulas: no variables, bindings and no quantifiers") { TEST_CASE("(bf_neg {bdd : Y} bf_or {bdd : Y}) != F") { bdd_init(); - static constexpr char* sample = "( (bf_neg {bdd : Y} bf_or {bdd : Y}) != F)."; + const char* sample = "( (bf_neg {bdd : Y} bf_or {bdd : Y}) != F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -249,7 +250,7 @@ TEST_SUITE("formulas: no variables, bindings and no quantifiers") { TEST_CASE("( {bdd : Y} bf_less_equal {bdd : Y}) != F") { bdd_init(); - static constexpr char* sample = "( ({bdd : Y} bf_less_equal {bdd : Y}) != F)."; + const char* sample = "( ({bdd : Y} bf_less_equal {bdd : Y}) != F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -262,7 +263,7 @@ TEST_SUITE("formulas: no variables, bindings and no quantifiers") { TEST_CASE("( bf_neg {bdd : Y} bf_less_equal {bdd : Y}) != F") { bdd_init(); - static constexpr char* sample = "( ( bf_neg {bdd : Y} bf_less_equal {bdd : Y}) != F)."; + const char* sample = "( ( bf_neg {bdd : Y} bf_less_equal {bdd : Y}) != F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -275,7 +276,7 @@ TEST_SUITE("formulas: no variables, bindings and no quantifiers") { TEST_CASE("(({bdd : Y} bf_and { bdd : X}) bf_less {bdd : Y}) != F") { bdd_init(); - static constexpr char* sample = "( (({bdd : Y} bf_and { bdd : X}) bf_less {bdd : Y}) != F)."; + const char* sample = "( (({bdd : Y} bf_and { bdd : X}) bf_less {bdd : Y}) != F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -288,7 +289,7 @@ TEST_SUITE("formulas: no variables, bindings and no quantifiers") { TEST_CASE("({bdd : Y} bf_greater ({bdd:X} bf_and {bdd : Y}) = F") { bdd_init(); - static constexpr char* sample = "( (({bdd : Y} bf_and {bdd : X}) bf_greater {bdd : Y}) = F)."; + const char* sample = "( (({bdd : Y} bf_and {bdd : X}) bf_greater {bdd : Y}) = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -303,7 +304,7 @@ TEST_SUITE("formulas: no variables, bindings and no quantifiers") { TEST_SUITE("formulas: variables, no bindings and quantifiers") { TEST_CASE("bf_all ?P ?P = F") { - static constexpr char* sample = "(bf_all ?P ?P = F)."; + const char* sample = "(bf_all ?P ?P = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -316,7 +317,7 @@ TEST_SUITE("formulas: variables, no bindings and quantifiers") { } TEST_CASE("bf_all ?P ?P != F") { - static constexpr char* sample = "(bf_all ?P ?P != F)."; + const char* sample = "(bf_all ?P ?P != F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -329,7 +330,7 @@ TEST_SUITE("formulas: variables, no bindings and quantifiers") { } TEST_CASE("bf_ex ?P ?P == F") { - static constexpr char* sample = "(bf_ex ?P ?P = F)."; + const char* sample = "(bf_ex ?P ?P = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -340,7 +341,7 @@ TEST_SUITE("formulas: variables, no bindings and quantifiers") { } TEST_CASE("bf_ex ?P ?P != F") { - static constexpr char* sample = "(bf_ex ?P ?P != F)."; + const char* sample = "(bf_ex ?P ?P != F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -351,7 +352,7 @@ TEST_SUITE("formulas: variables, no bindings and quantifiers") { } TEST_CASE("wff_ex ?P (?P != F)") { - static constexpr char* sample = "wff_ex ?P (?P != F)."; + const char* sample = "wff_ex ?P (?P != F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -364,7 +365,7 @@ TEST_SUITE("formulas: variables, no bindings and quantifiers") { } TEST_CASE("bf_all ?P ?P != F") { - static constexpr char* sample = "(bf_all ?P ?P != F)."; + const char* sample = "(bf_all ?P ?P != F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -377,7 +378,7 @@ TEST_SUITE("formulas: variables, no bindings and quantifiers") { } TEST_CASE("bf_ex ?P ?P == F") { - static constexpr char* sample = "(bf_ex ?P ?P = F)."; + const char* sample = "(bf_ex ?P ?P = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -388,7 +389,7 @@ TEST_SUITE("formulas: variables, no bindings and quantifiers") { } TEST_CASE("wff_ex ?P (?P == F)") { - static constexpr char* sample = "wff_ex ?P (?P = F)."; + const char* sample = "wff_ex ?P (?P = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -399,7 +400,7 @@ TEST_SUITE("formulas: variables, no bindings and quantifiers") { } TEST_CASE("wff_all ?P (?P != F)") { - static constexpr char* sample = "wff_all ?P (?P != F)."; + const char* sample = "wff_all ?P (?P != F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); @@ -410,7 +411,7 @@ TEST_SUITE("formulas: variables, no bindings and quantifiers") { } TEST_CASE("wff_all ?P (?P == F)") { - static constexpr char* sample = "wff_all ?P (?P = F)."; + const char* sample = "wff_all ?P (?P = F)."; auto sample_src = make_tau_source(sample); bdd_test_factory bf; factory_binder fb(bf); diff --git a/tests/test_rules-bf_execution.cpp b/tests/test_rules-bf_execution.cpp index 65eed598..e34ec08f 100644 --- a/tests/test_rules-bf_execution.cpp +++ b/tests/test_rules-bf_execution.cpp @@ -247,7 +247,7 @@ TEST_SUITE("executing bf rules") { // used within or something else. TEST_CASE("BF_CALLBACK_AND") { - static constexpr char* sample = "( ({l} bf_and { r }) = F )."; + const char* sample = "( ({l} bf_and { r }) = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); bindings bs; bs["l"] = { Bool(true) }; bs["r"] = { Bool(false) }; @@ -265,7 +265,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_OR") { - static constexpr char* sample = "( ({l} bf_or { r }) = F )."; + const char* sample = "( ({l} bf_or { r }) = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); bindings bs; bs["l"] = { Bool(true) }; bs["r"] = { Bool(false) }; @@ -283,7 +283,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_XOR") { - static constexpr char* sample = "( ({l} bf_xor { r }) = F )."; + const char* sample = "( ({l} bf_xor { r }) = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); bindings bs; bs["l"] = { Bool(true) }; bs["r"] = { Bool(false) }; @@ -301,7 +301,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_NEG") { - static constexpr char* sample = "( bf_neg { l } = F )."; + const char* sample = "( bf_neg { l } = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); bindings bs; bs["l"] = { Bool(true) }; @@ -319,7 +319,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_LESS") { - static constexpr char* sample = "( ( { l } bf_less { r } ) = F )."; + const char* sample = "( ( { l } bf_less { r } ) = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); bindings bs; bs["l"] = { Bool(true) }; bs["r"] = { Bool(false) }; @@ -337,7 +337,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_LESS_EQUAL") { - static constexpr char* sample = "( ( { l } bf_less_equal { r } ) = F )."; + const char* sample = "( ( { l } bf_less_equal { r } ) = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); bindings bs; bs["l"] = { Bool(true) }; bs["r"] = { Bool(false) }; @@ -355,7 +355,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_GREATER") { - static constexpr char* sample = "( ( { l } bf_greater { r } ) = F )."; + const char* sample = "( ( { l } bf_greater { r } ) = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); bindings bs; bs["l"] = { Bool(true) }; bs["r"] = { Bool(false) }; @@ -373,7 +373,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_EQ") { - static constexpr char* sample = "( { l } = F )."; + const char* sample = "( { l } = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); bindings bs; bs["l"] = { Bool(true) }; @@ -390,7 +390,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_NEQ") { - static constexpr char* sample = "( { l } != F )."; + const char* sample = "( { l } != F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); bindings bs; bs["l"] = { Bool(true) }; @@ -407,7 +407,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_IS_ONE") { - static constexpr char* sample = "( { l } = F )."; + const char* sample = "( { l } = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); bindings bs; bs["l"] = { Bool(true) }; @@ -425,7 +425,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_IS_ZERO") { - static constexpr char* sample = "( { l } = F )."; + const char* sample = "( { l } = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); bindings bs; bs["l"] = { Bool(false) }; @@ -443,7 +443,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_CLASHING_SUBFORMULAS_0") { - static constexpr char* sample = "( (T bf_and bf_neg T) = F )."; + const char* sample = "( (T bf_and bf_neg T) = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); auto rule_src = make_tau_source(BF_CALLBACK_CLASHING_SUBFORMULAS_0); @@ -459,7 +459,7 @@ TEST_SUITE("executing bf rules") { } TEST_CASE("BF_CALLBACK_HAS_SUBFORMULA_0") { - static constexpr char* sample = "( (T bf_and F) = F )."; + const char* sample = "( (T bf_and F) = F )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); auto rule_src = make_tau_source(BF_CALLBACK_HAS_SUBFORMULA_0); diff --git a/tests/test_rules-wff_execution.cpp b/tests/test_rules-wff_execution.cpp index ba23d6be..fefa1905 100644 --- a/tests/test_rules-wff_execution.cpp +++ b/tests/test_rules-wff_execution.cpp @@ -458,7 +458,7 @@ TEST_SUITE("executing wff rules") { } TEST_CASE("WFF_CALLBACK_CLASHING_SUBFORMULAS_0") { - static constexpr char* sample = "( T wff_and wff_neg T )."; + const char* sample = "( T wff_and wff_neg T )."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); auto rule_src = make_tau_source(WFF_CALLBACK_CLASHING_SUBFORMULAS_0); @@ -473,7 +473,7 @@ TEST_SUITE("executing wff rules") { } TEST_CASE("WFF_CALLBACK_HAS_SUBFORMULA_0") { - static constexpr char* sample = "(T wff_and T)."; + const char* sample = "(T wff_and T)."; auto sample_src = make_tau_source(sample); auto sample_statement = make_statement(sample_src); auto rule_src = make_tau_source(WFF_CALLBACK_HAS_SUBFORMULA_0); diff --git a/tests/test_tau_parser.cpp b/tests/test_tau_parser.cpp index 766049bb..594836c1 100644 --- a/tests/test_tau_parser.cpp +++ b/tests/test_tau_parser.cpp @@ -41,7 +41,7 @@ namespace testing = doctest; TEST_SUITE("parsing formula") { - static constexpr char* sample = + const char* sample = "?X := ?X." "?Y := ?Y." " ( ?Z = F ) ."; @@ -73,14 +73,14 @@ TEST_SUITE("parsing formula") { TEST_SUITE("parsing builders") { TEST_CASE("one capture") { - static constexpr char* sample = "( $X ) := ($X wff_and $X)."; + const char* sample = "( $X ) := ($X wff_and $X)."; auto src = make_builder(sample); CHECK( is_non_terminal(src.first) ); CHECK( is_non_terminal(src.second) ); } TEST_CASE("two capture") { - static constexpr char* sample = "( $X $Y ) := ($X wff_and $Y)."; + const char* sample = "( $X $Y ) := ($X wff_and $Y)."; auto src = make_builder(sample); auto left = src.first; auto right = src.first; @@ -91,7 +91,7 @@ TEST_SUITE("parsing builders") { TEST_SUITE("parsing library") { - static constexpr char* sample = + const char* sample = "?X := ?X." "?Y := ?Y."; auto src = make_tau_source(sample); @@ -147,7 +147,7 @@ TEST_SUITE("parsing indexes"){ TEST_SUITE("parsing wwf formulas ") { TEST_CASE("wff_neg") { - static constexpr char* sample = + const char* sample = "wff_neg ( ?Z = F )."; auto src = make_tau_source(sample); auto frml = make_statement(src); @@ -160,7 +160,7 @@ TEST_SUITE("parsing wwf formulas ") { } TEST_CASE("wff_and") { - static constexpr char* sample = + const char* sample = "(( ?Z = F ) wff_and ( ?X = F ))."; auto src = make_tau_source(sample); auto frml = make_statement(src); @@ -173,7 +173,7 @@ TEST_SUITE("parsing wwf formulas ") { } TEST_CASE("wff_or") { - static constexpr char* sample = + const char* sample = "(( ?Z = F ) wff_or ( ?X = F ))."; auto src = make_tau_source(sample); auto frml = make_statement(src); @@ -186,7 +186,7 @@ TEST_SUITE("parsing wwf formulas ") { } TEST_CASE("wff_xor") { - static constexpr char* sample = + const char* sample = "(( ?Z = F ) wff_xor ( ?X = F ))."; auto src = make_tau_source(sample); auto frml = make_statement(src); @@ -199,7 +199,7 @@ TEST_SUITE("parsing wwf formulas ") { } TEST_CASE("wff_eq") { - static constexpr char* sample = + const char* sample = "( ?Z = F )."; auto src = make_tau_source(sample); auto frml = make_statement(src); @@ -212,7 +212,7 @@ TEST_SUITE("parsing wwf formulas ") { } TEST_CASE("wff_imply") { - static constexpr char* sample = "($Z wff_imply $Z) := $Z."; + const char* sample = "($Z wff_imply $Z) := $Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto imply_rule = lib @@ -227,7 +227,7 @@ TEST_SUITE("parsing wwf formulas ") { } TEST_CASE("wff_coimply") { - static constexpr char* sample = "($Z wff_coimply $Z) := $Z."; + const char* sample = "($Z wff_coimply $Z) := $Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto coimply_rule = lib @@ -242,7 +242,7 @@ TEST_SUITE("parsing wwf formulas ") { } TEST_CASE("wff_equiv") { - static constexpr char* sample = "($Z wff_equiv $Z) := $Z."; + const char* sample = "($Z wff_equiv $Z) := $Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto equiv_rule = lib @@ -257,7 +257,7 @@ TEST_SUITE("parsing wwf formulas ") { } TEST_CASE("wff_all") { - static constexpr char* sample = + const char* sample = "wff_all ?Z ( ?Z = F ) ."; auto src = make_tau_source(sample); auto frml = make_statement(src); @@ -270,7 +270,7 @@ TEST_SUITE("parsing wwf formulas ") { } TEST_CASE("wff_ex") { - static constexpr char* sample = + const char* sample = "wff_ex ?Z ( ?Z = F ) ."; auto src = make_tau_source(sample); auto frml = make_statement(src); @@ -291,7 +291,7 @@ TEST_SUITE("parsing wwf formulas ") { TEST_SUITE("parsing bf formulas ") { TEST_CASE("bf_neg") { - static constexpr char* sample = "bf_neg ?Z := ?Z."; + const char* sample = "bf_neg ?Z := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto neg_rule = lib @@ -306,7 +306,7 @@ TEST_SUITE("parsing bf formulas ") { } TEST_CASE("bf_and") { - static constexpr char* sample = "(?Z bf_and ?Z) := ?Z."; + const char* sample = "(?Z bf_and ?Z) := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto and_rule = lib @@ -321,7 +321,7 @@ TEST_SUITE("parsing bf formulas ") { } TEST_CASE("bf_or") { - static constexpr char* sample = "(?Z bf_or ?Z) := ?Z."; + const char* sample = "(?Z bf_or ?Z) := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto or_rule = lib @@ -336,7 +336,7 @@ TEST_SUITE("parsing bf formulas ") { } TEST_CASE("bf_xor") { - static constexpr char* sample = "(?Z bf_xor ?Z) := ?Z."; + const char* sample = "(?Z bf_xor ?Z) := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto xor_rule = lib @@ -351,7 +351,7 @@ TEST_SUITE("parsing bf formulas ") { } TEST_CASE("bf_less") { - static constexpr char* sample = "(?Z bf_less ?Z) := ?Z."; + const char* sample = "(?Z bf_less ?Z) := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto less_rule = lib @@ -366,7 +366,7 @@ TEST_SUITE("parsing bf formulas ") { } TEST_CASE("bf_less_equal") { - static constexpr char* sample = "(?Z bf_less_equal ?Z) := ?Z."; + const char* sample = "(?Z bf_less_equal ?Z) := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto less_equal_rule = lib @@ -381,7 +381,7 @@ TEST_SUITE("parsing bf formulas ") { } TEST_CASE("bf_greater") { - static constexpr char* sample = "(?Z bf_greater ?Z) := ?Z."; + const char* sample = "(?Z bf_greater ?Z) := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto greater_rule = lib @@ -396,7 +396,7 @@ TEST_SUITE("parsing bf formulas ") { } TEST_CASE("bf_all") { - static constexpr char* sample = "bf_all ?Z $Z := ?Z."; + const char* sample = "bf_all ?Z $Z := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto all_rule = lib @@ -411,7 +411,7 @@ TEST_SUITE("parsing bf formulas ") { } TEST_CASE("bf_ex") { - static constexpr char* sample = "bf_ex ?Z $Z := $Z."; + const char* sample = "bf_ex ?Z $Z := $Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto ex_rule = lib @@ -434,7 +434,7 @@ TEST_SUITE("parsing bf formulas ") { TEST_SUITE("parsing bindings ") { TEST_CASE("named binding") { - static constexpr char* sample = "{ binding } := { binding }."; + const char* sample = "{ binding } := { binding }."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto named = lib @@ -452,7 +452,7 @@ TEST_SUITE("parsing bindings ") { } TEST_CASE("source binding") { - static constexpr char* sample = "{ type : binding } := { type : binding }."; + const char* sample = "{ type : binding } := { type : binding }."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto source = lib @@ -470,7 +470,7 @@ TEST_SUITE("parsing bindings ") { } TEST_CASE("source binding type") { - static constexpr char* sample = "{ type : binding } := { type : binding }."; + const char* sample = "{ type : binding } := { type : binding }."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto type = lib @@ -489,7 +489,7 @@ TEST_SUITE("parsing bindings ") { } TEST_CASE("source binding source") { - static constexpr char* sample = "{ type : binding } := { type : binding }."; + const char* sample = "{ type : binding } := { type : binding }."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto source = lib @@ -508,7 +508,7 @@ TEST_SUITE("parsing bindings ") { } TEST_CASE("unresolved source binding") { - static constexpr char* sample = "{ : binding } := { : binding }."; + const char* sample = "{ : binding } := { : binding }."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto type = lib @@ -528,7 +528,7 @@ TEST_SUITE("parsing bindings ") { } TEST_CASE("resolved source binding") { - static constexpr char* sample = "{ type : binding } := { type : binding }."; + const char* sample = "{ type : binding } := { type : binding }."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto type = lib @@ -551,7 +551,7 @@ TEST_SUITE("parsing bindings ") { TEST_SUITE("parsing callbacks ") { TEST_CASE("bf_and_cb") { - static constexpr char* sample = "$X := { $X bf_and_cb $X }."; + const char* sample = "$X := { $X bf_and_cb $X }."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto and_cb = lib @@ -568,7 +568,7 @@ TEST_SUITE("parsing callbacks ") { } TEST_CASE("bf_or_cb") { - static constexpr char* sample = "$X := { $X bf_or_cb $X }."; + const char* sample = "$X := { $X bf_or_cb $X }."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto or_cb = lib @@ -585,7 +585,7 @@ TEST_SUITE("parsing callbacks ") { } TEST_CASE("bf_xor_cb") { - static constexpr char* sample = "$X := { $X bf_xor_cb $X }."; + const char* sample = "$X := { $X bf_xor_cb $X }."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto xor_cb = lib @@ -602,7 +602,7 @@ TEST_SUITE("parsing callbacks ") { } TEST_CASE("bf_neg_cb") { - static constexpr char* sample = "$X := { bf_neg_cb $X }."; + const char* sample = "$X := { bf_neg_cb $X }."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto neg_cb = lib @@ -619,7 +619,7 @@ TEST_SUITE("parsing callbacks ") { } TEST_CASE("bf_subs_cb") { - static constexpr char* sample = "$X := bf_subs_cb $X $X $X."; + const char* sample = "$X := bf_subs_cb $X $X $X."; auto src = make_tau_source(sample); auto lib = make_statement(src); auto subs_cb = lib diff --git a/tests/test_traversal.cpp b/tests/test_traversal.cpp index 4968f383..a1b23c4f 100644 --- a/tests/test_traversal.cpp +++ b/tests/test_traversal.cpp @@ -30,19 +30,19 @@ namespace testing = doctest; TEST_SUITE("operator|") { TEST_CASE("match zero nodes") { - static constexpr char* sample = "(?Z bf_and ?Z) := ?Z."; + const char* sample = "(?Z bf_and ?Z) := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); - auto args = lib + auto args = lib | tau_parser::main; CHECK( !args ); } TEST_CASE("match one node") { - static constexpr char* sample = "(?Z bf_and ?Z) := ?Z."; + const char* sample = "(?Z bf_and ?Z) := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); - auto args = lib + auto args = lib | tau_parser::library | tau_parser::rules; CHECK( args ); @@ -52,38 +52,38 @@ TEST_SUITE("operator|") { TEST_SUITE("operator||") { TEST_CASE("match zero nodes") { - static constexpr char* sample = "(?Z bf_and ?Z) := ?Z."; + const char* sample = "(?Z bf_and ?Z) := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); - auto args = lib - | tau_parser::library - | tau_parser::rules - | tau_parser::rule + auto args = lib + | tau_parser::library + | tau_parser::rules + | tau_parser::rule | tau_parser::wff_rule || tau_parser::wff; CHECK( args.size() == 0 ); } TEST_CASE("match one node") { - static constexpr char* sample = "(?Z bf_and ?Z) := ?Z."; + const char* sample = "(?Z bf_and ?Z) := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); - auto args = lib - | tau_parser::library - | tau_parser::rules - | tau_parser::rule + auto args = lib + | tau_parser::library + | tau_parser::rules + | tau_parser::rule || tau_parser::bf_rule; CHECK( args.size() == 1 ); } TEST_CASE("match several nodes") { - static constexpr char* sample = "((?Z bf_and ?Z) bf_and (?Z bf_and ?Z)) := ?Z."; + const char* sample = "((?Z bf_and ?Z) bf_and (?Z bf_and ?Z)) := ?Z."; auto src = make_tau_source(sample); auto lib = make_statement(src); - auto args = lib - | tau_parser::library - | tau_parser::rules - | tau_parser::rule + auto args = lib + | tau_parser::library + | tau_parser::rules + | tau_parser::rule | tau_parser::bf_rule | tau_parser::bf_matcher | tau_parser::bf @@ -92,8 +92,8 @@ TEST_SUITE("operator||") { || tau_parser::bf_and || tau_parser::bf; CHECK( args.size() == 4 ); - CHECK( args[0] == args[1] ); - CHECK( args[0] == args[2] ); - CHECK( args[0] == args[3] ); + CHECK( args[0] == args[1] ); + CHECK( args[0] == args[2] ); + CHECK( args[0] == args[3] ); } } diff --git a/tests/test_type_system.cpp b/tests/test_type_system.cpp index 0771b358..ee1dbc31 100644 --- a/tests/test_type_system.cpp +++ b/tests/test_type_system.cpp @@ -28,12 +28,12 @@ namespace testing = doctest; TEST_SUITE("is_resolved_predicate") { TEST_CASE("is_resolved_predicate: true") { - static constexpr char* sample = "$X := { bool : src_code }."; + const char* sample = "$X := { bool : src_code }."; auto src = make_tau_source(sample); auto lib = make_statement(src); - auto type = lib - | tau_parser::library - | tau_parser::rules + auto type = lib + | tau_parser::library + | tau_parser::rules | tau_parser::rule | tau_parser::bf_rule | tau_parser::bf_body @@ -43,17 +43,17 @@ TEST_SUITE("is_resolved_predicate") { | tau_parser::binding | tau_parser::source_binding | tau_parser::type; - CHECK( type.has_value() ); - CHECK( is_resolved_predicate(type.value()) ); + CHECK( type.has_value() ); + CHECK( is_resolved_predicate(type.value()) ); } TEST_CASE("is_resolved_predicate: false") { - static constexpr char* sample = "$X := { : src_code }."; + const char* sample = "$X := { : src_code }."; auto src = make_tau_source(sample); auto lib = make_statement(src); - auto type = lib - | tau_parser::library - | tau_parser::rules + auto type = lib + | tau_parser::library + | tau_parser::rules | tau_parser::rule | tau_parser::bf_rule | tau_parser::bf_body @@ -63,20 +63,20 @@ TEST_SUITE("is_resolved_predicate") { | tau_parser::binding | tau_parser::source_binding | tau_parser::type; - CHECK( type.has_value() ); - CHECK( !is_resolved_predicate(type.value()) ); + CHECK( type.has_value() ); + CHECK( !is_resolved_predicate(type.value()) ); } } TEST_SUITE("is_unresolved_predicate") { TEST_CASE("is_resolved_predicate: true") { - static constexpr char* sample = "$X := { : src_code }."; + const char* sample = "$X := { : src_code }."; auto src = make_tau_source(sample); auto lib = make_statement(src); - auto type = lib - | tau_parser::library - | tau_parser::rules + auto type = lib + | tau_parser::library + | tau_parser::rules | tau_parser::rule | tau_parser::bf_rule | tau_parser::bf_body @@ -86,17 +86,17 @@ TEST_SUITE("is_unresolved_predicate") { | tau_parser::binding | tau_parser::source_binding | tau_parser::type; - CHECK( type.has_value() ); - CHECK( is_unresolved_predicate(type.value()) ); + CHECK( type.has_value() ); + CHECK( is_unresolved_predicate(type.value()) ); } TEST_CASE("is_unresolved_predicate: false") { - static constexpr char* sample = "$X := { bool : src_code }."; + const char* sample = "$X := { bool : src_code }."; auto src = make_tau_source(sample); auto lib = make_statement(src); - auto type = lib - | tau_parser::library - | tau_parser::rules + auto type = lib + | tau_parser::library + | tau_parser::rules | tau_parser::rule | tau_parser::bf_rule | tau_parser::bf_body @@ -106,58 +106,58 @@ TEST_SUITE("is_unresolved_predicate") { | tau_parser::binding | tau_parser::source_binding | tau_parser::type; - CHECK( type.has_value() ); - CHECK( !is_unresolved_predicate(type.value()) ); + CHECK( type.has_value() ); + CHECK( !is_unresolved_predicate(type.value()) ); } } TEST_SUITE("is_unresolved") { TEST_CASE("is_resolved_predicate: true") { - static constexpr char* sample = "$X := { : src_code }."; + const char* sample = "$X := { : src_code }."; auto src = make_tau_source(sample); auto lib = make_statement(src); - CHECK( is_unresolved(lib) ); + CHECK( is_unresolved(lib) ); } TEST_CASE("is_unresolved_predicate: false") { - static constexpr char* sample = "$X := { bool : src_code }."; + const char* sample = "$X := { bool : src_code }."; auto src = make_tau_source(sample); auto lib = make_statement(src); - CHECK( !is_unresolved(lib) ); + CHECK( !is_unresolved(lib) ); } } TEST_SUITE("resolve_type") { TEST_CASE("unresolved case") { - static constexpr char* sample = "$X := ({ : src_code } bf_and { bool : src_code })."; + const char* sample = "$X := ({ : src_code } bf_and { bool : src_code })."; auto src = make_tau_source(sample); auto lib = make_statement(src); - auto unresolved = lib - | tau_parser::library - | tau_parser::rules + auto unresolved = lib + | tau_parser::library + | tau_parser::rules | tau_parser::rule | tau_parser::bf_rule | tau_parser::bf_body | tau_parser::bf; auto result = resolve_type(unresolved.value()); - CHECK( result != unresolved.value() ); + CHECK( result != unresolved.value() ); CHECK( !is_unresolved(result) ); } TEST_CASE("resolved case") { - static constexpr char* sample = "$X := { bool : src_code }."; + const char* sample = "$X := { bool : src_code }."; auto src = make_tau_source(sample); auto lib = make_statement(src); - auto resolved = lib - | tau_parser::library - | tau_parser::rules + auto resolved = lib + | tau_parser::library + | tau_parser::rules | tau_parser::rule | tau_parser::bf_rule | tau_parser::bf_body | tau_parser::bf; auto result = resolve_type(resolved.value()); - CHECK( result == resolved.value() ); + CHECK( result == resolved.value() ); } } \ No newline at end of file