efl/src/tests/eolian_cxx/eolian_cxx_test_generate.cc

91 lines
3.4 KiB
C++

/*
* 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 <config.h>
#endif
#include <iostream>
#include <cassert>
#include <iterator>
#include "eolian_cxx_suite.h"
#include <grammar/header.hpp>
EFL_START_TEST(eolian_cxx_test_generate_complex_types)
{
using efl::eolian::grammar::class_header;
using efl::eolian::grammar::attributes::unused_type;
using efl::eolian::grammar::attributes::regular_type_def;
using efl::eolian::grammar::attributes::klass_name;
using efl::eolian::grammar::attributes::complex_type_def;
using efl::eolian::grammar::attributes::parameter_direction;
using efl::eolian::grammar::attributes::qualifier_info;
using efl::eolian::grammar::context_null;;
// efl::eolian::grammar::attributes::klass_def my_class
// {
// "Class_Name", "Class_Name", {"Namespace1", "Namesapce2"}
// , {
// {{regular_type_def{"int", {qualifier_info::is_none, {}}, {}}}
// , "function_name"
// , {
// {parameter_direction::in, {regular_type_def{"unsigned", {qualifier_info::is_none, {}}, {}}}, "param1", ""}
// , {parameter_direction::out, {klass_name{{"Namespace1","Namesapce2"}, "Class_Name",
// {qualifier_info::is_none, {}}, {}, {}}}
// , "param2", ""}
// , {parameter_direction::inout, {complex_type_def
// {{
// {regular_type_def{"list", {qualifier_info::is_none, {}}, {}}}
// , {regular_type_def{"int", {qualifier_info::is_none, {}}, {}}}
// }}}
// , "param3", ""}
// }
// }
// }
// , {}
// , {}
// };
// std::tuple<std::string, std::vector<std::string>
// , std::vector<std::string>, std::vector<efl::eolian::grammar::attributes::klass_def>
// , std::vector<efl::eolian::grammar::attributes::klass_def>
// , std::vector<efl::eolian::grammar::attributes::klass_def>> attributes
// {"GUARD_HEADER_HH", {"abc.h", "def.h"}, {"abc.hh", "def.hh"}, {my_class}, {my_class}, {my_class}};
// std::vector<char> buffer;
// class_header.generate(std::back_inserter<std::vector<char>>(buffer), attributes, context_null());
// const char result[] =
// "#ifndef GUARD_HEADER_HH\n"
// "#define GUARD_HEADER_HH\n"
// "#endif\n"
// ;
// std::cout << "Beginning of generated file" << std::endl;
// std::copy(buffer.begin(), buffer.end(), std::ostream_iterator<char>(std::cout));
// std::cout << "\n End of generated file" << std::endl;
// ck_assert(buffer.size() == (sizeof(result) - 1));
// ck_assert(std::equal(buffer.begin(), buffer.end(), result));
}
EFL_END_TEST
void
eolian_cxx_test_generate(TCase* tc)
{
tcase_add_test(tc, eolian_cxx_test_generate_complex_types);
}