gpu/command_buffer/build_cmd_buffer_lib.py
def WriteFormatTest(self, func, f):
    """Writes a format test for a command."""
    f.write("TEST_F(%sFormatTest, %s) {\n" % (_prefix, func.name))
    f.write("  cmds::%s& cmd = *GetBufferAs<cmds::%s>();\n" %
               (func.name, func.name))
    f.write("  void* next_cmd = cmd.Set(\n")
    f.write("      &cmd")
    args = func.GetCmdArgs()
    for value, arg in enumerate(args):
      f.write(",\n      static_cast<%s>(%d)" % (arg.type, value + 11))
    f.write(");\n")
    f.write("  EXPECT_EQ(static_cast<uint32_t>(cmds::%s::kCmdId),\n" %
               func.name)
    f.write("            cmd.header.command);\n")
    func.type_handler.WriteCmdSizeTest(func, f)
    for value, arg in enumerate(args):
      f.write("  EXPECT_EQ(static_cast<%s>(%d), %s);\n" %
                 (arg.type, value + 11, arg.GetArgAccessor('cmd')))
    f.write("  CheckBytesWrittenMatchesExpectedSize(\n")
    f.write("      next_cmd, sizeof(cmd));\n")
    f.write("}\n")
    f.write("\n")
Writes a format test for a command.
Writes a format test for a command.
Writes a format test for a command .
def WriteFormatTest(self, func, f):
    f.write("TEST_F(%sFormatTest, %s) {\n" % (_prefix, func.name))
    f.write("  cmds::%s& cmd = *GetBufferAs<cmds::%s>();\n" %
               (func.name, func.name))
    f.write("  void* next_cmd = cmd.Set(\n")
    f.write("      &cmd")
    args = func.GetCmdArgs()
    for value, arg in enumerate(args):
      f.write(",\n      static_cast<%s>(%d)" % (arg.type, value + 11))
    f.write(");\n")
    f.write("  EXPECT_EQ(static_cast<uint32_t>(cmds::%s::kCmdId),\n" %
               func.name)
    f.write("            cmd.header.command);\n")
    func.type_handler.WriteCmdSizeTest(func, f)
    for value, arg in enumerate(args):
      f.write("  EXPECT_EQ(static_cast<%s>(%d), %s);\n" %
                 (arg.type, value + 11, arg.GetArgAccessor('cmd')))
    f.write("  CheckBytesWrittenMatchesExpectedSize(\n")
    f.write("      next_cmd, sizeof(cmd));\n")
    f.write("}\n")
    f.write("\n")
def WriteFormatTest ( self , func , f ) : f . write ( "TEST_F(%sFormatTest, %s) {\n" % ( _prefix , func . name ) ) f . write ( "  cmds::%s& cmd = *GetBufferAs<cmds::%s>();\n" % ( func . name , func . name ) ) f . write ( "  void* next_cmd = cmd.Set(\n" ) f . write ( "      &cmd" ) args = func . GetCmdArgs ( ) for value , arg in enumerate ( args ) : f . write ( ",\n      static_cast<%s>(%d)" % ( arg . type , value + 11 ) ) f . write ( ");\n" ) f . write ( "  EXPECT_EQ(static_cast<uint32_t>(cmds::%s::kCmdId),\n" % func . name ) f . write ( "            cmd.header.command);\n" ) func . type_handler . WriteCmdSizeTest ( func , f ) for value , arg in enumerate ( args ) : f . write ( "  EXPECT_EQ(static_cast<%s>(%d), %s);\n" % ( arg . type , value + 11 , arg . GetArgAccessor ( 'cmd' ) ) ) f . write ( "  CheckBytesWrittenMatchesExpectedSize(\n" ) f . write ( "      next_cmd, sizeof(cmd));\n" ) f . write ( "}\n" ) f . write ( "\n" )
Writes a format test for a command.
Writes a format test for a command .
"""Writes a format test for a command."""
self
func
f