summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Lira <larry@expertisesolutions.com.br>2018-09-20 16:37:28 -0300
committerLarry Lira <larry@expertisesolutions.com.br>2018-09-20 16:37:28 -0300
commit2d61bc9c6a9ac8d5b5b710c81100dbfc43990eb7 (patch)
tree94516c871c6da75816a2c8c7002fe4b5733d653a
parent4af27ffd9da448333309baa6817f042815d9e305 (diff)
testgen: added function list modedevs/felipealmeida/tct
- fixed has_getter/setter filter - added function list mode to test all inherited or only implemented functions
-rw-r--r--src/scripts/testgen/ekeys.py6
-rw-r--r--src/scripts/testgen/suitegen.py50
2 files changed, 43 insertions, 13 deletions
diff --git a/src/scripts/testgen/ekeys.py b/src/scripts/testgen/ekeys.py
index 6dfa906370..eeff4c4503 100644
--- a/src/scripts/testgen/ekeys.py
+++ b/src/scripts/testgen/ekeys.py
@@ -1,6 +1,11 @@
1#!/usr/bin/env python3 1#!/usr/bin/env python3
2# encoding: utf-8 2# encoding: utf-8
3 3
4class Function_List_Type:
5 INHERITIS = 1
6 INHERITIS_FULL = 2
7 CLASS_IMPLEMENTS = 3
8 CLASS_ONLY = 4
4 9
5class EKeys: 10class EKeys:
6 def __init__(self, ext): 11 def __init__(self, ext):
@@ -10,6 +15,7 @@ class EKeys:
10 self.verbs = [] 15 self.verbs = []
11 self.blacklist = [] 16 self.blacklist = []
12 self.keyloads = ["init", "shutdown", "custom"] 17 self.keyloads = ["init", "shutdown", "custom"]
18 self.funclist = Function_List_Type.CLASS_IMPLEMENTS
13 19
14 def type_convert(self, eotype): 20 def type_convert(self, eotype):
15 return eotype.name 21 return eotype.name
diff --git a/src/scripts/testgen/suitegen.py b/src/scripts/testgen/suitegen.py
index 83458e0a0b..a8e3c56126 100644
--- a/src/scripts/testgen/suitegen.py
+++ b/src/scripts/testgen/suitegen.py
@@ -1,6 +1,7 @@
1import itertools 1import itertools
2import os 2import os
3from testgen.ekeys import GetKey 3from pyolian.eolian import Eolian_Function_Type, Eolian_Class_Type
4from .ekeys import GetKey, Function_List_Type
4 5
5 6
6class BaseItem: 7class BaseItem:
@@ -34,13 +35,17 @@ class ComItem(BaseItem):
34class FuncItem(ComItem): 35class FuncItem(ComItem):
35 def __init__(self, comp, path, keys): 36 def __init__(self, comp, path, keys):
36 super().__init__(comp, os.path.join(path, comp.name), keys) 37 super().__init__(comp, os.path.join(path, comp.name), keys)
37 has = ( 38
38 lambda f, p, s, bl: f.getter_scope == f.getter_scope.PUBLIC 39 self.has_getter = (
39 and f.full_c_getter_name not in bl 40 comp.type in (Eolian_Function_Type.PROP_GET, Eolian_Function_Type.PROPERTY)
40 and not os.path.isfile("{}_{}".format(os.path.join(p, f.name), s)) 41 and comp.full_c_getter_name not in keys.blacklist
42 and not os.path.isfile("{}_get".format(os.path.join(path, comp.name)))
43 )
44 self.has_setter = (
45 comp.type in (Eolian_Function_Type.PROP_SET, Eolian_Function_Type.PROPERTY)
46 and comp.full_c_setter_name not in keys.blacklist
47 and not os.path.isfile("{}_set".format(os.path.join(path, comp.name)))
41 ) 48 )
42 self.has_getter = has(comp, path, "get", keys.blacklist)
43 self.has_setter = has(comp, path, "set", keys.blacklist)
44 49
45 @property 50 @property
46 def format_name(self): 51 def format_name(self):
@@ -67,11 +72,30 @@ class ClassItem(ComItem):
67 FuncItem(p, self.path, keys) for p in filter(mfilter, self.comp.properties) 72 FuncItem(p, self.path, keys) for p in filter(mfilter, self.comp.properties)
68 ] 73 ]
69 74
70 for eoclass in comp.inherits_full: 75 if self.keys.funclist in (
71 for f in filter(mfilter, eoclass.methods): 76 Function_List_Type.INHERITIS,
72 self.methods.append(FuncItem(f, self.path, keys)) 77 Function_List_Type.INHERITIS_FULL,
73 for f in filter(mfilter, eoclass.properties): 78 ):
74 self._properties.append(FuncItem(f, self.path, keys)) 79 for eoclass in (
80 eoclass.inherits
81 if self.keys.funclist == Function_List_Type.INHERITIS
82 else eoclass.inherits_full
83 ):
84 for f in filter(mfilter, eoclass.methods):
85 self.methods.append(FuncItem(f, self.path, keys))
86 for f in filter(mfilter, eoclass.properties):
87 self._properties.append(FuncItem(f, self.path, keys))
88 elif self.keys.funclist == Function_List_Type.CLASS_IMPLEMENTS:
89 for imp in comp.implements:
90 f = imp.function
91 if f.type == Eolian_Function_Type.METHOD and mfilter(f):
92 self.methods.append(FuncItem(f, self.path, keys))
93 if f.type in (
94 Eolian_Function_Type.PROPERTY,
95 Eolian_Function_Type.PROP_GET,
96 Eolian_Function_Type.PROP_SET,
97 ) and mfilter(f):
98 self._properties.append(FuncItem(f, self.path, keys))
75 99
76 @property 100 @property
77 def properties(self): 101 def properties(self):
@@ -119,7 +143,7 @@ class SuiteGen(BaseItem):
119 self.clslist.clear() 143 self.clslist.clear()
120 for eofile in eofiles: 144 for eofile in eofiles:
121 eocls = eolian_db.class_by_file_get(os.path.basename(eofile)) 145 eocls = eolian_db.class_by_file_get(os.path.basename(eofile))
122 if not eocls or eocls.type != eocls.type.REGULAR: 146 if not eocls or eocls.type != Eolian_Class_Type.REGULAR:
123 continue 147 continue
124 self.loadObj(eocls) 148 self.loadObj(eocls)
125 149