Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
75e07874
Commit
75e07874
authored
Jun 28, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Format -> format
parent
5edda531
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
test/printf-test.cc
test/printf-test.cc
+10
-10
No files found.
test/printf-test.cc
View file @
75e07874
...
@@ -86,31 +86,31 @@ TEST(PrintfTest, AutomaticArgIndexing) {
...
@@ -86,31 +86,31 @@ TEST(PrintfTest, AutomaticArgIndexing) {
}
}
TEST
(
PrintfTest
,
NumberIsTooBigInArgIndex
)
{
TEST
(
PrintfTest
,
NumberIsTooBigInArgIndex
)
{
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
F
ormat
(
"%{}$"
,
BIG_NUM
))),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
f
ormat
(
"%{}$"
,
BIG_NUM
))),
FormatError
,
"invalid format string"
);
FormatError
,
"invalid format string"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
F
ormat
(
"%{}$d"
,
BIG_NUM
))),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
f
ormat
(
"%{}$d"
,
BIG_NUM
))),
FormatError
,
"number is too big in format"
);
FormatError
,
"number is too big in format"
);
}
}
TEST
(
PrintfTest
,
SwitchArgIndexing
)
{
TEST
(
PrintfTest
,
SwitchArgIndexing
)
{
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%1$d%"
,
1
,
2
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%1$d%"
,
1
,
2
),
FormatError
,
"invalid format string"
);
FormatError
,
"invalid format string"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
F
ormat
(
"%1$d%{}d"
,
BIG_NUM
)),
1
,
2
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
f
ormat
(
"%1$d%{}d"
,
BIG_NUM
)),
1
,
2
),
FormatError
,
"number is too big in format"
);
FormatError
,
"number is too big in format"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%1$d%d"
,
1
,
2
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%1$d%d"
,
1
,
2
),
FormatError
,
"cannot switch from manual to automatic argument indexing"
);
FormatError
,
"cannot switch from manual to automatic argument indexing"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%d%1$"
,
1
,
2
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%d%1$"
,
1
,
2
),
FormatError
,
"invalid format string"
);
FormatError
,
"invalid format string"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
F
ormat
(
"%d%{}$d"
,
BIG_NUM
)),
1
,
2
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
f
ormat
(
"%d%{}$d"
,
BIG_NUM
)),
1
,
2
),
FormatError
,
"number is too big in format"
);
FormatError
,
"number is too big in format"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%d%1$d"
,
1
,
2
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%d%1$d"
,
1
,
2
),
FormatError
,
"cannot switch from automatic to manual argument indexing"
);
FormatError
,
"cannot switch from automatic to manual argument indexing"
);
// Indexing errors override width errors.
// Indexing errors override width errors.
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
F
ormat
(
"%d%1${}d"
,
BIG_NUM
)),
1
,
2
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
f
ormat
(
"%d%1${}d"
,
BIG_NUM
)),
1
,
2
),
FormatError
,
"number is too big in format"
);
FormatError
,
"number is too big in format"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
F
ormat
(
"%1$d%{}d"
,
BIG_NUM
)),
1
,
2
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
f
ormat
(
"%1$d%{}d"
,
BIG_NUM
)),
1
,
2
),
FormatError
,
"number is too big in format"
);
FormatError
,
"number is too big in format"
);
}
}
...
@@ -119,12 +119,12 @@ TEST(PrintfTest, InvalidArgIndex) {
...
@@ -119,12 +119,12 @@ TEST(PrintfTest, InvalidArgIndex) {
"argument index is out of range in format"
);
"argument index is out of range in format"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%2$d"
,
42
),
FormatError
,
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%2$d"
,
42
),
FormatError
,
"argument index is out of range in format"
);
"argument index is out of range in format"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
F
ormat
(
"%{}$d"
,
INT_MAX
)),
42
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
f
ormat
(
"%{}$d"
,
INT_MAX
)),
42
),
FormatError
,
"argument index is out of range in format"
);
FormatError
,
"argument index is out of range in format"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%2$"
,
42
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%2$"
,
42
),
FormatError
,
"invalid format string"
);
FormatError
,
"invalid format string"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
F
ormat
(
"%{}$d"
,
BIG_NUM
)),
42
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
f
ormat
(
"%{}$d"
,
BIG_NUM
)),
42
),
FormatError
,
"number is too big in format"
);
FormatError
,
"number is too big in format"
);
}
}
...
@@ -213,9 +213,9 @@ TEST(PrintfTest, Width) {
...
@@ -213,9 +213,9 @@ TEST(PrintfTest, Width) {
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%5-5d"
,
42
),
FormatError
,
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
"%5-5d"
,
42
),
FormatError
,
"unknown format code '-' for integer"
);
"unknown format code '-' for integer"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
F
ormat
(
"%{}d"
,
BIG_NUM
)),
42
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
f
ormat
(
"%{}d"
,
BIG_NUM
)),
42
),
FormatError
,
"number is too big in format"
);
FormatError
,
"number is too big in format"
);
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
F
ormat
(
"%1${}d"
,
BIG_NUM
)),
42
),
EXPECT_THROW_MSG
(
fmt
::
sprintf
(
str
(
f
ormat
(
"%1${}d"
,
BIG_NUM
)),
42
),
FormatError
,
"number is too big in format"
);
FormatError
,
"number is too big in format"
);
}
}
...
...
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