diff --git a/doc/boost_test.md b/doc/boost_test.md index 142a34e3..e5351d7a 100644 --- a/doc/boost_test.md +++ b/doc/boost_test.md @@ -18,7 +18,7 @@ RC_BOOST_PROP(MyTestCase, } ``` -The parenthesis around the argument list are required because of how the preprocessor works and can not be omitted. This also means that if you don't want any arguments generated, you need to include an empty set of paranthesis: +The parenthesis around the argument list are required because of how the preprocessor works and can not be omitted. This also means that if you don't want any arguments generated, you need to include an empty set of parenthesis: ```C++ // If you don't have any arguments, you have to have an empty paren diff --git a/doc/debugging.md b/doc/debugging.md index 4fd531d3..170593d0 100644 --- a/doc/debugging.md +++ b/doc/debugging.md @@ -24,7 +24,7 @@ RC_PARAMS="seed=12776003016957408636" ./my_test ``` ### Reproduce mode ### -If the bug occured after large number of test cases, waiting for test cases that are known to be successful to run before the failing test case is run can be time consuming. For example, if the bug occured after 2000 tests and 200 shrinks, it is not interesting to run the 1999 (successful) test cases before that and it is not really necessary to try all the shrunk versions of the failure that were tried byt could not reproduce the bug. +If the bug occurred after large number of test cases, waiting for test cases that are known to be successful to run before the failing test case is run can be time consuming. For example, if the bug occurred after 2000 tests and 200 shrinks, it is not interesting to run the 1999 (successful) test cases before that and it is not really necessary to try all the shrunk versions of the failure that were tried but could not reproduce the bug. Fortunately, RapidCheck will print a string that encodes the necessary information to avoid this to the console if there are failures: @@ -60,7 +60,7 @@ When passed a string argument it will instead immediately log the message follow RC_LOG("It's all broken!"); ``` -As stated above, none of this will have any effect on the sucess or failure of the test case. The information will only be printed when the test case fails otherwise. For example: +As stated above, none of this will have any effect on the success or failure of the test case. The information will only be printed when the test case fails otherwise. For example: ``` Falsifiable after 38 tests and 2 shrinks diff --git a/doc/generators_ref.md b/doc/generators_ref.md index 36b97bbe..39330452 100644 --- a/doc/generators_ref.md +++ b/doc/generators_ref.md @@ -164,7 +164,7 @@ const auto integer = *gen::cast(gen::arbitrary()); ## Text ## #### `Gen character()` #### -Generates text characters. Common occuring characters have a higher probability of being generated. +Generates text characters. Commonly occurring characters have a higher probability of being generated. ```C++ // Example: @@ -220,7 +220,7 @@ const auto x = *gen::positive(); ## Containers ## #### `Gen container(Gen... gens)` #### -Generates an STL container containing elements generated by the given generator(s). For most containers you should only specify one generator but for containers that have both keys and values (i.e. maps), you need to supply two separate generators. The `Container` type parameter must be sepcified explicitly. +Generates an STL container containing elements generated by the given generator(s). For most containers you should only specify one generator but for containers that have both keys and values (i.e. maps), you need to supply two separate generators. The `Container` type parameter must be specified explicitly. ```C++ // Example: @@ -231,7 +231,7 @@ const auto smallInts = *gen::container>(gen::inRange(0, 100)); Like `container(Gen... gens)` but generates containers of a fixed size `count.` #### `Gen unique(Gen gen)` #### -Generates a container of unique `T`. The `Container` type parameter must be sepcified explicitly. +Generates a container of unique `T`. The `Container` type parameter must be specified explicitly. ```C++ // Example: @@ -239,7 +239,7 @@ const auto uniqueInts = gen::unique>(gen::arbitrary()); ``` #### `Gen uniqueBy(Gen gen, F f)` #### -Generates a container of `T` such that for every element `e` in the container, `f(e)` is unique. The `Container` type parameter must be sepcified explicitly. +Generates a container of `T` such that for every element `e` in the container, `f(e)` is unique. The `Container` type parameter must be specified explicitly. ```C++ // Example: diff --git a/doc/gtest.md b/doc/gtest.md index c91133ed..d6141e5c 100644 --- a/doc/gtest.md +++ b/doc/gtest.md @@ -18,7 +18,7 @@ RC_GTEST_PROP(MyTestCase, } ``` -The parenthesis around the argument list are required because of how the preprocessor works and can not be omitted. This also means that if you don't want any arguments generated, you need to include an empty set of paranthesis: +The parenthesis around the argument list are required because of how the preprocessor works and can not be omitted. This also means that if you don't want any arguments generated, you need to include an empty set of parenthesis: ```C++ // If you don't have any arguments, you have to have an empty paren diff --git a/doc/state.md b/doc/state.md index 9a1b9819..55aecfec 100644 --- a/doc/state.md +++ b/doc/state.md @@ -22,7 +22,7 @@ RapidCheck provides a framework that takes exactly this approach in the `rapidch - Implementations of the operations that can be performed on the System Under Test. - A model of the state of the System Under Test. -The operations are represented as subclasses of the `rc::state::Command` template and the model is usually just a simple struct containg enough information to model the expected behavior of the system. +The operations are represented as subclasses of the `rc::state::Command` template and the model is usually just a simple struct containing enough information to model the expected behavior of the system. The need for a model might require some explanation. First, a system does not always provide enough public information to be able to know the expected behavior. Systems typically have lots of hidden state that we cannot see but still want to test. More importantly, the model allows RapidCheck to generate valid sequences of commands without even running the actual System Under Test. This is especially important while shrinking a test case since we do not want to try a shrunk sequence only to find out that it was not valid. This could lead to very slow shrinking. @@ -112,7 +112,7 @@ The state that is passed to the command generator function in `rc::state::check` ## Tips ## ### Generate initialization parameters ### -Since the `rc::state::check` call is part of a regular RapidCheck property, you are free to also generate the initalization data for the model and state. If we for example modify the above example a bit: +Since the `rc::state::check` call is part of a regular RapidCheck property, you are free to also generate the initialization data for the model and state. If we for example modify the above example a bit: ```C++ rc::check([](const std::map &data) { @@ -126,4 +126,4 @@ rc::check([](const std::map &data) { ``` ### Non-copyable models ### -The state testing framework supports models that not have copy constructors and/or copy-assignment operators. For a lot of [calls to the API](state_ref.md) (i.e. `rc::state::check`), you have to use an overload that takes a callable that returns a model state instead of passing the model state directly. Since testing process is destroys the model state, fresh new model states have to be created. For a model which is not copyable, RapidCheck can obivously not store a copy to use as a template. +The state testing framework supports models that not have copy constructors and/or copy-assignment operators. For a lot of [calls to the API](state_ref.md) (i.e. `rc::state::check`), you have to use an overload that takes a callable that returns a model state instead of passing the model state directly. Since testing process is destroys the model state, fresh new model states have to be created. For a model which is not copyable, RapidCheck can obviously not store a copy to use as a template. diff --git a/doc/state_ref.md b/doc/state_ref.md index 5d7232c4..d48e1f41 100644 --- a/doc/state_ref.md +++ b/doc/state_ref.md @@ -10,18 +10,18 @@ There are two overloads, one that takes the initial state as an immediate value This function must be used inside a property, it cannot be used standalone. ## `Command` ## -Represents an operation in the state testing framework. The `Model` type parameter is the type of the model that models `Sut` which is the actual System Under Test. These can also be accessed through the `Model` and `Sut` member type alises. +Represents an operation in the state testing framework. The `Model` type parameter is the type of the model that models `Sut` which is the actual System Under Test. These can also be accessed through the `Model` and `Sut` member type aliases. #### `virtual void checkPreconditions(const Model &s0) const` #### -If your command is not valid for all states, you must implement this method to assert preconditions. Preconditions can be asserted using any of the discarding macros such as `RC_PRE` or `RC_DISCARD`. If the command is discarded, RapidCheck will simply try to generate a new one. This method is intended to be overriden but has a default implementation that does nothing which is what you want if your command has no preconditions. +If your command is not valid for all states, you must implement this method to assert preconditions. Preconditions can be asserted using any of the discarding macros such as `RC_PRE` or `RC_DISCARD`. If the command is discarded, RapidCheck will simply try to generate a new one. This method is intended to be overridden but has a default implementation that does nothing which is what you want if your command has no preconditions. While the model state is passed as `const`, this doesn't prevent modification of the model if it, for example, is a `shared_ptr` or similar. Regardless, modifying the model state in this method leads to undefined behavior. #### `virtual void apply(Model &s0) const` #### -Applies this command to the given state. The effect of this command on the model should be equivalent to this commands effect on the System Under Test. This method is intended to be overriden but has a default implementation that does nothing, something that can be useful for commands that do not modify state. +Applies this command to the given state. The effect of this command on the model should be equivalent to this commands effect on the System Under Test. This method is intended to be overridden but has a default implementation that does nothing, something that can be useful for commands that do not modify state. #### `virtual void run(const Model &s0, Sut &sut) const` #### -Applies this command to the given System Under Test. The state before this command has been applied is also passed in. If you need the post state, you can get this using the `nextState` convenience method. This is the method in which to place your assertions (`RC_ASSERT` et al.). This method is intended to be overriden but has a default implementation that does nothing. +Applies this command to the given System Under Test. The state before this command has been applied is also passed in. If you need the post state, you can get this using the `nextState` convenience method. This is the method in which to place your assertions (`RC_ASSERT` et al.). This method is intended to be overridden but has a default implementation that does nothing. While the model state is passed as `const`, this doesn't prevent modification of the model if it, for example, is a `shared_ptr` or similar. Regardless, modifying the model state in this method leads to undefined behavior.