/*
 * $Id$
 *
 * SARL is an general-purpose agent programming language.
 * More details on http://www.sarl.io
 *
 * Copyright (C) 2014-2026 SARL.io, the original authors and main authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.sarl.lang.tests.general.compilation.general;

import static io.sarl.tests.api.tools.TestAssertions.assertEqualsExceptNewLines;
import static io.sarl.tests.api.tools.TestUtils.multilineString;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import io.sarl.lang.core.SARLVersion;
import io.sarl.lang.sarl.SarlPackage;
import io.sarl.lang.tests.api.AbstractSarlTest;

/**
 * @author $Author: sgalland$
 * @version $Name$ $Revision$ $Date$
 * @mavengroupid $GroupId$
 * @mavenartifactid $ArtifactId$
 */
@SuppressWarnings("all")
@DisplayName("Compilation: parameter default values")
@Tag("core")
@Tag("compileToJava")
public class ArgDefaultValueCompilerTest {

	@Nested
	public class AgentTest extends AbstractSarlTest {

		@Test
		public void action_1p_int() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg : int=4) {",
					"  System.^out.println(arg)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(@DefaultValue(\"A1#MYACTION_0\") final int arg) {",
					"    System.out.println(arg);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"4\")",
					"  private final int $DEFAULT_VALUE$MYACTION_0() {",
					"    return 4;",
					"  }",
					"  ",
					"  @DefaultValueUse(\"int\")",
					"  @SyntheticMember",
					"  protected final void myaction() {",
					"    myaction($DEFAULT_VALUE$MYACTION_0());",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_1p_float() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg : float=4.5f) {",
					"  System.^out.println(arg)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(@DefaultValue(\"A1#MYACTION_0\") final float arg) {",
					"    System.out.println(arg);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"4.5f\")",
					"  private final float $DEFAULT_VALUE$MYACTION_0() {",
					"    return 4.5f;",
					"  }",
					"  ",
					"  @DefaultValueUse(\"float\")",
					"  @SyntheticMember",
					"  protected final void myaction() {",
					"    myaction($DEFAULT_VALUE$MYACTION_0());",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_1p_boolean() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg : boolean=true) {",
					"  System.^out.println(arg)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(@DefaultValue(\"A1#MYACTION_0\") final boolean arg) {",
					"    System.out.println(arg);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"true\")",
					"  private final boolean $DEFAULT_VALUE$MYACTION_0() {",
					"    return true;",
					"  }",
					"  ",
					"  @DefaultValueUse(\"boolean\")",
					"  @SyntheticMember",
					"  protected final void myaction() {",
					"    myaction($DEFAULT_VALUE$MYACTION_0());",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_1p_double() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg : double=4.5) {",
					"  System.^out.println(arg)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(@DefaultValue(\"A1#MYACTION_0\") final double arg) {",
					"    System.out.println(arg);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"4.5\")",
					"  private final double $DEFAULT_VALUE$MYACTION_0() {",
					"    return 4.5;",
					"  }",
					"  ",
					"  @DefaultValueUse(\"double\")",
					"  @SyntheticMember",
					"  protected final void myaction() {",
					"    myaction($DEFAULT_VALUE$MYACTION_0());",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_1p_long() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg : long=450) {",
					"  System.^out.println(arg)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(@DefaultValue(\"A1#MYACTION_0\") final long arg) {",
					"    System.out.println(arg);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"450\")",
					"  private final long $DEFAULT_VALUE$MYACTION_0() {",
					"    return 450;",
					"  }",
					"  ",
					"  @DefaultValueUse(\"long\")",
					"  @SyntheticMember",
					"  protected final void myaction() {",
					"    myaction($DEFAULT_VALUE$MYACTION_0());",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_1p_String() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg : String=\"abcd\") {",
					"  System.^out.println(arg)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(@DefaultValue(\"A1#MYACTION_0\") final String arg) {",
					"    System.out.println(arg);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"\\\"abcd\\\"\")",
					"  private final String $DEFAULT_VALUE$MYACTION_0() {",
					"    return \"abcd\";",
					"  }",
					"  ",
					"  @DefaultValueUse(\"java.lang.String\")",
					"  @SyntheticMember",
					"  protected final void myaction() {",
					"    myaction($DEFAULT_VALUE$MYACTION_0());",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_1p_char() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg : char='d') {",
					"  System.^out.println(arg)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(@DefaultValue(\"A1#MYACTION_0\") final char arg) {",
					"    System.out.println(arg);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"\\'d\\'\")",
					"  private final char $DEFAULT_VALUE$MYACTION_0() {",
					"    return 'd';",
					"  }",
					"  ",
					"  @DefaultValueUse(\"char\")",
					"  @SyntheticMember",
					"  protected final void myaction() {",
					"    myaction($DEFAULT_VALUE$MYACTION_0());",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_1p_returnValue() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg : int=4) : boolean {",
					"  System.^out.println(arg)",
					"  return true",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected boolean myaction(@DefaultValue(\"A1#MYACTION_0\") final int arg) {",
					"    System.out.println(arg);",
					"    return true;",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"4\")",
					"  private final int $DEFAULT_VALUE$MYACTION_0() {",
					"    return 4;",
					"  }",
					"  ",
					"  @DefaultValueUse(\"int\")",
					"  @SyntheticMember",
					"  protected final boolean myaction() {",
					"    return myaction($DEFAULT_VALUE$MYACTION_0());",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_5p_0() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg0 : int=4, arg1 : String, arg2 : int, arg3 : int, arg4 : String) {",
					"  System.^out.println(arg0)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(@DefaultValue(\"A1#MYACTION_0\") final int arg0, final String arg1, final int arg2, final int arg3, final String arg4) {",
					"    System.out.println(arg0);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg0",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"4\")",
					"  private final int $DEFAULT_VALUE$MYACTION_0() {",
					"    return 4;",
					"  }",
					"  ",
					"  @DefaultValueUse(\"int,java.lang.String,int,int,java.lang.String\")",
					"  @SyntheticMember",
					"  protected final void myaction(final String arg1, final int arg2, final int arg3, final String arg4) {",
					"    myaction($DEFAULT_VALUE$MYACTION_0(), arg1, arg2, arg3, arg4);",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ",
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_5p_1() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg0 : int, arg1 : String=\"abc\", arg2 : int, arg3 : int, arg4 : String) {",
					"  System.^out.println(arg0)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(final int arg0, @DefaultValue(\"A1#MYACTION_0\") final String arg1, final int arg2, final int arg3, final String arg4) {",
					"    System.out.println(arg0);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg1",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"\\\"abc\\\"\")",
					"  private final String $DEFAULT_VALUE$MYACTION_0() {",
					"    return \"abc\";",
					"  }",
					"  ",
					"  @DefaultValueUse(\"int,java.lang.String,int,int,java.lang.String\")",
					"  @SyntheticMember",
					"  protected final void myaction(final int arg0, final int arg2, final int arg3, final String arg4) {",
					"    myaction(arg0, $DEFAULT_VALUE$MYACTION_0(), arg2, arg3, arg4);",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_5p_2() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg0 : int, arg1 : String, arg2 : int=18, arg3 : int, arg4 : String) {",
					"  System.^out.println(arg0)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(final int arg0, final String arg1, @DefaultValue(\"A1#MYACTION_0\") final int arg2, final int arg3, final String arg4) {",
					"    System.out.println(arg0);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg2",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"18\")",
					"  private final int $DEFAULT_VALUE$MYACTION_0() {",
					"    return 18;",
					"  }",
					"  ",
					"  @DefaultValueUse(\"int,java.lang.String,int,int,java.lang.String\")",
					"  @SyntheticMember",
					"  protected final void myaction(final int arg0, final String arg1, final int arg3, final String arg4) {",
					"    myaction(arg0, arg1, $DEFAULT_VALUE$MYACTION_0(), arg3, arg4);",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_5p_3() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg0 : int, arg1 : String, arg2 : int, arg3 : int = 34, arg4 : String) {",
					"  System.^out.println(arg0)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(final int arg0, final String arg1, final int arg2, @DefaultValue(\"A1#MYACTION_0\") final int arg3, final String arg4) {",
					"    System.out.println(arg0);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg3",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"34\")",
					"  private final int $DEFAULT_VALUE$MYACTION_0() {",
					"    return 34;",
					"  }",
					"  ",
					"  @DefaultValueUse(\"int,java.lang.String,int,int,java.lang.String\")",
					"  @SyntheticMember",
					"  protected final void myaction(final int arg0, final String arg1, final int arg2, final String arg4) {",
					"    myaction(arg0, arg1, arg2, $DEFAULT_VALUE$MYACTION_0(), arg4);",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_5p_4() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"def myaction(arg0 : int, arg1 : String, arg2 : int, arg3 : int, arg4 : String=\"xyz\") {",
					"  System.^out.println(arg0)",
					"}",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
					"import io.sarl.lang.core.annotation.SarlSourceCode;",
					"import io.sarl.lang.core.annotation.SarlSpecification;",
					"import io.sarl.lang.core.annotation.SyntheticMember;",
					"import jakarta.inject.Inject;",
					"import java.util.UUID;",
					"import org.eclipse.xtext.xbase.lib.Pure;",
					"import org.eclipse.xtext.xbase.lib.XbaseGenerated;",
					"",
					"@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")",
					"@SarlElementType(" + SarlPackage.SARL_AGENT + ")",
					"@XbaseGenerated",
					"@SuppressWarnings(\"all\")",
					"public class A1 extends Agent {",
					"  @DefaultValueSource",
					"  protected void myaction(final int arg0, final String arg1, final int arg2, final int arg3, @DefaultValue(\"A1#MYACTION_0\") final String arg4) {",
					"    System.out.println(arg0);",
					"  }",
					"  ",
					"  /**",
					"   * Default value for the parameter arg4",
					"   */",
					"  @Pure",
					"  @SyntheticMember",
					"  @SarlSourceCode(\"\\\"xyz\\\"\")",
					"  private final String $DEFAULT_VALUE$MYACTION_0() {",
					"    return \"xyz\";",
					"  }",
					"  ",
					"  @DefaultValueUse(\"int,java.lang.String,int,int,java.lang.String\")",
					"  @SyntheticMember",
					"  protected final void myaction(final int arg0, final String arg1, final int arg2, final int arg3) {",
					"    myaction(arg0, arg1, arg2, arg3, $DEFAULT_VALUE$MYACTION_0());",
					"  }",
					"  ",
					"  @SyntheticMember",
					"  public A1(final UUID arg0, final UUID arg1) {",
					"    super(arg0, arg1);",
					"  }",
					"  ", 
					"  @SyntheticMember", 
					"  @Inject", 
					"  public A1(final UUID arg0, final UUID arg1, final DynamicSkillProvider arg2) {", 
					"    super(arg0, arg1, arg2);", 
					"  }",
					"}",
					""
					);
			getCompileHelper().assertCompilesTo(source, expected);
		}

		@Test
		public void action_5p_0_3() throws Exception {
			String source = multilineString(
					"agent A1 {",
					"  def myaction(arg0 : int=4, arg1 : String, arg2 : int, arg3 : int=56, arg4 : String) {",
					"    System.^out.println(arg0)",
					"  }",
					"}"
					);
			String expected = multilineString(
					"import io.sarl.lang.core.Agent;",
					"import io.sarl.lang.core.DynamicSkillProvider;",
					"import io.sarl.lang.core.annotation.DefaultValue;",
					"import io.sarl.lang.core.annotation.DefaultValueSource;",
					"import io.sarl.lang.core.annotation.DefaultValueUse;",
					"import io.sarl.lang.core.annotation.SarlElementType;",
