1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5/*=====================================================================
6**
7** Source: CompareFileTime.c
8**
9** Purpose: Tests the PAL implementation of the CompareFileTime function.
10** Defines a large and small file time, and compares them in all fashions
11** to ensure proper return values.
12**
13**
14**===================================================================*/
15
16#include <palsuite.h>
17
18
19
20int __cdecl main(int argc, char **argv)
21{
22
23 FILETIME SmallTime, BigTime;
24
25 if (0 != PAL_Initialize(argc,argv))
26 {
27 return FAIL;
28 }
29
30 /* Set a Big and Small time. These were generated using
31 GetFileTime on a file, with a recent creation time and an old
32 modify time, to get a bigger and smaller value.
33 */
34
35 BigTime.dwLowDateTime = -755748832;
36 BigTime.dwHighDateTime = 29436941;
37
38 SmallTime.dwLowDateTime = -459754240;
39 SmallTime.dwHighDateTime = 29436314;
40
41 /* Check to see that SmallTime is less than Big Time */
42
43 if(CompareFileTime(&SmallTime,&BigTime) != -1)
44 {
45 Fail("ERROR: The first time is less than the second time, so "
46 "-1 should have been returned to indicate this.");
47 }
48
49 /* Check that BigTime is greater than SmallTime */
50
51 if(CompareFileTime(&BigTime,&SmallTime) != 1)
52 {
53 Fail("ERROR: The first time is greater than the second time, so "
54 "1 should have been returned to indicate this.");
55 }
56
57 /* Check that BigTime is equal to BigTime */
58
59 if(CompareFileTime(&BigTime,&BigTime) != 0)
60 {
61 Fail("ERROR: The first time is equal to the second time, so "
62 "0 should have been returned to indicate this.");
63 }
64
65 PAL_Terminate();
66 return PASS;
67}
68
69