summaryrefslogtreecommitdiff
path: root/src/tests/eolian_cxx/eolian_cxx_test_generate.cc
blob: 11c24476238cedee9c7adec898da42f2125d196f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * 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);
}