Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
43d208d2
Commit
43d208d2
authored
Apr 11, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt/tests: Added more strftime tests.
parent
ef08e807
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
0 deletions
+102
-0
time.c
dlls/msvcrt/tests/time.c
+102
-0
No files found.
dlls/msvcrt/tests/time.c
View file @
43d208d2
...
...
@@ -599,9 +599,47 @@ static void test_strftime(void)
gmt_tm
=
p_gmtime
(
&
gmt
);
ok
(
gmt_tm
!=
NULL
,
"gmtime failed
\n
"
);
errno
=
0xdeadbeef
;
retA
=
strftime
(
NULL
,
0
,
"copy"
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
retA
=
strftime
(
bufA
,
256
,
"copy"
,
NULL
);
ok
(
retA
==
4
,
"expected 4, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"copy"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"copy it"
,
gmt_tm
);
ok
(
retA
==
7
,
"expected 7, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"copy it"
),
"got %s
\n
"
,
bufA
);
errno
=
0xdeadbeef
;
retA
=
strftime
(
bufA
,
2
,
"copy"
,
gmt_tm
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
""
)
||
broken
(
!
strcmp
(
bufA
,
"copy it"
)),
"got %s
\n
"
,
bufA
);
ok
(
errno
==
ERANGE
||
errno
==
0xdeadbeef
,
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
retA
=
strftime
(
bufA
,
256
,
"a%e"
,
gmt_tm
);
ok
(
retA
==
0
||
broken
(
retA
==
1
),
"expected 0, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
""
)
||
broken
(
!
strcmp
(
bufA
,
"a"
)),
"got %s
\n
"
,
bufA
);
ok
(
errno
==
EINVAL
||
broken
(
errno
==
0xdeadbeef
),
"errno = %d
\n
"
,
errno
);
if
(
0
)
{
/* crashes on Win2k */
errno
=
0xdeadbeef
;
retA
=
strftime
(
bufA
,
256
,
"%c"
,
NULL
);
ok
(
retA
==
0
,
"expected 0, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
""
),
"got %s
\n
"
,
bufA
);
ok
(
errno
==
EINVAL
,
"errno = %d
\n
"
,
errno
);
}
retA
=
strftime
(
bufA
,
256
,
"e%#%e"
,
gmt_tm
);
ok
(
retA
==
3
,
"expected 3, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"e%e"
),
"got %s
\n
"
,
bufA
);
retA
=
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
=
wcsftime
(
bufW
,
256
,
cW
,
gmt_tm
);
ok
(
retW
==
17
,
"expected 17, got %ld
\n
"
,
retW
);
ok
(
retA
==
retW
,
"expected %ld, got %ld
\n
"
,
retA
,
retW
);
...
...
@@ -609,6 +647,70 @@ static void test_strftime(void)
retA
=
WideCharToMultiByte
(
CP_ACP
,
0
,
bufW
,
retW
,
buf
,
256
,
NULL
,
NULL
);
buf
[
retA
]
=
0
;
ok
(
strcmp
(
bufA
,
buf
)
==
0
,
"expected %s, got %s
\n
"
,
bufA
,
buf
);
retA
=
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
=
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
=
strftime
(
bufA
,
256
,
"%a"
,
gmt_tm
);
ok
(
retA
==
3
,
"expected 3, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"Thu"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"%A"
,
gmt_tm
);
ok
(
retA
==
8
,
"expected 8, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"Thursday"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"%b"
,
gmt_tm
);
ok
(
retA
==
3
,
"expected 3, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"Jan"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"%B"
,
gmt_tm
);
ok
(
retA
==
7
,
"expected 7, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"January"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"%d"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"01"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"%#d"
,
gmt_tm
);
ok
(
retA
==
1
,
"expected 1, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"1"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"%H"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"00"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"%I"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"12"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"%j"
,
gmt_tm
);
ok
(
retA
==
3
,
"expected 3, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"001"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"%m"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"01"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"%#M"
,
gmt_tm
);
ok
(
retA
==
1
,
"expected 1, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"0"
),
"got %s
\n
"
,
bufA
);
retA
=
strftime
(
bufA
,
256
,
"%p"
,
gmt_tm
);
ok
(
retA
==
2
,
"expected 2, got %ld
\n
"
,
retA
);
ok
(
!
strcmp
(
bufA
,
"AM"
),
"got %s
\n
"
,
bufA
);
gmt_tm
->
tm_mon
=
1
;
gmt_tm
->
tm_mday
=
30
;
retA
=
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
);
}
}
static
void
test_asctime
(
void
)
...
...
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