diff --git a/googlemock/scripts/upload.py b/googlemock/scripts/upload.py index 95239dc2..4b574732 100755 --- a/googlemock/scripts/upload.py +++ b/googlemock/scripts/upload.py @@ -631,7 +631,7 @@ class VersionControlSystem(object): new_content: For text files, this is empty. For binary files, this is the contents of the new file, since the diff output won't contain information to reconstruct the current file. - is_binary: True iff the file is binary. + is_binary: True if the file is binary. status: The status of the file. """ diff --git a/googletest/docs/advanced.md b/googletest/docs/advanced.md index f48e4b40..e05d3179 100644 --- a/googletest/docs/advanced.md +++ b/googletest/docs/advanced.md @@ -101,14 +101,15 @@ If you already have a function or functor that returns `bool` (or a type that can be implicitly converted to `bool`), you can use it in a *predicate assertion* to get the function arguments printed for free: -| Fatal assertion | Nonfatal assertion | Verifies | -| -------------------- | -------------------- | --------------------------- | -| `ASSERT_PRED1(pred1, | `EXPECT_PRED1(pred1, | `pred1(val1)` is true | -: val1);` : val1);` : : -| `ASSERT_PRED2(pred2, | `EXPECT_PRED2(pred2, | `pred2(val1, val2)` is true | -: val1, val2);` : val1, val2);` : : -| `...` | `...` | ... | + +| Fatal assertion | Nonfatal assertion | Verifies | +| --------------------------------- | --------------------------------- | --------------------------- | +| `ASSERT_PRED1(pred1, val1)` | `EXPECT_PRED1(pred1, val1)` | `pred1(val1)` is true | +| `ASSERT_PRED2(pred2, val1, val2)` | `EXPECT_PRED2(pred2, val1, val2)` | `pred1(val1, val2)` is true | +| `...` | `...` | `...` | + + 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 predicate returns `true` when applied to the given arguments, and fails @@ -330,23 +331,26 @@ want to learn more, see #### Floating-Point Macros -| Fatal assertion | Nonfatal assertion | Verifies | -| ----------------------- | ----------------------- | ----------------------- | -| `ASSERT_FLOAT_EQ(val1, | `EXPECT_FLOAT_EQ(val1, | the two `float` values | -: val2);` : val2);` : are almost equal : -| `ASSERT_DOUBLE_EQ(val1, | `EXPECT_DOUBLE_EQ(val1, | the two `double` values | -: val2);` : val2);` : are almost equal : + + +| Fatal assertion | Nonfatal assertion | Verifies | +| ------------------------------- | ------------------------------- | ---------------------------------------- | +| `ASSERT_FLOAT_EQ(val1, val2);` | `EXPECT_FLOAT_EQ(val1, val2);` | the two `float` values are almost equal | +| `ASSERT_DOUBLE_EQ(val1, val2);` | `EXPECT_DOUBLE_EQ(val1, val2);` | the two `double` values are almost equal | + + 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: -| Fatal assertion | Nonfatal assertion | Verifies | -| ------------------ | ------------------------ | ------------------------- | -| `ASSERT_NEAR(val1, | `EXPECT_NEAR(val1, val2, | the difference between | -: val2, abs_error);` : abs_error);` : `val1` and `val2` doesn't : -: : : exceed the given absolute : -: : : error : + + +| Fatal assertion | Nonfatal assertion | Verifies | +| ------------------------------------- | ------------------------------------- | -------------------------------------------------------------------------------- | +| `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 | + + #### Floating-Point Predicate-Format Functions @@ -369,10 +373,13 @@ Verifies that `val1` is less than, or almost equal to, `val2`. You can replace 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: -| Fatal assertion | Nonfatal assertion | Verifies | -| ------------------- | ------------------------------ | --------------------- | -| `ASSERT_THAT(value, | `EXPECT_THAT(value, matcher);` | value matches matcher | -: matcher);` : : : + + +| Fatal assertion | Nonfatal assertion | Verifies | +| ------------------------------ | ------------------------------ | --------------------- | +| `ASSERT_THAT(value, matcher);` | `EXPECT_THAT(value, matcher);` | value matches matcher | + + For example, `StartsWith(prefix)` is a matcher that matches a string starting with `prefix`, and you can write: @@ -1342,19 +1349,17 @@ for generating test parameters. They return what we call (surprise!) *parameter generators*. Here is a summary of them, which are all in the `testing` namespace: -| Parameter Generator | Behavior | -| ---------------------------- | ------------------------------------------- | -| `Range(begin, end [, step])` | Yields values `{begin, begin+step, | -: : begin+step+step, ...}`. The values do not : -: : include `end`. `step` defaults to 1. : -| `Values(v1, v2, ..., vN)` | Yields values `{v1, v2, ..., vN}`. | -| `ValuesIn(container)` and | Yields values from a C-style array, an | -: `ValuesIn(begin,end)` : STL-style container, or an iterator range : -: : `[begin, end)`. : -| `Bool()` | Yields sequence `{false, true}`. | -| `Combine(g1, g2, ..., gN)` | Yields all combinations (Cartesian product) | -: : as std\:\:tuples of the values generated by : -: : the `N` generators. : + + +| Parameter Generator | Behavior | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `Range(begin, end [, step])` | Yields values `{begin, begin+step, begin+step+step, ...}`. The values do not include `end`. `step` defaults to 1. | +| `Values(v1, v2, ..., vN)` | Yields values `{v1, v2, ..., vN}`. | +| `ValuesIn(container)` and `ValuesIn(begin,end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)` | +| `Bool()` | Yields sequence `{false, true}`. | +| `Combine(g1, g2, ..., gN)` | Yields all combinations (Cartesian product) as std\:\:tuples of the values generated by the `N` generators. | + + For more details, see the comments at the definitions of these functions. diff --git a/googletest/scripts/gen_gtest_pred_impl.py b/googletest/scripts/gen_gtest_pred_impl.py index b43efdf4..b00830d7 100755 --- a/googletest/scripts/gen_gtest_pred_impl.py +++ b/googletest/scripts/gen_gtest_pred_impl.py @@ -540,10 +540,10 @@ class Predicate%(n)sTest : public testing::Test { } } - // true iff the test function is expected to run to finish. + // true if the test function is expected to run to finish. static bool expected_to_finish_; - // true iff the test function did run to finish. + // true if the test function did run to finish. static bool finished_; """ % DEFS @@ -572,12 +572,12 @@ typedef Predicate%(n)sTest ASSERT_PRED%(n)sTest; """Returns the test for a predicate assertion macro. Args: - use_format: true iff the assertion is a *_PRED_FORMAT*. - use_assert: true iff the assertion is a ASSERT_*. - expect_failure: true iff the assertion is expected to fail. - use_functor: true iff the first argument of the assertion is + use_format: true if the assertion is a *_PRED_FORMAT*. + use_assert: true if the assertion is a ASSERT_*. + expect_failure: true if the assertion is expected to fail. + use_functor: true if the first argument of the assertion is a functor (as opposed to a function) - use_user_type: true iff the predicate functor/function takes + use_user_type: true if the predicate functor/function takes argument(s) of a user-defined type. Example: diff --git a/googletest/scripts/pump.py b/googletest/scripts/pump.py index 5efb653c..7dfb87a4 100755 --- a/googletest/scripts/pump.py +++ b/googletest/scripts/pump.py @@ -161,7 +161,7 @@ class Token: def StartsWith(lines, pos, string): - """Returns True iff the given position in lines starts with 'string'.""" + """Returns True if the given position in lines starts with 'string'.""" return lines[pos.line][pos.column:].startswith(string) diff --git a/googletest/scripts/upload.py b/googletest/scripts/upload.py index c852e4c9..8563e5f4 100755 --- a/googletest/scripts/upload.py +++ b/googletest/scripts/upload.py @@ -631,7 +631,7 @@ class VersionControlSystem(object): new_content: For text files, this is empty. For binary files, this is the contents of the new file, since the diff output won't contain information to reconstruct the current file. - is_binary: True iff the file is binary. + is_binary: True if the file is binary. status: The status of the file. """