Skip to content

Commit

Permalink
test update
Browse files Browse the repository at this point in the history
  • Loading branch information
borisdj committed Sep 14, 2024
1 parent 5a8847b commit 18890a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CsCodeGenerator.Test/Generated/ComplexNumber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public ComplexNumber Add(ComplexNumber input)
ComplexNumber result = new ComplexNumber
{
Real = Real + input.Real,
Imaginary = Imaginary + input.Imaginary
Imaginary = Imaginary + input.Imaginary,
};
return result;
}
Expand Down
18 changes: 12 additions & 6 deletions CsCodeGenerator.Test/WriteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ private void WriteComplexNumberFile()
secondConstructor.BodyLines.Add("Imaginary = imaginary;");
complexNumberClass.Constructors.Add(secondConstructor);

var indent = complexNumberClass.Indent;

var fields = new List<Field>
{
new (BuiltInDataType.Double, "PI") { SingleKeyWord = KeyWord.Const, DefaultValue = "3.14" },
Expand Down Expand Up @@ -330,9 +332,11 @@ private void WriteComplexNumberFile()
Parameters = new List<Parameter> { new Parameter("ComplexNumber", "input") },
BodyLines = new List<string>
{
"ComplexNumber result = new ComplexNumber();",
"result.Real = Real + input.Real;",
"result.Imaginary = Imaginary + input.Imaginary;",
"ComplexNumber result = new ComplexNumber",
"{",
$"{indent}Real = Real + input.Real,",
$"{indent}Imaginary = Imaginary + input.Imaginary,",
"};",
"return result;"
}
},
Expand Down Expand Up @@ -407,9 +411,11 @@ private string GetComplexNumberFileText()
"",
" public ComplexNumber Add(ComplexNumber input)",
" {",
" ComplexNumber result = new ComplexNumber();",
" result.Real = Real + input.Real;",
" result.Imaginary = Imaginary + input.Imaginary;",
" ComplexNumber result = new ComplexNumber",
" {",
" Real = Real + input.Real,",
" Imaginary = Imaginary + input.Imaginary,",
" };",
" return result;",
" }",
"",
Expand Down

0 comments on commit 18890a8

Please sign in to comment.