Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
projects/AdventureSample/test/GWBas2CS.Test/LenExpressions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,48 @@ | |||
// <copyright file="LenExpressions.cs" company="Brian Rogers"> | |||
// Copyright (c) Brian Rogers. All rights reserved. | |||
// </copyright> | |||
|
|||
namespace GWBas2CS.Test | |||
{ | |||
using FluentAssertions; | |||
using Xunit; | |||
|
|||
public sealed class LenExpressions | |||
{ | |||
[Fact] | |||
public void OneStringVar() | |||
{ | |||
const string Input = @"10 A=LEN(A$)"; | |||
const string Expected = @"* | |||
private int Main() | |||
{ | |||
this.Init(); | |||
A_n = (A_s.Length); | |||
return 2; | |||
} | |||
*"; | |||
|
|||
string actual = Test.Translate("MyProg", Input); | |||
|
|||
actual.Should().Match(Expected); | |||
} | |||
|
|||
[Fact] | |||
public void OneStringExpr() | |||
{ | |||
const string Input = @"10 A=LEN(A$+""x"")"; | |||
const string Expected = @"* | |||
private int Main() | |||
{ | |||
this.Init(); | |||
A_n = (((A_s) + (""x"")).Length); | |||
return 2; | |||
} | |||
*"; | |||
|
|||
string actual = Test.Translate("MyProg", Input); | |||
|
|||
actual.Should().Match(Expected); | |||
} | |||
} | |||
} |