Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
210239e8
Commit
210239e8
authored
Aug 01, 2019
by
Guillem González Vela
Committed by
gugov
Aug 01, 2019
Browse files
Fix table formatting in advanced.md
parent
9311242d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
36 deletions
+23
-36
googletest/docs/advanced.md
googletest/docs/advanced.md
+23
-36
No files found.
googletest/docs/advanced.md
View file @
210239e8
...
@@ -102,12 +102,10 @@ can be implicitly converted to `bool`), you can use it in a *predicate
...
@@ -102,12 +102,10 @@ can be implicitly converted to `bool`), you can use it in a *predicate
assertion
*
to get the function arguments printed for free:
assertion
*
to get the function arguments printed for free:
| Fatal assertion | Nonfatal assertion | Verifies |
| Fatal assertion | Nonfatal assertion | Verifies |
| -------------------- | -------------------- | --------------------------- |
| --------------------------------- | --------------------------------- | --------------------------- |
|
`ASSERT_PRED1(pred1, | `
EXPECT_PRED1(pred1, |
`pred1(val1)`
is true |
|
`ASSERT_PRED1(pred1, val1)`
|
`EXPECT_PRED1(pred1, val1)`
|
`pred1(val1)`
is true |
: val1);
` : val1);`
: :
|
`ASSERT_PRED2(pred2, val1, val2)`
|
`EXPECT_PRED2(pred2, val1, val2)`
|
`pred1(val1, val2)`
is true |
|
`ASSERT_PRED2(pred2, | `
EXPECT_PRED2(pred2, |
`pred2(val1, val2)`
is true |
|
`...`
|
`...`
|
`...`
|
: val1, val2);
` : val1, val2);`
: :
|
`...`
|
`...`
| ... |
In the above,
`predn`
is an
`n`
-ary predicate function or functor, where
`val1`
,
In the above,
`predn`
is an
`n`
-ary predicate function or functor, where
`val1`
,
`val2`
, ..., and
`valn`
are its arguments. The assertion succeeds if the
`val2`
, ..., and
`valn`
are its arguments. The assertion succeeds if the
...
@@ -331,22 +329,17 @@ want to learn more, see
...
@@ -331,22 +329,17 @@ want to learn more, see
#### Floating-Point Macros
#### Floating-Point Macros
| Fatal assertion | Nonfatal assertion | Verifies |
| Fatal assertion | Nonfatal assertion | Verifies |
| ----------------------- | ----------------------- | ----------------------- |
| ------------------------------- | ------------------------------- | ---------------------------------------- |
|
`ASSERT_FLOAT_EQ(val1, | `
EXPECT_FLOAT_EQ(val1, | the two
`float`
values |
|
`ASSERT_FLOAT_EQ(val1, val2);`
|
`EXPECT_FLOAT_EQ(val1, val2);`
| the two
`float`
values are almost equal |
: val2);
` : val2);`
: are almost equal :
|
`ASSERT_DOUBLE_EQ(val1, val2);`
|
`EXPECT_DOUBLE_EQ(val1, val2);`
| the two
`double`
values are almost equal |
|
`ASSERT_DOUBLE_EQ(val1, | `
EXPECT_DOUBLE_EQ(val1, | the two
`double`
values |
: val2);
` : val2);`
: are almost equal :
By "almost equal" we mean the values are within 4 ULP's from each other.
By "almost equal" we mean the values are within 4 ULP's from each other.
The following assertions allow you to choose the acceptable error bound:
The following assertions allow you to choose the acceptable error bound:
| Fatal assertion | Nonfatal assertion | Verifies |
| Fatal assertion | Nonfatal assertion | Verifies |
| ------------------ | ------------------------ | ------------------------- |
| ------------------------------------- | ------------------------------------- | -------------------------------------------------------------------------------- |
|
`ASSERT_NEAR(val1, | `
EXPECT_NEAR(val1, val2, | the difference between |
|
`ASSERT_NEAR(val1, val2, abs_error);`
|
`EXPECT_NEAR(val1, val2, abs_error);`
| the difference between
`val1`
and
`val2`
doesn't exceed the given absolute error |
: val2, abs_error);
` : abs_error);`
:
`val1`
and
`val2`
doesn't :
: : : exceed the given absolute :
: : : error :
#### Floating-Point Predicate-Format Functions
#### Floating-Point Predicate-Format Functions
...
@@ -370,9 +363,8 @@ arguments passed to mock objects. A gMock *matcher* is basically a predicate
...
@@ -370,9 +363,8 @@ arguments passed to mock objects. A gMock *matcher* is basically a predicate
that knows how to describe itself. It can be used in these assertion macros:
that knows how to describe itself. It can be used in these assertion macros:
| Fatal assertion | Nonfatal assertion | Verifies |
| Fatal assertion | Nonfatal assertion | Verifies |
| ------------------- | ------------------------------ | --------------------- |
| ------------------------------ | ------------------------------ | --------------------- |
|
`ASSERT_THAT(value, | `
EXPECT_THAT(value, matcher);
` | value matches matcher |
|
`ASSERT_THAT(value, matcher);`
|
`EXPECT_THAT(value, matcher);`
| value matches matcher |
: matcher);`
: : :
For example,
`StartsWith(prefix)`
is a matcher that matches a string starting
For example,
`StartsWith(prefix)`
is a matcher that matches a string starting
with
`prefix`
, and you can write:
with
`prefix`
, and you can write:
...
@@ -1342,18 +1334,13 @@ generators*. Here is a summary of them, which are all in the `testing`
...
@@ -1342,18 +1334,13 @@ generators*. Here is a summary of them, which are all in the `testing`
namespace:
namespace:
| Parameter Generator | Behavior |
| Parameter Generator | Behavior |
| ---------------------------- | ------------------------------------------- |
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
`Range(begin, end [, step])`
| Yields values
`{begin, begin+step, |
|
`Range(begin, end [, step])`
| Yields values
`{begin, begin+step, begin+step+step, ...}`
. The values do not include
`end`
.
`step`
defaults to 1. |
: : begin+step+step, ...}`
. The values do not :
: : include
`end`
.
`step`
defaults to 1. :
|
`Values(v1, v2, ..., vN)`
| Yields values
`{v1, v2, ..., vN}`
. |
|
`Values(v1, v2, ..., vN)`
| Yields values
`{v1, v2, ..., vN}`
. |
|
`ValuesIn(container)`
and | Yields values from a C-style array, an |
|
`ValuesIn(container)`
and | Yields values from a C-style array, an |
:
`ValuesIn(begin,end)`
: STL-style container, or an iterator range :
| :
`ValuesIn(begin,end)`
: STL-style container, or an iterator range
`[begin, end)`
|
: :
`[begin, end)`
. :
|
`Bool()`
| Yields sequence
`{false, true}`
. |
|
`Bool()`
| Yields sequence
`{false, true}`
. |
|
`Combine(g1, g2, ..., gN)`
| Yields all combinations (Cartesian product) |
|
`Combine(g1, g2, ..., gN)`
| Yields all combinations (Cartesian product) as std
\:\:
tuples of the values generated by the
`N`
generators. |
: : as std
\:\:
tuples of the values generated by :
: : the
`N`
generators. :
For more details, see the comments at the definitions of these functions.
For more details, see the comments at the definitions of these functions.
...
...
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