appendParam() method from fcf::NTest::Storage class
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.4
Adds a parameters to a specific test case.
The
You can provide the parameter as a
Arguments
- The name of the test part.
- The name of the test group.
- The name of the test function.
- The parameter objects to be added.
Example: Adding parameters manually
Demonstrating how to use appendParam with SharedPtrAny to add different types of data.
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
FCF_TEST_BEFORE_DEFINE ("*", "*", "*", fcf::NTest::FL_GLOBAL) {
// Use appendParam to add test parameters as a SharedPtrAny to the test
fcf::NTest::storage ().appendParam ("Manual", "Params", "AppendTest",
fcf::NTest::SharedPtrAny::make <int >(42),
fcf::NTest::SharedPtrAny::make <int >(53),
fcf::NTest::SharedPtrAny::make <int >(71));
}
FCF_TEST_DEFINE ("Manual", "Params", "AppendTest") {
fcf::NTest::SharedPtrAny p = fcf::NTest::state ().param ();
FCF_TEST (p.is <int >(), "Parameter should be an int");
int * val = p.cast <int >();
fcf::NTest::log () << "Value: " << *val << std::endl;
}
int main(int a_argc, char* a_argv[]) {
bool error = false;
fcf::NTest::cmdRun (a_argc, a_argv, fcf::NTest::CRM_RUN , &error);
return error ? 1 : 0;
}
Output:
Performing the test: "Manual" -> "Params" -> "AppendTest" ...
== Parameter set: 1
> Value: 42
== Parameter set: 2
> Value: 53
== Parameter set: 3
> Value: 71
[SUCCESS] Test completed successfully (0.000`019`086 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 0.000`019`086 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.