Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/Runtime/XSharp.VFP.Tests/OOPTests.prg
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// Copyright (c) XSharp B.V. All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//


using System
using XUnit

begin namespace XSharp.VFP.Tests
class OOPTests
static constructor
XSharp.RuntimeState.Dialect := XSharpDialect.FoxPro
end constructor

[Fact, Trait("Category", "OOP")];
method NumericPropertyIsUsableInArithmetic as void
local oCircle := Circle{} as Circle
oCircle:Ratio := 5
Assert.Equal(31.4, (real8)oCircle:Perimeter(), 2)
end method

[Fact, Trait("Category", "OOP")];
method NumericPropertyRoundTripsThroughLateBoundAccess as void
local oCircle := Circle{} as Usual
oCircle:Ratio := 5
Assert.Equal(10, (int)(oCircle:Ratio * 2))
end method
end class

define class Circle as Custom
ratio = 0

procedure Perimeter()
return 2 * 3.14 * this.ratio
endproc
enddefine
end namespace
1 change: 1 addition & 0 deletions src/Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<Compile Include="IndexOnTrimTests.prg" />
<Compile Include="IntrospectionTests.prg" />
<Compile Include="KeyMatchLookupTests.prg" />
<Compile Include="OOPTests.prg" />
<Compile Include="ReplaceScopeTests.prg" />
<Compile Include="SetDateCommandTests.prg" />
<Compile Include="SQLStatementTests.prg" />
Expand Down