appendParamValue() method from fcf::NTest::Storage class
template <typename ...TValuePack>
void
appendParamValue (const std::string & a_partName, const std::string & a_groupName, const std::string & a_testName, const TValuePack & ...a_parameterPack)
template <typename ...TValuePack>
void
appendParamValue (const fcf::NTest::Test & a_a_test, const TValuePack & ...a_parameterPack)
template <typename ...TValuePack>
void
appendParamValue (const fcf::NTest::TestPath & a_testPath, const TValuePack & ...a_parameterPack)
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.4
Adds a values as a parameters to a specific test case by automatically wrapping it in
The
Instead of manually creating a
Template arguments
Arguments
- The name of the test part.
- The name of the test group.
- The name of the test function.
- The values to be wrapped and added as a parameters.
Example: Using appendParamValue for convenience
Demonstrating how
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
FCF_TEST_BEFORE_DEFINE ("*", "*", "*", fcf::NTest::FL_GLOBAL) {
// Use the `appendParamValue` method to add test parameters as values a test.
fcf::NTest::storage ().appendParamValue ("MyLib", "Params", "AppendTest",
42,
53,
71);
}
FCF_TEST_DEFINE ("MyLib", "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: "MyLib" -> "Params" -> "AppendTest" ...
== Parameter set: 1
> Value: 42
== Parameter set: 2
> Value: 53
== Parameter set: 3
> Value: 71
[SUCCESS] Test completed successfully (0.000`018`606 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 0.000`018`606 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.