3
3
// Licensed under the Apache License, Version 2.0.
4
4
// See License.txt in the project root for license information.
5
5
//
6
- using System
7
- using System.Collections.Generic
8
- using System.Linq
9
- using System.Text
10
- using XUnit
6
+ USING System
7
+ USING System.Collections.Generic
8
+ USING System.Linq
9
+ USING System.Text
10
+ USING XUnit
11
11
12
12
13
13
// Array tests are not working correctly yet with the current build
14
- begin namespace XSharp.VFP.Tests
14
+ BEGIN NAMESPACE XSharp.VFP.Tests
15
15
16
- class DateTests
17
- static constructor
16
+ CLASS DateTests
17
+ STATIC CONSTRUCTOR
18
18
XSharp.RuntimeState.Dialect := XSharpDialect.FoxPro
19
19
20
20
[Fact, Trait("Category", "Date and Time")] ;
21
- method ConversionTests () as void
22
- local d as date
23
- local dt as DateTime
21
+ METHOD ConversionTests () AS VOID
22
+ LOCAL d AS DATE
23
+ LOCAL dt AS DateTime
24
24
dt := DateTime{2020 ,1 ,1 ,11 ,12 ,13 }
25
25
26
26
Assert.Equal (11 , Hour (dt))
@@ -33,7 +33,7 @@ begin namespace XSharp.VFP.Tests
33
33
34
34
35
35
[Fact, Trait("Category", "Date and Time")] ;
36
- method QuarterTests () as void
36
+ METHOD QuarterTests () AS VOID
37
37
Assert.Equal ( Quarter ( ConDate ( 2020 , 1 , 1 ) ) , 1 )
38
38
Assert.Equal ( Quarter ( ConDate ( 2020 , 2 , 1 ) ) , 1 )
39
39
Assert.Equal ( Quarter ( ConDate ( 2020 , 3 , 1 ) ) , 1 )
@@ -88,7 +88,7 @@ begin namespace XSharp.VFP.Tests
88
88
Assert.Equal ( Quarter ( 2020.04 .20 ) , 2 )
89
89
90
90
[Fact, Trait("Category", "Date and Time")] ;
91
- method GoMonthTests () as void
91
+ METHOD GoMonthTests () AS VOID
92
92
93
93
Assert.Equal (GoMonth ( NULL_DATE , -12 ) , NULL_DATE)
94
94
Assert.Equal (GoMonth ( DateTime{} , -12 ) , NULL_DATE)
@@ -100,7 +100,7 @@ begin namespace XSharp.VFP.Tests
100
100
Assert.Equal (GoMonth ({^1998 -12 -31 }, -2 ) , ConDate ( 1998 , 10 , 31 ) )
101
101
102
102
[Fact, Trait("Category", "Date and Time")] ;
103
- method WeekTests () as void
103
+ METHOD WeekTests () AS VOID
104
104
Assert.Equal (Week (1998.02 .16 ) , 8 )
105
105
Assert.Equal (Week (1998.02 .16 ,1 ,1 ) , 8 )
106
106
Assert.Equal (Week (2010.01 .03 ,2 ,4 ) , 1 )
@@ -113,7 +113,8 @@ begin namespace XSharp.VFP.Tests
113
113
// ---------------------------------------------------------------- //
114
114
[Fact, Trait("Category", "Date and Time")] ;
115
115
method TToCTests as void
116
- local dt as DateTime
116
+ local dt as DateTime
117
+ SetHours (12 ) // set 12 hours format for time tests
117
118
dt := DateTime{2025 , 8 , 13 , 14 , 30 , 45 }
118
119
119
120
// 0 - numeric format (same as param 1)
@@ -186,6 +187,7 @@ begin namespace XSharp.VFP.Tests
186
187
[Fact, Trait("Category", "Date and Time")] ;
187
188
method TToCEdgeCasesTests as void
188
189
// midnight
190
+ SetHours (12 )
189
191
local midnight := DateTime{2025 , 8 , 13 , 0 , 0 , 0 } as DateTime
190
192
Assert.Equal ("12:00:00 AM" , TToC (midnight, 2 ))
191
193
@@ -274,7 +276,7 @@ begin namespace XSharp.VFP.Tests
274
276
method TToCDateOnlyTests as void
275
277
// try DATE no time
276
278
local d := DateTime{2025 , 8 , 13 } as DateTime
277
-
279
+ SetHours ( 12 )
278
280
// numeric format with date and no time
279
281
local numericResult := TToC (d, 1 ) as string
280
282
Assert.True (numericResult :StartsWith("20250813" ))
0 commit comments