gpu/command_buffer/build_cmd_buffer_lib.py
def WriteGLES2ImplementationUnitTest(self, func, f):
    """Writes the GLES2 Implemention unit test."""
    client_test = func.GetInfo('client_test', True)
    if func.can_auto_generate and client_test:
      code = """
TEST_F(%(prefix)sImplementationTest, %(name)s) {
  struct Cmds {
    cmds::%(name)s cmd;
  };
  Cmds expected;
  expected.cmd.Init(%(cmd_args)s);

  gl_->%(name)s(%(args)s);
  EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
"""
      cmd_arg_strings = [
        arg.GetValidClientSideCmdArg(func) for arg in func.GetCmdArgs()
      ]

      gl_arg_strings = [
        arg.GetValidClientSideArg(func) for arg in func.GetOriginalArgs()
      ]

      f.write(code % {
            'prefix' : _prefix,
            'name': func.name,
            'args': ", ".join(gl_arg_strings),
            'cmd_args': ", ".join(cmd_arg_strings),
          })

      # Test constants for invalid values, as they are not tested by the
      # service.
      constants = [arg for arg in func.GetOriginalArgs() if arg.IsConstant()]
      if constants:
        code = """
TEST_F(%(prefix)sImplementationTest,
    %(name)sInvalidConstantArg%(invalid_index)d) {
  gl_->%(name)s(%(args)s);
  EXPECT_TRUE(NoCommandsWritten());
  EXPECT_EQ(%(gl_error)s, CheckError());
}
"""
        for invalid_arg in constants:
          gl_arg_strings = []
          invalid = invalid_arg.GetInvalidArg(func)
          for arg in func.GetOriginalArgs():
            if arg is invalid_arg:
              gl_arg_strings.append(invalid[0])
            else:
              gl_arg_strings.append(arg.GetValidClientSideArg(func))

          f.write(code % {
            'prefix' : _prefix,
            'name': func.name,
            'invalid_index': func.GetOriginalArgs().index(invalid_arg),
            'args': ", ".join(gl_arg_strings),
            'gl_error': invalid[2],
          })
Writes the GLES2 Implemention unit test.
Writes the GLES2 Implemention unit test.
Writes the GLES2 Implemention unit test .
def WriteGLES2ImplementationUnitTest(self, func, f):
    client_test = func.GetInfo('client_test', True)
    if func.can_auto_generate and client_test:
      code = """
TEST_F(%(prefix)sImplementationTest, %(name)s) {
  struct Cmds {
    cmds::%(name)s cmd;
  };
  Cmds expected;
  expected.cmd.Init(%(cmd_args)s);
  gl_->%(name)s(%(args)s);
  EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
"""
      cmd_arg_strings = [
        arg.GetValidClientSideCmdArg(func) for arg in func.GetCmdArgs()
      ]
      gl_arg_strings = [
        arg.GetValidClientSideArg(func) for arg in func.GetOriginalArgs()
      ]
      f.write(code % {
            'prefix' : _prefix,
            'name': func.name,
            'args': ", ".join(gl_arg_strings),
            'cmd_args': ", ".join(cmd_arg_strings),
          })
      constants = [arg for arg in func.GetOriginalArgs() if arg.IsConstant()]
      if constants:
        code = """
TEST_F(%(prefix)sImplementationTest,
    %(name)sInvalidConstantArg%(invalid_index)d) {
  gl_->%(name)s(%(args)s);
  EXPECT_TRUE(NoCommandsWritten());
  EXPECT_EQ(%(gl_error)s, CheckError());
}
"""
        for invalid_arg in constants:
          gl_arg_strings = []
          invalid = invalid_arg.GetInvalidArg(func)
          for arg in func.GetOriginalArgs():
            if arg is invalid_arg:
              gl_arg_strings.append(invalid[0])
            else:
              gl_arg_strings.append(arg.GetValidClientSideArg(func))
          f.write(code % {
            'prefix' : _prefix,
            'name': func.name,
            'invalid_index': func.GetOriginalArgs().index(invalid_arg),
            'args': ", ".join(gl_arg_strings),
            'gl_error': invalid[2],
          })
def WriteGLES2ImplementationUnitTest ( self , func , f ) : client_test = func . GetInfo ( 'client_test' , True ) if func . can_auto_generate and client_test : code = """
TEST_F(%(prefix)sImplementationTest, %(name)s) {
  struct Cmds {
    cmds::%(name)s cmd;
  };
  Cmds expected;
  expected.cmd.Init(%(cmd_args)s);

  gl_->%(name)s(%(args)s);
  EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
""" cmd_arg_strings = [ arg . GetValidClientSideCmdArg ( func ) for arg in func . GetCmdArgs ( ) ] gl_arg_strings = [ arg . GetValidClientSideArg ( func ) for arg in func . GetOriginalArgs ( ) ] f . write ( code % { 'prefix' : _prefix , 'name' : func . name , 'args' : ", " . join ( gl_arg_strings ) , 'cmd_args' : ", " . join ( cmd_arg_strings ) , } ) constants = [ arg for arg in func . GetOriginalArgs ( ) if arg . IsConstant ( ) ] if constants : code = """
TEST_F(%(prefix)sImplementationTest,
    %(name)sInvalidConstantArg%(invalid_index)d) {
  gl_->%(name)s(%(args)s);
  EXPECT_TRUE(NoCommandsWritten());
  EXPECT_EQ(%(gl_error)s, CheckError());
}
""" for invalid_arg in constants : gl_arg_strings = [ ] invalid = invalid_arg . GetInvalidArg ( func ) for arg in func . GetOriginalArgs ( ) : if arg is invalid_arg : gl_arg_strings . append ( invalid [ 0 ] ) else : gl_arg_strings . append ( arg . GetValidClientSideArg ( func ) ) f . write ( code % { 'prefix' : _prefix , 'name' : func . name , 'invalid_index' : func . GetOriginalArgs ( ) . index ( invalid_arg ) , 'args' : ", " . join ( gl_arg_strings ) , 'gl_error' : invalid [ 2 ] , } )
Writes the GLES2 Implemention unit test.
Writes the GLES2 Implemention unit test .
"""Writes the GLES2 Implemention unit test.""" # Test constants for invalid values, as they are not tested by the # service.
self
func
f