Exemplo n.º 1
0
 def __str__(self):
   """
   Print the java code of this class.
   """
   return self.TEST_CLASS_TEMPLATE.format(copyright = get_copyright('java'),
                                          iface_name = self.iface.get_name(),
                                          tree = self.get_tree(),
                                          class_name = self.class_name)
Exemplo n.º 2
0
 def __str__(self):
   """
   Print the java code for this class.
   """
   j_ifaces = ', '.join(map(lambda a: a.get_name(), self.ifaces))
   touches  = '\n'.join(map(lambda a: self.TOUCH_CALL_TEMPLATE.format(class_name = self.class_name,
                                                                      iface_name = a.get_name()),
                            self.get_all_interfaces()))
   return self.TEST_CLASS_TEMPLATE.format(copyright = get_copyright('java'),
                                          ifaces = j_ifaces,
                                          class_name = self.class_name,
                                          touch_calls = touches)
Exemplo n.º 3
0
  def __str__(self):
    """
    Print the MainClass Java code.
    """
    all_tests = sorted(self.tests)
    test_groups = ""
    for t in all_tests:
      test_groups += str(t)
    main_func = self.MAIN_FUNCTION_TEMPLATE

    return self.MAIN_CLASS_TEMPLATE.format(copyright = get_copyright("java"),
                                           main_func = main_func,
                                           test_groups = test_groups)
Exemplo n.º 4
0
 def __str__(self):
   """
   Print the java code for this interface.
   """
   j_ifaces = ', '.join(map(lambda a: a.get_name(), self.ifaces))
   if self.default:
     funcs = self.DEFAULT_FUNC_TEMPLATE.format(class_name = self.class_name)
   else:
     funcs = ""
   return self.TEST_INTERFACE_TEMPLATE.format(copyright = get_copyright('java'),
                                              extends = "extends" if len(self.ifaces) else "",
                                              ifaces = j_ifaces,
                                              funcs = funcs,
                                              tree = self.get_tree(),
                                              class_name = self.class_name)
Exemplo n.º 5
0
 def __str__(self):
   """
   Print the smali code for this class.
   """
   s_ifaces = '\n'.join(map(lambda a: self.IMPLEMENTS_TEMPLATE.format(iface_name = a.get_name()),
                            self.ifaces))
   j_ifaces = ', '.join(map(lambda a: a.get_name(), self.ifaces))
   touches  = '\n'.join(map(lambda a: self.TOUCH_CALL_TEMPLATE.format(class_name = self.class_name,
                                                                      iface_name = a.get_name()),
                            self.get_all_interfaces()))
   return self.TEST_CLASS_TEMPLATE.format(copyright = get_copyright('smali'),
                                          implements_spec = s_ifaces,
                                          ifaces = j_ifaces,
                                          class_name = self.class_name,
                                          touch_calls = touches)
Exemplo n.º 6
0
  def __str__(self):
    """
    Print the MainClass smali code.
    """
    all_tests = sorted(self.tests)
    test_invoke = ""
    test_funcs = ""
    for t in all_tests:
      test_funcs += str(t)
    for t in all_tests:
      test_invoke += self.TEST_GROUP_INVOKE_TEMPLATE.format(test_name=t.get_name())
    main_func = self.MAIN_FUNCTION_TEMPLATE.format(test_group_invoke=test_invoke)

    return self.MAIN_CLASS_TEMPLATE.format(copyright = get_copyright("smali"),
                                           test_funcs = test_funcs,
                                           main_func = main_func)
Exemplo n.º 7
0
 def __str__(self):
   """
   Print the smali code for this interface.
   """
   s_ifaces = '\n'.join(map(lambda a: self.IMPLEMENTS_TEMPLATE.format(iface_name = a.get_name()),
                            self.ifaces))
   j_ifaces = ', '.join(map(lambda a: a.get_name(), self.ifaces))
   if self.default:
     funcs = self.DEFAULT_FUNC_TEMPLATE.format(class_name = self.class_name)
   else:
     funcs = self.ABSTRACT_FUNC_TEMPLATE
   return self.TEST_INTERFACE_TEMPLATE.format(copyright = get_copyright('smali'),
                                              implements_spec = s_ifaces,
                                              extends = "extends" if len(self.ifaces) else "",
                                              ifaces = j_ifaces,
                                              funcs = funcs,
                                              class_name = self.class_name)
Exemplo n.º 8
0
 def __str__(self):
   """
   Print the smali code of this class.
   """
   s_ifaces = '\n'.join(map(lambda a: self.IMPLEMENTS_TEMPLATE.format(iface_name = a.get_name()),
                            self.ifaces))
   j_ifaces = ', '.join(map(lambda a: a.get_name(), self.ifaces))
   super_template = self.SUPER_CALL_TEMPLATE
   super_calls = "\n".join(super_template.format(iface_name = iface.get_name(),
                                                 class_name = self.get_name(),
                                                 tree = self.get_tree()) for iface in self.ifaces)
   return self.TEST_CLASS_TEMPLATE.format(copyright = get_copyright('smali'),
                                          ifaces = j_ifaces,
                                          implements_spec = s_ifaces,
                                          tree = self.get_tree(),
                                          class_name = self.class_name,
                                          super_calls = super_calls)
Exemplo n.º 9
0
 def __str__(self):
   """
   Print the smali code for this class.
   """
   funcs = '\n'.join(map(lambda a: self.TEST_FUNC_TEMPLATE.format(iface = a.get_name(),
                                                                  class_name = self.get_name()),
                         self.ifaces))
   calls = '\n'.join(map(lambda a: self.TEST_CALL_TEMPLATE.format(iface = a.get_name(),
                                                                  class_name = self.get_name()),
                         self.ifaces))
   s_ifaces = '\n'.join(map(lambda a: self.IMPLEMENTS_TEMPLATE.format(iface_name = a.get_name()),
                            self.ifaces))
   j_ifaces = ', '.join(map(lambda a: a.get_name(), self.ifaces))
   return self.TEST_CLASS_TEMPLATE.format(copyright = get_copyright('smali'),
                                          implements_spec = s_ifaces,
                                          ifaces = j_ifaces,
                                          class_name = self.class_name,
                                          test_funcs = funcs,
                                          test_calls = calls)
Exemplo n.º 10
0
  def __str__(self):
    """
    Print this class
    """
    all_tests = sorted(self.tests)
    test_invoke = ""
    test_groups = ""
    for t in all_tests:
      test_groups += str(t)
    for t in sorted(all_tests):
      test_invoke += self.TEST_GROUP_INVOKE_TEMPLATE.format(test_name=t.get_name())
    main_func = self.MAIN_FUNCTION_TEMPLATE.format(test_group_invoke=test_invoke)

    funcs = ""
    for f in self.global_funcs:
      funcs += str(f)
    return self.MAIN_CLASS_TEMPLATE.format(copyright = get_copyright('smali'),
                                           test_groups=test_groups,
                                           main_func=main_func, test_funcs=funcs)
Exemplo n.º 11
0
    def __str__(self):
        """
    Print the MainClass smali code.
    """
        all_tests = sorted(self.tests)
        test_invoke = ""
        test_funcs = ""
        for t in all_tests:
            test_funcs += str(t)
        for t in all_tests:
            test_invoke += self.TEST_GROUP_INVOKE_TEMPLATE.format(
                test_name=t.get_name())
        main_func = self.MAIN_FUNCTION_TEMPLATE.format(
            test_group_invoke=test_invoke)

        return self.MAIN_CLASS_TEMPLATE.format(
            copyright=get_copyright("smali"),
            test_funcs=test_funcs,
            main_func=main_func)
Exemplo n.º 12
0
 def __str__(self):
     """
 Print the smali code for this class.
 """
     s_ifaces = '\n'.join(
         map(
             lambda a: self.IMPLEMENTS_TEMPLATE.format(
                 iface_name=a.get_name()), self.ifaces))
     j_ifaces = ', '.join(map(lambda a: a.get_name(), self.ifaces))
     touches = '\n'.join(
         map(
             lambda a: self.TOUCH_CALL_TEMPLATE.format(
                 class_name=self.class_name, iface_name=a.get_name()),
             self.get_all_interfaces()))
     return self.TEST_CLASS_TEMPLATE.format(
         copyright=get_copyright('smali'),
         implements_spec=s_ifaces,
         ifaces=j_ifaces,
         class_name=self.class_name,
         touch_calls=touches)
Exemplo n.º 13
0
 def __str__(self):
   """
   Print the java code of this interface.
   """
   j_ifaces = " "
   for i in self.ifaces:
     j_ifaces += " {},".format(i.get_name())
   j_ifaces = j_ifaces[0:-1]
   if self.default:
     funcs = self.DEFAULT_FUNC_TEMPLATE.format(ifaces = j_ifaces,
                                               tree = self.get_tree(),
                                               class_name = self.class_name)
   else:
     funcs = ""
   return self.TEST_INTERFACE_TEMPLATE.format(copyright = get_copyright('java'),
                                              extends = "extends" if len(self.ifaces) else "",
                                              ifaces = j_ifaces,
                                              funcs = funcs,
                                              tree = self.get_tree(),
                                              class_name = self.class_name)
Exemplo n.º 14
0
 def __str__(self):
     """
 Print the smali code for this interface.
 """
     s_ifaces = '\n'.join(
         map(
             lambda a: self.IMPLEMENTS_TEMPLATE.format(
                 iface_name=a.get_name()), self.ifaces))
     j_ifaces = ', '.join(map(lambda a: a.get_name(), self.ifaces))
     if self.default:
         funcs = self.DEFAULT_FUNC_TEMPLATE.format(
             class_name=self.class_name)
     else:
         funcs = self.ABSTRACT_FUNC_TEMPLATE
     return self.TEST_INTERFACE_TEMPLATE.format(
         copyright=get_copyright('smali'),
         implements_spec=s_ifaces,
         extends="extends" if len(self.ifaces) else "",
         ifaces=j_ifaces,
         funcs=funcs,
         class_name=self.class_name)
Exemplo n.º 15
0
 def __str__(self):
     """
 Print the java code of this interface.
 """
     j_ifaces = " "
     for i in self.ifaces:
         j_ifaces += " {},".format(i.get_name())
     j_ifaces = j_ifaces[0:-1]
     if self.default:
         funcs = self.DEFAULT_FUNC_TEMPLATE.format(
             ifaces=j_ifaces,
             tree=self.get_tree(),
             class_name=self.class_name)
     else:
         funcs = ""
     return self.TEST_INTERFACE_TEMPLATE.format(
         copyright=get_copyright('java'),
         extends="extends" if len(self.ifaces) else "",
         ifaces=j_ifaces,
         funcs=funcs,
         tree=self.get_tree(),
         class_name=self.class_name)
Exemplo n.º 16
0
    def __str__(self):
        """
    Print this class
    """
        all_tests = sorted(self.tests)
        test_invoke = ""
        test_groups = ""
        for t in all_tests:
            test_groups += str(t)
        for t in sorted(all_tests):
            test_invoke += self.TEST_GROUP_INVOKE_TEMPLATE.format(
                test_name=t.get_name())
        main_func = self.MAIN_FUNCTION_TEMPLATE.format(
            test_group_invoke=test_invoke)

        funcs = ""
        for f in self.global_funcs:
            funcs += str(f)
        return self.MAIN_CLASS_TEMPLATE.format(copyright=get_copyright('java'),
                                               test_groups=test_groups,
                                               main_func=main_func,
                                               test_funcs=funcs)
Exemplo n.º 17
0
 def __str__(self):
   """
   Print the smali code of this interface.
   """
   s_ifaces = " "
   j_ifaces = " "
   for i in self.ifaces:
     s_ifaces += self.IMPLEMENTS_TEMPLATE.format(iface_name = i.get_name())
     j_ifaces += " {},".format(i.get_name())
   j_ifaces = j_ifaces[0:-1]
   if self.is_default():
     funcs = self.DEFAULT_FUNC_TEMPLATE.format(tree = self.get_tree())
   elif self.is_abstract():
     funcs = self.ABSTRACT_FUNC_TEMPLATE.format()
   else:
     funcs = ""
   return self.TEST_INTERFACE_TEMPLATE.format(copyright = get_copyright('smali'),
                                              implements_spec = s_ifaces,
                                              extends = "extends" if len(self.ifaces) else "",
                                              ifaces = j_ifaces,
                                              funcs = funcs,
                                              tree = self.get_tree(),
                                              class_name = self.class_name)
Exemplo n.º 18
0
 def __str__(self):
   """
   Print the smali code of this interface.
   """
   s_ifaces = '\n'.join(map(lambda a: self.IMPLEMENTS_TEMPLATE.format(iface_name = a.get_name()),
                            self.ifaces))
   j_ifaces = ', '.join(map(lambda a: a.get_name(), self.ifaces))
   if self.is_default():
     super_template = self.SUPER_CALL_TEMPLATE
     super_calls ="\n".join(super_template.format(iface_name = iface.get_name(),
                                                  class_name = self.get_name(),
                                                  tree = self.get_tree()) for iface in self.ifaces)
     funcs = self.DEFAULT_FUNC_TEMPLATE.format(super_calls = super_calls)
   elif self.is_abstract():
     funcs = self.ABSTRACT_FUNC_TEMPLATE.format()
   else:
     funcs = ""
   return self.TEST_INTERFACE_TEMPLATE.format(copyright = get_copyright('smali'),
                                              implements_spec = s_ifaces,
                                              extends = "extends" if len(self.ifaces) else "",
                                              ifaces = j_ifaces,
                                              func = funcs,
                                              tree = self.get_tree(),
                                              class_name = self.class_name)