Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
550a992d
Commit
550a992d
authored
Nov 18, 2019
by
Jeff Smith
Committed by
Alexandre Julliard
Nov 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Clean up strftime tests.
Signed-off-by:
Jeff Smith
<
whydoubt@gmail.com
>
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
934c02c7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
145 deletions
+62
-145
time.c
dlls/msvcrt/tests/time.c
+62
-145
No files found.
dlls/msvcrt/tests/time.c
View file @
550a992d
...
@@ -588,13 +588,59 @@ static void test_daylight(void)
...
@@ -588,13 +588,59 @@ static void test_daylight(void)
static
void
test_strftime
(
void
)
static
void
test_strftime
(
void
)
{
{
const
struct
{
const
char
*
format
;
}
tests_einval
[]
=
{
{
"%C"
},
{
"%D"
},
{
"%e"
},
{
"%F"
},
{
"%h"
},
{
"%n"
},
{
"%R"
},
{
"%t"
},
{
"%T"
},
{
"%u"
},
};
const
struct
{
const
char
*
format
;
const
char
*
ret
;
struct
tm
tm
;
BOOL
todo
;
}
tests
[]
=
{
{
"e%#%e"
,
"e%e"
,
{
0
,
0
,
0
,
1
,
0
,
70
,
4
,
0
,
0
}},
{
"%c"
,
"01/01/70 00:00:00"
,
{
0
,
0
,
0
,
1
,
0
,
70
,
4
,
0
,
0
}},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0
,
0
,
0
,
1
,
0
,
70
,
0
,
0
,
0
}},
{
"%U"
,
"53"
,
{
0
,
0
,
0
,
1
,
0
,
70
,
0
,
365
,
0
}},
{
"%W"
,
"52"
,
{
0
,
0
,
0
,
1
,
0
,
70
,
0
,
365
,
0
}},
};
static
const
wchar_t
cW
[]
=
{
'%'
,
'c'
,
0
};
static
const
wchar_t
cW
[]
=
{
'%'
,
'c'
,
0
};
static
const
char
expected
[]
=
"01/01/70 00:00:00"
;
time_t
gmt
;
time_t
gmt
;
struct
tm
*
gmt_tm
;
struct
tm
*
gmt_tm
;
char
buf
[
256
],
bufA
[
256
];
char
buf
[
256
],
bufA
[
256
];
WCHAR
bufW
[
256
];
WCHAR
bufW
[
256
];
long
retA
,
retW
;
long
retA
,
retW
;
int
i
;
if
(
!
p_strftime
||
!
p_wcsftime
||
!
p_gmtime
)
if
(
!
p_strftime
||
!
p_wcsftime
||
!
p_gmtime
)
{
{
...
@@ -608,55 +654,13 @@ static void test_strftime(void)
...
@@ -608,55 +654,13 @@ static void test_strftime(void)
gmt_tm
=
p_gmtime
(
&
gmt
);
gmt_tm
=
p_gmtime
(
&
gmt
);
ok
(
gmt_tm
!=
NULL
,
"gmtime failed
\n
"
);
ok
(
gmt_tm
!=
NULL
,
"gmtime failed
\n
"
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests_einval
);
i
++
)
{
errno
=
0xdeadbeef
;
errno
=
0xdeadbeef
;
retA
=
p_strftime
(
bufA
,
256
,
"%C"
,
gmt_tm
);
retA
=
p_strftime
(
bufA
,
256
,
tests_einval
[
i
].
format
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
retA
==
0
,
"%d) ret = %ld
\n
"
,
i
,
retA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"%d) errno = %d
\n
"
,
i
,
errno
);
}
errno
=
0xdeadbeef
;
retA
=
p_strftime
(
bufA
,
256
,
"%D"
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
retA
=
p_strftime
(
bufA
,
256
,
"%e"
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
retA
=
p_strftime
(
bufA
,
256
,
"%F"
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
retA
=
p_strftime
(
bufA
,
256
,
"%h"
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
retA
=
p_strftime
(
bufA
,
256
,
"%n"
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
retA
=
p_strftime
(
bufA
,
256
,
"%R"
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
retA
=
p_strftime
(
bufA
,
256
,
"%t"
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
retA
=
p_strftime
(
bufA
,
256
,
"%T"
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
retA
=
p_strftime
(
bufA
,
256
,
"%u"
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
errno
=
0xdeadbeef
;
retA
=
p_strftime
(
NULL
,
0
,
"copy"
,
gmt_tm
);
retA
=
p_strftime
(
NULL
,
0
,
"copy"
,
gmt_tm
);
...
@@ -691,14 +695,17 @@ static void test_strftime(void)
...
@@ -691,14 +695,17 @@ static void test_strftime(void)
ok
(
errno
==
EINVAL
,
"errno = %d
\n
"
,
errno
);
ok
(
errno
==
EINVAL
,
"errno = %d
\n
"
,
errno
);
}
}
retA
=
p_strftime
(
bufA
,
256
,
"e%#%e"
,
gmt_tm
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
i
++
)
ok
(
retA
==
3
,
"expected 3, got %ld
\n
"
,
retA
);
{
ok
(
!
strcmp
(
bufA
,
"e%e"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
tests
[
i
].
format
,
&
tests
[
i
].
tm
);
todo_wine_if
(
tests
[
i
].
todo
)
{
ok
(
retA
==
strlen
(
tests
[
i
].
ret
),
"%d) ret = %ld
\n
"
,
i
,
retA
);
ok
(
!
strcmp
(
bufA
,
tests
[
i
].
ret
),
"%d) buf =
\"
%s
\"
, expected
\"
%s
\"\n
"
,
i
,
bufA
,
tests
[
i
].
ret
);
}
}
retA
=
p_strftime
(
bufA
,
256
,
"%c"
,
gmt_tm
);
retA
=
p_strftime
(
bufA
,
256
,
"%c"
,
gmt_tm
);
ok
(
retA
==
17
,
"expected 17, got %ld
\n
"
,
retA
);
ok
(
strcmp
(
bufA
,
expected
)
==
0
,
"expected %s, got %s
\n
"
,
expected
,
bufA
);
retW
=
p_wcsftime
(
bufW
,
256
,
cW
,
gmt_tm
);
retW
=
p_wcsftime
(
bufW
,
256
,
cW
,
gmt_tm
);
ok
(
retW
==
17
,
"expected 17, got %ld
\n
"
,
retW
);
ok
(
retW
==
17
,
"expected 17, got %ld
\n
"
,
retW
);
ok
(
retA
==
retW
,
"expected %ld, got %ld
\n
"
,
retA
,
retW
);
ok
(
retA
==
retW
,
"expected %ld, got %ld
\n
"
,
retA
,
retW
);
...
@@ -707,96 +714,6 @@ static void test_strftime(void)
...
@@ -707,96 +714,6 @@ static void test_strftime(void)
buf
[
retA
]
=
0
;
buf
[
retA
]
=
0
;
ok
(
strcmp
(
bufA
,
buf
)
==
0
,
"expected %s, got %s
\n
"
,
bufA
,
buf
);
ok
(
strcmp
(
bufA
,
buf
)
==
0
,
"expected %s, got %s
\n
"
,
bufA
,
buf
);
retA
=
p_strftime
(
bufA
,
256
,
"%x"
,
gmt_tm
);
ok
(
retA
==
8
,
"expected 8, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"01/01/70"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%X"
,
gmt_tm
);
ok
(
retA
==
8
,
"expected 8, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"00:00:00"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%a"
,
gmt_tm
);
ok
(
retA
==
3
,
"expected 3, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"Thu"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%A"
,
gmt_tm
);
ok
(
retA
==
8
,
"expected 8, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"Thursday"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%b"
,
gmt_tm
);
ok
(
retA
==
3
,
"expected 3, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"Jan"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%B"
,
gmt_tm
);
ok
(
retA
==
7
,
"expected 7, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"January"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%d"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"01"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%#d"
,
gmt_tm
);
ok
(
retA
==
1
,
"expected 1, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"1"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%H"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"00"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%I"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"12"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%j"
,
gmt_tm
);
ok
(
retA
==
3
,
"expected 3, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"001"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%m"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"01"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%#M"
,
gmt_tm
);
ok
(
retA
==
1
,
"expected 1, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"0"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%p"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"AM"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%U"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"00"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%W"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"00"
),
"got %s
\n
"
,
bufA
);
gmt_tm
->
tm_wday
=
0
;
retA
=
p_strftime
(
bufA
,
256
,
"%U"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"01"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%W"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"00"
),
"got %s
\n
"
,
bufA
);
gmt_tm
->
tm_yday
=
365
;
retA
=
p_strftime
(
bufA
,
256
,
"%U"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"53"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
256
,
"%W"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"52"
),
"got %s
\n
"
,
bufA
);
gmt_tm
->
tm_mon
=
1
;
gmt_tm
->
tm_mday
=
30
;
retA
=
p_strftime
(
bufA
,
256
,
"%c"
,
gmt_tm
);
todo_wine
{
ok
(
retA
==
17
,
"expected 17, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"02/30/70 00:00:00"
),
"got %s
\n
"
,
bufA
);
}
if
(
!
setlocale
(
LC_ALL
,
"Japanese_Japan.932"
))
{
if
(
!
setlocale
(
LC_ALL
,
"Japanese_Japan.932"
))
{
win_skip
(
"Japanese_Japan.932 locale not available
\n
"
);
win_skip
(
"Japanese_Japan.932 locale not available
\n
"
);
return
;
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment