original_docstring: Writes the service unit test for a command.
docstring: Writes the service unit test for a command.
docstring_tokens: Writes the service unit test for a command .
code: def WriteImmediateServiceUnitTest(self, func, file, *extras):
      """Writes the service unit test for a command."""
      valid_test = """
  TEST_P(%(test_name)s, %(name)sValidArgs) {
    cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>();
    SpecializedSetup<cmds::%(name)s, 0>(true);
    %(data_type)s temp[%(data_count)s] = { %(data_value)s, };
    cmd.Init(%(gl_args)s, &temp[0]);
    EXPECT_CALL(
        *gl_,
        %(gl_func_name)s(%(gl_args)s, %(data_ref)sreinterpret_cast<
            %(data_type)s*>(ImmediateDataAddress(&cmd))));
    EXPECT_EQ(error::kNoError,
              ExecuteImmediateCmd(cmd, sizeof(temp)));
    EXPECT_EQ(GL_NO_ERROR, GetGLError());
  }
  """
      gl_arg_strings = [
        arg.GetValidGLArg(func) for arg in func.GetOriginalArgs()[0:-1]
      ]
      gl_any_strings = ["_"] * len(gl_arg_strings)
  
      extra = {
        'data_ref': ("*" if func.GetInfo('first_element_only') else ""),
        'data_type': self.GetArrayType(func),
        'data_count': self.GetArrayCount(func),
        'data_value': func.GetInfo('data_value') or '0',
        'gl_args': ", ".join(gl_arg_strings),
        'gl_any_args': ", ".join(gl_any_strings),
      }
      self.WriteValidUnitTest(func, file, valid_test, extra, *extras)
  
      invalid_test = """
  TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
    cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>();
    EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_any_args)s, _)).Times(0);
    SpecializedSetup<cmds::%(name)s, 0>(false);
    %(data_type)s temp[%(data_count)s] = { %(data_value)s, };
    cmd.Init(%(all_but_last_args)s, &temp[0]);
    EXPECT_EQ(error::%(parse_result)s,
              ExecuteImmediateCmd(cmd, sizeof(temp)));%(gl_error_test)s
  }
  """
      self.WriteInvalidUnitTest(func, file, invalid_test, extra, *extras)
code_tokens: def WriteImmediateServiceUnitTest ( self , func , file , * extras ) : valid_test = """
  TEST_P(%(test_name)s, %(name)sValidArgs) {
    cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>();
    SpecializedSetup<cmds::%(name)s, 0>(true);
    %(data_type)s temp[%(data_count)s] = { %(data_value)s, };
    cmd.Init(%(gl_args)s, &temp[0]);
    EXPECT_CALL(
        *gl_,
        %(gl_func_name)s(%(gl_args)s, %(data_ref)sreinterpret_cast<
            %(data_type)s*>(ImmediateDataAddress(&cmd))));
    EXPECT_EQ(error::kNoError,
              ExecuteImmediateCmd(cmd, sizeof(temp)));
    EXPECT_EQ(GL_NO_ERROR, GetGLError());
  }
  """ gl_arg_strings = [ arg . GetValidGLArg ( func ) for arg in func . GetOriginalArgs ( ) [ 0 : - 1 ] ] gl_any_strings = [ "_" ] * len ( gl_arg_strings ) extra = { 'data_ref' : ( "*" if func . GetInfo ( 'first_element_only' ) else "" ) , 'data_type' : self . GetArrayType ( func ) , 'data_count' : self . GetArrayCount ( func ) , 'data_value' : func . GetInfo ( 'data_value' ) or '0' , 'gl_args' : ", " . join ( gl_arg_strings ) , 'gl_any_args' : ", " . join ( gl_any_strings ) , } self . WriteValidUnitTest ( func , file , valid_test , extra , * extras ) invalid_test = """
  TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
    cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>();
    EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_any_args)s, _)).Times(0);
    SpecializedSetup<cmds::%(name)s, 0>(false);
    %(data_type)s temp[%(data_count)s] = { %(data_value)s, };
    cmd.Init(%(all_but_last_args)s, &temp[0]);
    EXPECT_EQ(error::%(parse_result)s,
              ExecuteImmediateCmd(cmd, sizeof(temp)));%(gl_error_test)s
  }
  """ self . WriteInvalidUnitTest ( func , file , invalid_test , extra , * extras )
short_docstring: Writes the service unit test for a command.
short_docstring_tokens: Writes the service unit test for a command .
comment: """Writes the service unit test for a command."""