parameters: (self, func, f)
docstring: Overrriden from TypeHandler.
docstring_summary: Overrriden from TypeHandler.
docstring_tokens: Overrriden from TypeHandler .
function: def WriteImmediateFormatTest(self, func, f):
      """Overrriden from TypeHandler."""
      args = func.GetOriginalArgs()
      count_param = 0
      for arg in args:
        if arg.name == "count":
          count_param = int(arg.GetValidClientSideCmdArg(func))
      f.write("TEST_F(GLES2FormatTest, %s) {\n" % func.name)
      f.write("  const int kSomeBaseValueToTestWith = 51;\n")
      f.write("  static %s data[] = {\n" % self.GetArrayType(func))
      for v in range(0, self.GetArrayCount(func) * count_param):
        f.write("    static_cast<%s>(kSomeBaseValueToTestWith + %d),\n" %
                   (self.GetArrayType(func), v))
      f.write("  };\n")
      f.write("  cmds::%s& cmd = *GetBufferAs<cmds::%s>();\n" %
                 (func.name, func.name))
      f.write("  const GLsizei kNumElements = %d;\n" % count_param)
      f.write("  const size_t kExpectedCmdSize =\n")
      f.write("      sizeof(cmd) + kNumElements * sizeof(%s) * %d;\n" %
                 (self.GetArrayType(func), self.GetArrayCount(func)))
      f.write("  void* next_cmd = cmd.Set(\n")
      f.write("      &cmd")
      for value, arg in enumerate(args):
        if arg.IsPointer():
          f.write(",\n      data")
        elif arg.IsConstant():
          continue
        else:
          f.write(",\n      static_cast<%s>(%d)" % (arg.type, value + 1))
      f.write(");\n")
      f.write("  EXPECT_EQ(static_cast<uint32_t>(cmds::%s::kCmdId),\n" %
                 func.name)
      f.write("            cmd.header.command);\n")
      f.write("  EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);\n")
      for value, arg in enumerate(args):
        if arg.IsPointer() or arg.IsConstant():
          continue
        f.write("  EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
                   (arg.type, value + 1, arg.name))
      f.write("  CheckBytesWrittenMatchesExpectedSize(\n")
      f.write("      next_cmd, sizeof(cmd) +\n")
      f.write("      RoundSizeToMultipleOfEntries(sizeof(data)));\n")
      # TODO: Check that data was inserted
      f.write("}\n")
      f.write("\n")
function_tokens: def WriteImmediateFormatTest ( self , func , f ) : args = func . GetOriginalArgs ( ) count_param = 0 for arg in args : if arg . name == "count" : count_param = int ( arg . GetValidClientSideCmdArg ( func ) ) f . write ( "TEST_F(GLES2FormatTest, %s) {\n" % func . name ) f . write ( "  const int kSomeBaseValueToTestWith = 51;\n" ) f . write ( "  static %s data[] = {\n" % self . GetArrayType ( func ) ) for v in range ( 0 , self . GetArrayCount ( func ) * count_param ) : f . write ( "    static_cast<%s>(kSomeBaseValueToTestWith + %d),\n" % ( self . GetArrayType ( func ) , v ) ) f . write ( "  };\n" ) f . write ( "  cmds::%s& cmd = *GetBufferAs<cmds::%s>();\n" % ( func . name , func . name ) ) f . write ( "  const GLsizei kNumElements = %d;\n" % count_param ) f . write ( "  const size_t kExpectedCmdSize =\n" ) f . write ( "      sizeof(cmd) + kNumElements * sizeof(%s) * %d;\n" % ( self . GetArrayType ( func ) , self . GetArrayCount ( func ) ) ) f . write ( "  void* next_cmd = cmd.Set(\n" ) f . write ( "      &cmd" ) for value , arg in enumerate ( args ) : if arg . IsPointer ( ) : f . write ( ",\n      data" ) elif arg . IsConstant ( ) : continue else : f . write ( ",\n      static_cast<%s>(%d)" % ( arg . type , value + 1 ) ) f . write ( ");\n" ) f . write ( "  EXPECT_EQ(static_cast<uint32_t>(cmds::%s::kCmdId),\n" % func . name ) f . write ( "            cmd.header.command);\n" ) f . write ( "  EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);\n" ) for value , arg in enumerate ( args ) : if arg . IsPointer ( ) or arg . IsConstant ( ) : continue f . write ( "  EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % ( arg . type , value + 1 , arg . name ) ) f . write ( "  CheckBytesWrittenMatchesExpectedSize(\n" ) f . write ( "      next_cmd, sizeof(cmd) +\n" ) f . write ( "      RoundSizeToMultipleOfEntries(sizeof(data)));\n" ) # TODO: Check that data was inserted f . write ( "}\n" ) f . write ( "\n" )