diff --git a/src/bin/eolian_mono/eolian/mono/generation_contexts.hh b/src/bin/eolian_mono/eolian/mono/generation_contexts.hh index 462076926c..f7376f056a 100644 --- a/src/bin/eolian_mono/eolian/mono/generation_contexts.hh +++ b/src/bin/eolian_mono/eolian/mono/generation_contexts.hh @@ -16,6 +16,8 @@ #ifndef EOLIAN_MONO_GENERATION_CONTEXTS_HH #define EOLIAN_MONO_GENERATION_CONTEXTS_HH +#include + #include "grammar/context.hpp" #include "grammar/indentation.hpp" diff --git a/src/bin/eolian_mono/eolian/mono/name_helpers.hh b/src/bin/eolian_mono/eolian/mono/name_helpers.hh index a3ffe47a3b..867b832444 100644 --- a/src/bin/eolian_mono/eolian/mono/name_helpers.hh +++ b/src/bin/eolian_mono/eolian/mono/name_helpers.hh @@ -22,6 +22,7 @@ #include #include #include +#include #include "utils.hh" #include "grammar/integral.hpp" diff --git a/src/bin/eolian_mono/eolian/mono/utils.hh b/src/bin/eolian_mono/eolian/mono/utils.hh index 6eea0bd4d1..d942903aba 100644 --- a/src/bin/eolian_mono/eolian/mono/utils.hh +++ b/src/bin/eolian_mono/eolian/mono/utils.hh @@ -98,7 +98,7 @@ namespace eolian_mono { namespace utils { inline bool ends_with(std::string const& source, std::string suffix) { - if (source.size() > suffix.size()) + if (source.size() >= suffix.size()) return (0 == source.compare(source.size() - suffix.size(), suffix.size(), suffix)); else return false; diff --git a/src/lib/eolian_cxx/grammar/string.hpp b/src/lib/eolian_cxx/grammar/string.hpp index fbbf1ecaab..71530af9ca 100644 --- a/src/lib/eolian_cxx/grammar/string.hpp +++ b/src/lib/eolian_cxx/grammar/string.hpp @@ -18,6 +18,8 @@ #include #include +#include + #include "grammar/generator.hpp" #include "grammar/attributes.hpp" diff --git a/src/lib/eolian_cxx/grammar/type_traits.hpp b/src/lib/eolian_cxx/grammar/type_traits.hpp index 1c320cd1d3..4c6fa926ea 100644 --- a/src/lib/eolian_cxx/grammar/type_traits.hpp +++ b/src/lib/eolian_cxx/grammar/type_traits.hpp @@ -16,6 +16,8 @@ #ifndef EOLIAN_CXX_TYPE_TRAITS_HH #define EOLIAN_CXX_TYPE_TRAITS_HH +#include + namespace efl { namespace eolian { namespace grammar { namespace type_traits { template diff --git a/src/tests/efl_mono/eolian_mono_suite.cc b/src/tests/efl_mono/eolian_mono_suite.cc new file mode 100644 index 0000000000..b5ee732a25 --- /dev/null +++ b/src/tests/efl_mono/eolian_mono_suite.cc @@ -0,0 +1,61 @@ +/* + * Copyright 2019 by its authors. See AUTHORS. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "../../bin/eolian_mono/eolian/mono/utils.hh" + +#include +#include "../efl_check.h" + + + +EFL_START_TEST(eolian_mono_test_util_ends_with) +{ + ck_assert(eolian_mono::utils::ends_with("SomeFlags", "Flags")); + ck_assert(eolian_mono::utils::ends_with("Flags", "Flags")); + ck_assert(!eolian_mono::utils::ends_with("Flagz", "Flags")); + ck_assert(!eolian_mono::utils::ends_with("FlagsSome", "Flags")); +} +EFL_END_TEST + +void +eolian_mono_utils_test(TCase* tc) +{ + tcase_add_test(tc, eolian_mono_test_util_ends_with); +} + +static const Efl_Test_Case etc[] = { + { "Eolian mono utils", eolian_mono_utils_test }, + { NULL, NULL } +}; + +int main(int argc, char *argv[]) +{ + int failed_count; + + if (!_efl_test_option_disp(argc, argv, etc)) + return 0; + + putenv(const_cast("EFL_RUN_IN_TREE=1")); + + failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1, + "Eolian C++", etc, NULL, NULL); + + return (failed_count == 0) ? 0 : 255; +} diff --git a/src/tests/efl_mono/meson.build b/src/tests/efl_mono/meson.build index 4ab4cffae5..695ff07ec8 100644 --- a/src/tests/efl_mono/meson.build +++ b/src/tests/efl_mono/meson.build @@ -174,3 +174,14 @@ else env : env_mono ) endif + +eolian_mono_helpers_suite = executable('eolian-mono-suite', + ['eolian_mono_suite.cc'], + include_directories : config_dir, + dependencies: [check, eolian_cxx, eina_cxx], + cpp_args : package_c_args + [ + '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"', + '-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"'] +) + +test('eolian-mono-suite', eolian_mono_helpers_suite)